1 Star 0 Fork 36

polyGithub / BabyOS_Example

forked from bean / BabyOS_Example 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

BabyOS_Example

基于STM32F107,Master分支实现BabyOS Readme.md内容里使用方法部分的操作。


1.使用STM32CubeMX建立工程

配置时钟,开启SPI,开启串口。

2.添加子模块并更新

git submodule add https://gitee.com/notrynohigh/BabyOS.git
git submodule update --init --recursive

下载BabyOS配置文件放入工程:https://gitee.com/notrynohigh/BabyOS_Config

下载BabyOS硬件抽象层文件放入工程(使用st_hal分支文件):https://gitee.com/notrynohigh/BabyOS_Hal

3.添加文件

BabyOS
├── bos
│   ├── algorithm               
│   ├── core					//全部添加
│   ├── drivers					//添加 b_drv_spiflash
│   ├── modules					//全部添加
│   ├── thirdparty				//添加SFUD
│   └── utils
├── build						
├── CMakeLists.txt
├── doc							
├── Examples					
│   └── qpn
├── LICENSE						
├── main.c						
└── README.md
BabyOS_Config					//添加全部
BabyOS_Hal						//添加 gpio, uart, spi相关文件

4.添加头文件

5.增加系统定时器

/**
* @brief This function handles System tick timer.
*/
void SysTick_Handler(void)
{
  /* USER CODE BEGIN SysTick_IRQn 0 */
  bHalIncSysTick();
  /* USER CODE END SysTick_IRQn 0 */
  HAL_IncTick();
  HAL_SYSTICK_IRQHandler();
  /* USER CODE BEGIN SysTick_IRQn 1 */

  /* USER CODE END SysTick_IRQn 1 */
}

6.使能KV功能模块

7.注册设备

B_DEVICE_REG(SPIFLASH, bSPIFLASH_Driver[0], "flash")

8.添加硬件平台头文件

#ifndef __B_HAL_H__
#define __B_HAL_H__

#ifdef __cplusplus
 extern "C" {
#endif

/*Includes ----------------------------------------------*/
#include "b_config.h" 
#include "stm32f1xx_hal.h"   //add the platform h file

9.添加SPI和GPIO硬件抽象层

10.使用kv功能模块

  /* USER CODE BEGIN WHILE */
  bInit();
  bKV_Init(SPIFLASH, 0, 40960, 4096);
  uint8_t tmp = 0xaa;
  bKV_Set("bos", &tmp, 1);
  tmp = 0;
  bKV_Get("bos", &tmp);
  b_log("tmp:%x\r\n", tmp);
  while (1)
  {
    bExec();
  /* USER CODE END WHILE */

BabyOS master分支 https://gitee.com/notrynohigh/BabyOS

BabyOS教程更新会在公众号推送:

MIT License Copyright (c) 2020 bean Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

为BabyOS增加使用例子,每一个分支对应一篇教程,请根据需要切换至对应分支 展开 收起
C
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
C
1
https://gitee.com/polygithub/BabyOS_Example.git
git@gitee.com:polygithub/BabyOS_Example.git
polygithub
BabyOS_Example
BabyOS_Example
master

搜索帮助