Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bsp][stm32][dosc][rsoc]更新STM32 BSP 制作教程 #9484

Merged
merged 2 commits into from
Sep 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions bsp/stm32/docs/How to make a STM32 BSP for RT-Thread.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,29 +68,35 @@ 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.)

![generate-code](figures/generate-code.png)

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

Expand Down
20 changes: 16 additions & 4 deletions bsp/stm32/docs/STM32系列BSP制作教程.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,29 +101,41 @@ 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 文件中)

![generate-code](figures/generate-code.png)

最终 CubeMX 生成的工程目录结构如下图所示:

![CubeMX 图7](./figures/CubeMX_5.png)
![CubeMX 图7](./figures/CubeMX_6.png)

#### 3.2.2 拷贝初始化函数

Expand Down
Binary file modified bsp/stm32/docs/figures/CubeMX_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified bsp/stm32/docs/figures/CubeMX_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified bsp/stm32/docs/figures/CubeMX_3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified bsp/stm32/docs/figures/CubeMX_4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified bsp/stm32/docs/figures/CubeMX_5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added bsp/stm32/docs/figures/CubeMX_6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified bsp/stm32/docs/figures_en/CubeMX_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified bsp/stm32/docs/figures_en/CubeMX_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified bsp/stm32/docs/figures_en/CubeMX_3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified bsp/stm32/docs/figures_en/CubeMX_4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified bsp/stm32/docs/figures_en/CubeMX_5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added bsp/stm32/docs/figures_en/CubeMX_6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading