[bsp][stm32][dosc][rsoc]更新STM32 BSP 制作教程 (#9484)
* [bsp][stm32][dosc]update bsp make * [bsp][stm32]注明文档中使用的cubemx版本
|
@ -68,21 +68,27 @@ Create a CubeMX project based on the target chip. The default CubeMX project is
|
|||
|
||||
Change the chip model to STM32F103C8Tx in the CubeMX project.
|
||||
|
||||
Note:The version of CubeMX used in this article is 6.12.0
|
||||
|
||||
#### 3.2.1 Generate CubeMX project
|
||||
|
||||
Configure the system clock, peripheral pins, etc. The steps are shown in the figure below:
|
||||
|
||||
1. Turn on the external clock, set the download mode, and turn on the serial peripherals (note that only the pins of the serial peripherals need to be selected, no other parameters need to be configured):
|
||||
|
||||
![Configure chip pins](./figures_en/CubeMX_1.png)
|
||||
![Turn on the clock](./figures_en/CubeMX_1.png)
|
||||
|
||||
![Configuring the download Mode](figures_en/CubeMX_2.png)
|
||||
|
||||
![Open the serial port](figures_en/CubeMX_3.png)
|
||||
|
||||
2. Configure the system clock:
|
||||
|
||||
![Configuring the System Clock](./figures_en/CubeMX_2.png)
|
||||
![Configuring the System Clock](./figures_en/CubeMX_4.png)
|
||||
|
||||
3. Set the project name and regenerate the CubeMX project at a specified address:
|
||||
|
||||
![Generate the corresponding configuration code](./figures_en/CubeMX_4.png)
|
||||
![Generate the corresponding configuration code](./figures_en/CubeMX_5.png)
|
||||
|
||||
Note: When generating the code, do not check the following options (ie: Do not let it generate a peripheral initialization as a pair of .c/.h files per perioheral.)
|
||||
|
||||
|
@ -90,7 +96,7 @@ Configure the system clock, peripheral pins, etc. The steps are shown in the fig
|
|||
|
||||
4. The final project directory structure generated by CubeMX is shown in the figure below:
|
||||
|
||||
![CubeMX 7](./figures_en/CubeMX_5.png)
|
||||
![CubeMX 7](./figures_en/CubeMX_6.png)
|
||||
|
||||
#### 3.2.2 Copy initialization function
|
||||
|
||||
|
|
|
@ -101,21 +101,33 @@ BSP 的制作过程分为如下五个步骤:
|
|||
|
||||
在 CubeMX 工程中将芯片型号为修改芯片型号为 STM32F103RBTx 。
|
||||
|
||||
注意:本文使用的CubeMX版本为6.12.0
|
||||
|
||||
#### 3.2.1 生成 CubeMX 工程
|
||||
|
||||
配置系统时钟、外设引脚等,步骤如下图所示:
|
||||
|
||||
1. 打开外部时钟、设置下载方式、打开串口外设(注意只需要选择串口外设引脚即可,无需配置其他参数):
|
||||
|
||||
![配置芯片引脚](./figures/CubeMX_1.png)
|
||||
![打开外部时钟](./figures/CubeMX_1.png)
|
||||
|
||||
![设置下载方式](./figures/CubeMX_2.png)
|
||||
|
||||
|
||||
|
||||
![配置串口](figures/CubeMX_3.png)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
2. 配置系统时钟:
|
||||
|
||||
![配置系统时钟](./figures/CubeMX_2.png)
|
||||
![配置系统时钟](figures/CubeMX_4.png)
|
||||
|
||||
3. 设置项目名称,并在指定地址重新生成 CubeMX 工程:
|
||||
|
||||
![生成对应的配置代码](./figures/CubeMX_4.png)
|
||||
![生成对应的配置代码](figures/CubeMX_5.png)
|
||||
|
||||
注意:在生成代码时,不要勾选以下选项(即:不让其生成单独的 .c/.h 驱动文件,直接全部更新到 rt-thread 要使用的 stm32xxx_hal_msp.c 文件中)
|
||||
|
||||
|
@ -123,7 +135,7 @@ BSP 的制作过程分为如下五个步骤:
|
|||
|
||||
最终 CubeMX 生成的工程目录结构如下图所示:
|
||||
|
||||
![CubeMX 图7](./figures/CubeMX_5.png)
|
||||
![CubeMX 图7](./figures/CubeMX_6.png)
|
||||
|
||||
#### 3.2.2 拷贝初始化函数
|
||||
|
||||
|
|
Before Width: | Height: | Size: 121 KiB After Width: | Height: | Size: 141 KiB |
Before Width: | Height: | Size: 102 KiB After Width: | Height: | Size: 100 KiB |
Before Width: | Height: | Size: 78 KiB After Width: | Height: | Size: 143 KiB |
Before Width: | Height: | Size: 95 KiB After Width: | Height: | Size: 204 KiB |
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 171 KiB |
After Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 122 KiB After Width: | Height: | Size: 141 KiB |
Before Width: | Height: | Size: 102 KiB After Width: | Height: | Size: 100 KiB |
Before Width: | Height: | Size: 78 KiB After Width: | Height: | Size: 143 KiB |
Before Width: | Height: | Size: 94 KiB After Width: | Height: | Size: 204 KiB |
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 171 KiB |
After Width: | Height: | Size: 19 KiB |