[bsp][STM32] update stm32 bsp
@@ -10,4 +10,11 @@ STM32 系列 BSP 目前支持情况如下表所示:
|
||||
| stm32f429-atk-apollo | 正点原子 F429 阿波罗开发板 |
|
||||
| stm32f429-fire-challenger | 野火 F429 挑战者开发板 |
|
||||
|
||||
了解每个 BSP 的详细情况可以阅读该 BSP 下的 readme 文件,如需使用 BSP 更多功能可参考 docs 文件夹下提供的说明文档:
|
||||
|
||||
| 文档名称 | 简介 |
|
||||
| -------------------- | ------------------------------------------------- |
|
||||
| BSP 进阶使用指南 | 介绍如何使用 BSP 提供的高级功能以及添加更多新功能 |
|
||||
| STM32系列BSP添加教程 | 介绍如何添加一个新的 STM32 系列的 BSP |
|
||||
| STM32系列BSP制作规范 | 介绍一个新 STM32 系列 BSP 的制作规范 |
|
||||
|
||||
|
||||
115
bsp/stm32/docs/BSP进阶使用指南.md
Normal file
@@ -0,0 +1,115 @@
|
||||
# BSP 进阶使用指南
|
||||
|
||||
## 简介
|
||||
|
||||
本文档是为需要在 RT-Thread 操作系统上使用更多开发板资源的开发者准备的。通过使用 ENV 工具对 BSP 进行配置,可以开启更多板载资源,实现更多高级功能。
|
||||
|
||||
主要包括以下内容:
|
||||
|
||||
1. 如何使用开发板上更多的板载资源
|
||||
2. 如何使用更多的片上资源
|
||||
3. 如何添加更多片上资源选项
|
||||
|
||||
## 前提要求
|
||||
|
||||
- 学会如何使用 ENV 工具,参考:[RT-Thread env 工具用户手册](https://www.rt-thread.org/document/site/rtthread-development-guide/rtthread-tool-manual/env/env-user-manual/)
|
||||
|
||||
## 如何使用更多的板载资源
|
||||
|
||||
开发板上一般有很多的板载资源,如 Flash、SD卡、以太网等,但是 BSP 工程默认没有添加对这些外设的支持。如何在工程里添加这些外设的支持呢?这就需要使用 ENV 工具了。下面以在正点原子阿波罗 F429 开发板上开启 SPI Flash 支持为例,一步步的展示如何使用 ENV 工具对 BSP 进行配置。
|
||||
|
||||
### 1)打开配置工具
|
||||
|
||||
在目录 `rt-thread\bsp\stm32\stm32f429-atk-apollo` 下打开 menuconfig 配置界面。
|
||||
|
||||

|
||||
|
||||
打开的配置工具界面如下所示:
|
||||
|
||||

|
||||
|
||||
通过键盘上的上下键移动光标,选中 `Hardware Drivers Config`然后按回车键进入硬件驱动配置菜单。
|
||||
|
||||
### 2)进入硬件驱动配置菜单
|
||||
|
||||
在硬件配置菜单里有三个选项,分别是 **板载外设配置菜单**、**片上外设配置菜单**和**扩展模块配置菜单**,按回车键进入板载外设配置菜单。
|
||||
|
||||

|
||||
|
||||
### 3)在板载外设配置菜单里开启 SPI Flash 选项
|
||||
|
||||

|
||||
|
||||
### 4)保存退出
|
||||
|
||||
然后右移光标选中 Save 按回车键保存,然后按 Esc 键退出配置工具。
|
||||
|
||||

|
||||
|
||||
### 5)更新软件包
|
||||
|
||||
输入命令 `pkgs --update` 使软件包配置生效。
|
||||
|
||||

|
||||
|
||||
### 6)生成 MDK5 工程
|
||||
|
||||
输入命令 `scons --target=mdk5 -s` 重新生成 MDK5 的工程。
|
||||
|
||||

|
||||
|
||||
### 7)编译下载
|
||||
|
||||
打开生成的 MDK5 工程文件,编译并下载。
|
||||
|
||||

|
||||
|
||||
### 8)查看运行结果
|
||||
|
||||
程序运行后,输入命令 `list_device` 可以看到名为 W25Q256 的块设备,此时 `SPI Flash` 设备已经可以使用了。
|
||||
|
||||

|
||||
|
||||
## 如何使用更多的片上资源
|
||||
|
||||
如果想要使用除了当前支持的片上资源(GPIO 和 UART1),又不想开启板载资源的支持,可以通过直接配置 **片上外设配置菜单** 的方式,使用更多片上资源。
|
||||
|
||||
配置方法和上一章节介绍的 **如何使用更多的板载资源的配置方法** 一样,只是本次需要进入 `片上外设配置菜单`。
|
||||
|
||||

|
||||
|
||||
## 如何添加更多的片上资源选项
|
||||
|
||||
如果想使用的片上外设是 `片上外设配置菜单` 里没有的,就需要自己添加了。下面以添加 SPI3 的驱动支持为例讲解如何添加更多片上外设支持。
|
||||
|
||||
> 没有安装 stm32cubemx 软件的移步 STM32cube中文网:<http://www.stm32cube.com/> ,在 `资源下载` 里下载 stm32cubemx 软件。
|
||||
|
||||
添加 SPI3 的外设支持需要以下几步:
|
||||
|
||||
### 1)打开 Cube 的工程
|
||||
|
||||

|
||||
|
||||
### 2)配置好 SPI3 的引脚,并生成代码
|
||||
|
||||
按照图中所示步骤操作:
|
||||
|
||||

|
||||
|
||||
### 3)修改 Konfig 文件
|
||||
|
||||
打开board文件夹下的 Konfig 文件,拷贝 SPI2 的配置项,并重命名 SPI2 为 SPI3。
|
||||
|
||||

|
||||
|
||||
### 4)重新配置工程
|
||||
|
||||
经过上一步的修改,此时重新打开 ENV 工具,在 menuconfig 中就会出现添加的 SPI3 的配置项。
|
||||
|
||||

|
||||
|
||||
### 5)生成工程,编译下载
|
||||
|
||||
重新生成工程之后,编译下载到开发板,程序会自动开始运行。输入 `list_device` 命令可以看到 spi3 总线设备已经挂载成功了。
|
||||
|
||||

|
||||
@@ -112,6 +112,8 @@ STM32 BSP 由三部分组成,分别是 (1) 通用库、(2) BSP 模板和 (3)
|
||||
| SOC_STM32F103RB | 芯片型号 | SOC_STM32xxx |
|
||||
| SOC_SERIES_STM32F1 | 芯片系列| SOC_SERIES_STM32xx |
|
||||
|
||||
用户可参考这个链接学习 Kconfig语法:(https://blog.csdn.net/jianwen_hi/article/details/53398141)
|
||||
|
||||
### 修改工程构建相关文件
|
||||
接下来需要修改用于构建工程相关的文件。
|
||||
|
||||
|
Before Width: | Height: | Size: 121 KiB After Width: | Height: | Size: 121 KiB |
|
Before Width: | Height: | Size: 102 KiB After Width: | Height: | Size: 102 KiB |
|
Before Width: | Height: | Size: 78 KiB After Width: | Height: | Size: 78 KiB |
|
Before Width: | Height: | Size: 95 KiB After Width: | Height: | Size: 95 KiB |
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
BIN
bsp/stm32/docs/figures/Kconfig.png
Normal file
|
After Width: | Height: | Size: 76 KiB |
BIN
bsp/stm32/docs/figures/Kconfig2.png
Normal file
|
After Width: | Height: | Size: 68 KiB |
|
Before Width: | Height: | Size: 146 KiB After Width: | Height: | Size: 146 KiB |
|
Before Width: | Height: | Size: 81 KiB After Width: | Height: | Size: 81 KiB |
|
Before Width: | Height: | Size: 204 KiB After Width: | Height: | Size: 204 KiB |
BIN
bsp/stm32/docs/figures/complise.png
Normal file
|
After Width: | Height: | Size: 79 KiB |
BIN
bsp/stm32/docs/figures/config.png
Normal file
|
After Width: | Height: | Size: 23 KiB |
BIN
bsp/stm32/docs/figures/config1.png
Normal file
|
After Width: | Height: | Size: 35 KiB |
BIN
bsp/stm32/docs/figures/config2.png
Normal file
|
After Width: | Height: | Size: 30 KiB |
BIN
bsp/stm32/docs/figures/config3.png
Normal file
|
After Width: | Height: | Size: 37 KiB |
BIN
bsp/stm32/docs/figures/config4.png
Normal file
|
After Width: | Height: | Size: 32 KiB |
BIN
bsp/stm32/docs/figures/config5.png
Normal file
|
After Width: | Height: | Size: 39 KiB |
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
BIN
bsp/stm32/docs/figures/cube_spi3.png
Normal file
|
After Width: | Height: | Size: 145 KiB |
BIN
bsp/stm32/docs/figures/cubemx.png
Normal file
|
After Width: | Height: | Size: 16 KiB |
BIN
bsp/stm32/docs/figures/exit.png
Normal file
|
After Width: | Height: | Size: 32 KiB |
|
Before Width: | Height: | Size: 65 KiB After Width: | Height: | Size: 65 KiB |
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
BIN
bsp/stm32/docs/figures/menuconfig.png
Normal file
|
After Width: | Height: | Size: 105 KiB |
|
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 27 KiB |
|
Before Width: | Height: | Size: 91 KiB After Width: | Height: | Size: 91 KiB |
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
BIN
bsp/stm32/docs/figures/menuconfig_apolo.png
Normal file
|
After Width: | Height: | Size: 7.0 KiB |
BIN
bsp/stm32/docs/figures/on_chip_config.png
Normal file
|
After Width: | Height: | Size: 48 KiB |
BIN
bsp/stm32/docs/figures/run_flash.png
Normal file
|
After Width: | Height: | Size: 25 KiB |
BIN
bsp/stm32/docs/figures/run_spi3.png
Normal file
|
After Width: | Height: | Size: 16 KiB |
BIN
bsp/stm32/docs/figures/save.png
Normal file
|
After Width: | Height: | Size: 31 KiB |
BIN
bsp/stm32/docs/figures/scons_mdk5.png
Normal file
|
After Width: | Height: | Size: 16 KiB |
BIN
bsp/stm32/docs/figures/spi_flash.png
Normal file
|
After Width: | Height: | Size: 42 KiB |
|
Before Width: | Height: | Size: 33 KiB After Width: | Height: | Size: 33 KiB |
|
Before Width: | Height: | Size: 35 KiB After Width: | Height: | Size: 35 KiB |
|
Before Width: | Height: | Size: 118 KiB After Width: | Height: | Size: 118 KiB |
BIN
bsp/stm32/docs/figures/update.png
Normal file
|
After Width: | Height: | Size: 22 KiB |
|
Before Width: | Height: | Size: 205 KiB After Width: | Height: | Size: 205 KiB |
@@ -3,7 +3,6 @@
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2018-11-06 SummerGift change to new framework
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2018-10-30 BalanceTWK change to new framework
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2018-11-06 SummerGift change to new framework
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2018-10-30 SummerGift change to new framework
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2018-11-06 SummerGift change to new framework
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2018-11-06 SummerGift change to new framework
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2018-11-7 SummerGift change to new framework
|
||||
|
||||