BabyOS is participating 2021 OSC China Open Source Project Selection , please vote for it!
BabyOS in 2021 OSC China Open Source Project Selection {{projectVoteCount} has been obtained in, please vote for it!
2021 OSC China Open Source Project Selection It is in hot progress. Come and vote for your favorite open source project!
2021 OSC China Open Source Project Selection>>> Midfield Review
BabyOS won the 2021 OSC China Open Source Project Selection "The Best Popularity Project" !
Authorization Agreement MIT
development language C/C++ View source code »
operating system Embedded
Software type Open source software
Open source organizations nothing
region domestic
deliverer Alias_Travis
intended for unknown
Recording time 2021-01-27

Software Introduction

BabyOS is applicable to MCU projects. It is a framework for managing functional modules and peripheral drivers.

For projects, shorten the development cycle Select applicable function modules and drivers during project development. Directly enter the stage of function code writing.

For engineers, reduce repetitive work The debugged function modules and driver code are managed in BabyOS, which can be directly used by the project in the future to eliminate repeated debugging.

Code structure

The BabyOS code is divided into three parts:

BabyOS warehouse : Function module and driver. Generally, the user does not need to change it. This warehouse can be used as a sub module.

BabyOS_Config : Configuration files and device registration files

BabyOS_Hal : Hardware abstraction layer. Different branches correspond to different hardware platforms. Select the corresponding platform to download. If there is no appropriate branch, select the master branch

 frame

Applicable items

It is recommended to use BabyOS for bare metal development projects.

BabyOS can be used as a function library and driver library for projects developed using the operating system.

usage method

Use SPIFLASH and KV function module on STM32F107 as an example

1. Add file

 BabyOS//can be used as a git submodule ├── bos │Γ - algorithm//Common algorithm, no need to add files │ -- core//core files, all included in the project │Γ -- drivers//Driver file, select the splash driver to add to the project │☆ -- modules//functional modules, all of which are added to the project and configured by the configuration file b_config. h │Γ - thirdparty//Third party code, select SFUD third party code to add to the project │ L -- utils//Utility code, select delay part of the code to add to the project ▄ - doc//related documents ☆ - LICENSE//Open source protocol └── README.md BabyOS_Config//After cloning, place them in the project directory and add them all to the project BabyOS_Hal//After cloning, place it in the project directory, and add hal, gpio, uart, and spi parts
 //Enter the user project directory to execute git submodule add  https://gitee.com/notrynohigh/BabyOS.git git clone  https://gitee.com/notrynohigh/BabyOS_Config.git //Clone configuration file and device registration file git clone  https://gitee.com/notrynohigh/BabyOS_Hal.git //After cloning, switch to the branch of the corresponding platform. If not, use the master branch as the template

2. Add system timer

 //For example, using the tick timer, the interrupt service function calls: void bHalIncSysTick (void); //Note: The cycle of the timer should match the _TICK_FRQ_HZ in b_config. h

3. Select function module

B_config. h, check the KV Enable/Disable item

 config

4. Register equipment

 //B_device_list. h, add used peripherals. For example, if the project only needs to use SPIFlash, add the following code: //Device Driver Description B_DEVICE_REG(SPIFLASH, bSPIFLASH_Driver[0], "flash") //If no device is registered, uncomment B_DEVICE_REG (null, bNullDriver, "null") //B_DEVICE_REG(null, bNullDriver, "null")

5. Modify hardware interface

Modify GPIO and SPI number according to actual connection diagram in b_hal. h

 #define HAL_SPIFLASH_QSPI_EN            0 #define HAL_SPIFLASH_TOTAL_NUMBER       1  #define HAL_SPIFLASH_IF                 {{B_HAL_QSPI_INVALID, B_HAL_SPI_1, {B_HAL_GPIOB, B_HAL_PIN12}},}

6. Modify SPI part of hardware abstraction layer

(Depending on the hardware platform, use the STM32 HAL library as an example)

 //b_hal_spi.c int bHalSPI_Send(bHalSPINumber_t spi,  uint8_t *pbuf, uint16_t len) { if(pbuf == NULL) { return -1; } switch(spi) { case B_HAL_SPI_1: HAL_SPI_Transmit(&hspi1, pbuf, len, 0xfff); break;         default: break; } return 0; } int bHalSPI_Receive(bHalSPINumber_t spi,  uint8_t *pbuf, uint16_t len) { if(pbuf == NULL) { return -1; } switch(spi) { case B_HAL_SPI_1: HAL_SPI_Receive(&hspi1, pbuf, len, 0xfff); break;         default: break; } return 0; }

7. Modify the GPIO part of the hardware abstraction layer

(Depending on the hardware platform, use the STM32 HAL library as an example)

 void bHalGPIO_WritePin(uint8_t port,  uint8_t pin, uint8_t s) { GPIO_PinState sta = (s) ?  GPIO_PIN_SET : GPIO_PIN_RESET; HAL_GPIO_WritePin(GPIO_PortTable[port], GPIO_PinTable[pin], sta); }

8. Using KV function based on SPIFLASH

 #Include "b_os. h"//Header file //Enable KV storage in b_config. h configuration file int main() { uint8_t buf[128];  bInit();    // Initialization. Initialization of peripherals will be called here If (0==bKV_Init (SPIFLASH, 0xA000, 4096 * 4, 4096))//Initialize the KV storage and specify the storage device SPIFLASH { b_log("bKV_Init ok...\r\n"); } //Storage key value pair (available for storage system configuration information) bKV_Set("name", (uint8_t *)"BabyOS", 7); bKV_Get("name", buf); b_log("name:%s\r\n", buf);  //...... while(1) { //..... bExec();      // Loop this function //..... } }

If the function module is not used and the equipment is operated separately, the following methods shall be used:

 //For example, use SPIFLASH to read data, and read 128 bytes of data from the 0 address to buf { int fd = -1; fd = bOpen(SPIFLASH, BCORE_FLAG_RW); if(fd == -1) { return; } bLseek(fd, 0); bRead(fd, buf, 128); bClose(fd);  }

More instructions:

https://gitee.com/notrynohigh/BabyOS/wikis

https://github.com/notrynohigh/BabyOS/wiki

Expand to read the full text

code

Gitee index of is
exceed Items for

BOM

Device model Device manufacturer More information
{{o.mpn}} {{o.mfr}} see

comment

Click to join the discussion 🔥 (2) Post and join the discussion 🔥
Published information
2023/01/22 17:35

BabyOS V8.2.0 was released to develop accelerated code frameworks for MCU projects

BabyOS V8.2.0 has been released to speed up the development of the code framework for MCU projects. The updated content of this version includes: 1. Changing the way of configuring BabyOS, using Kconfig 2. Double clicking b_config. bat under the _config directory in the windows environment to configure 3. Running the test directory in the linux environment, executing make menuconfig to configure 4. Reducing the IAP interface, More convenient to use. Note: Ensure that the computer has a python environment (both 2 and 3). You can execute python and pip commands in the command window. See the following for details: https://gitee.com/notrynohigh/BabyOS/releas...

zero
three
Published information
2022/12/08 01:43

BabyOS V8.0.0 has been released to develop a accelerated code framework for MCU projects

BabyOS V8.0.0 has been released to speed up the development of the code framework for MCU projects. The updated content of this version includes: 1. optimizing the driver framework and unifying the driver code writing method. 2. adding a simple state machine to help write applications. 3. optimizing IAP function modules to help write OTA codes. 4. adding and optimizing function modules and interfaces Details: https://gitee.com/notrynohigh/BabyOS/releases/V8.0.0

zero
one
No more
Loading failed, please refresh the page
Click to load more
Loading
next page
{{o.pubDate | formatDate}}

{{formatAllHtml(o.title)}}

{{parseInt(o.replyCount) | bigNumberTransform}}
{{parseInt(o.viewCount) | bigNumberTransform}}
No more
No content temporarily
Issued a question and answer
{{o.pubDate | formatDate}}

{{formatAllHtml(o.title)}}

{{parseInt(o.replyCount) | bigNumberTransform}}
{{parseInt(o.viewCount) | bigNumberTransform}}
No more
No content temporarily
No content temporarily
two comment
sixty Collection
 OSCHINA
Log in to view more high-quality content
 Back to top
Top