[STM32][DOC] figures更新图片描述,增加对应翻译,文件夹为figures_en
|
@ -14,7 +14,7 @@ The main features of the new STM32 BSP framework are as follows:
|
|||
|
||||
The BSP frame structure is shown in the figure below:
|
||||
|
||||
![BSP 框架图](./figures/frame.png)
|
||||
![BSP frame structure](./figures_en/frame.png)
|
||||
|
||||
Each BSP of the STM32 series consists of three parts, namely the general library, the BSP template and the specific development board BSP. The following table uses the F1 series BSP as an example to introduce these three parts:
|
||||
|
||||
|
@ -44,11 +44,11 @@ The first step in making a new BSP is to copy a BSP template of the same series
|
|||
|
||||
The folder structure of the F1 series BSP template used in this example is as follows:
|
||||
|
||||
![F1 系列 BSP 模板文件夹内容](figures/bsp_template_dir.png)
|
||||
![F1 series BSP template folder contents](figures_en/bsp_template_dir.png)
|
||||
|
||||
Copy the `stm32f10x` folder under the template folder and change the name of the folder to `stm32f103-blue-pill`, as shown in the following figure:
|
||||
|
||||
![复制通用模板](./figures/copy.png)
|
||||
![Copying common templates](./figures_en/copy.png)
|
||||
|
||||
Modify the configuration file in the board folder. The modified content is shown in the following table:
|
||||
|
||||
|
@ -64,7 +64,7 @@ Modify the configuration file in the board folder. The modified content is shown
|
|||
|
||||
Create a CubeMX project based on the target chip. The default CubeMX project is in the **CubeMX_Config** folder, double-click to open the `CubeMX_Config.ioc` project, as shown in the figure below:
|
||||
|
||||
![open_cubemx](figures/open_cubemx.png)
|
||||
![open_cubemx](figures_en/open_cubemx.png)
|
||||
|
||||
Change the chip model to STM32F103C8Tx in the CubeMX project.
|
||||
|
||||
|
@ -74,15 +74,15 @@ Configure the system clock, peripheral pins, etc. The steps are shown in the fig
|
|||
|
||||
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):
|
||||
|
||||
![配置芯片引脚](./figures/CubeMX_1.png)
|
||||
![Configure chip pins](./figures_en/CubeMX_1.png)
|
||||
|
||||
2. Configure the system clock:
|
||||
|
||||
![配置系统时钟](./figures/CubeMX_2.png)
|
||||
![Configuring the System Clock](./figures_en/CubeMX_2.png)
|
||||
|
||||
3. Set the project name and regenerate the CubeMX project at a specified address:
|
||||
|
||||
![生成对应的配置代码](./figures/CubeMX_4.png)
|
||||
![Generate the corresponding configuration code](./figures_en/CubeMX_4.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,17 +90,17 @@ 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/CubeMX_5.png)
|
||||
![CubeMX 7](./figures_en/CubeMX_5.png)
|
||||
|
||||
#### 3.2.2 Copy initialization function
|
||||
|
||||
The function `SystemClock_Config()` is placed in the **board.c** file, which is responsible for initializing the system clock. When using the CubeMX tool to reconfigure the system clock, this function needs to be updated. This function is generated by the CubeMX tool and is placed in the file `board/CubeMX_Config/Src/main.c` by default. However, this file does not include in our project, so we need to copy this function from main.c to the board.c file. In the entire BSP making process, this function is the only function to be copied. The content of this function is as follows:
|
||||
|
||||
![board_1](./figures/board_1.png)
|
||||
![board_1](./figures_en/board_1.png)
|
||||
|
||||
The relevant parameters of FLASH and RAM are configured in the **board.h** file. What needs to be modified in this file is the parameters controlled by the two macros `STM32_FLASH_SIZE` and `STM32_SRAM_SIZE`. The flash size of the STM32F103C8Tx chip used in the BSP produced this time is 64k, and the size of the ram is 20k, so the file is modified as follows:
|
||||
|
||||
![修改 board.h](./figures/board_h.png)
|
||||
![Modified board.h](./figures_en/board_h.png)
|
||||
|
||||
#### 3.2.3 Heap memory configuration
|
||||
|
||||
|
@ -108,7 +108,7 @@ Normally, a part of the memory space in the system RAM will be used as heap memo
|
|||
|
||||
In some series of chips, the chip RAM may be distributed in multiple discrete memory areas. At this time, the location of the heap memory can be in the same continuous memory area as the system memory, or it can be stored in a separate memory area. For example, on the L4 series of chips, the heap memory can be configured in a 96k memory space with a starting address of `0x20000000`, and the 32k memory space starting from `0x10000000` can be used as the system running memory.
|
||||
|
||||
![heap_config](figures/heap_config.png)
|
||||
![heap_config](figures_en/heap_config.png)
|
||||
|
||||
### 3.3 Modify Kconfig configuration
|
||||
|
||||
|
@ -126,7 +126,7 @@ The modification of chip model and series is shown in the following table:
|
|||
|
||||
Regarding the peripheral support options on the BSP, a BSP submitted for the first time only needs to support the GPIO driver and the serial port driver, which means only these two driver configuration items need to be retained in the configuration options, as shown in the following figure:
|
||||
|
||||
![修改 Kconfig](./figures/Kconfig.png)
|
||||
![Modified Kconfig](./figures_en/Kconfig.png)
|
||||
|
||||
### 3.4 Modify project building related files
|
||||
|
||||
|
@ -134,19 +134,19 @@ Regarding the peripheral support options on the BSP, a BSP submitted for the fir
|
|||
|
||||
**linker_scripts** The link file is as shown in the figure below:
|
||||
|
||||
![需要修改的链接脚本](./figures/linker_scripts.png)
|
||||
![Link scripts that need to be modified](./figures_en/linker_scripts.png)
|
||||
|
||||
The following uses the link script link.sct used by MDK as an example to demonstrate how to modify the link script:
|
||||
|
||||
![linkscripts_change](figures/linkscripts_change.png)
|
||||
![linkscripts_change](figures_en/linkscripts_change.png)
|
||||
|
||||
The chip used to make the BSP this time is STM32F103RB, and the FLASH is 128k, so modify the parameters of LR_IROM1 and ER_IROM1 to 0x00020000. The size of RAM is 20k, so modify the parameter of RW_IRAM1 to 0x00005000. Such a modification method is sufficient for general applications. If there are special requirements in the future, you need to modify it as required according to the syntax of the link script. When modifying the link script, you can refer to the [**3.2.3 Heap memory configuration**](# 3.2.3 Heap memory configuration) chapter to determine the BSP memory allocation.
|
||||
|
||||
The other two link script files are link.icf used by IAR and link.lds used by the GCC compiler. The modification method is similar, as shown in the following figure:
|
||||
|
||||
![link_icf](figures/link_icf.png)
|
||||
![link_icf](figures_en/link_icf.png)
|
||||
|
||||
![link_lds](figures/link_lds.png)
|
||||
![link_lds](figures_en/link_lds.png)
|
||||
|
||||
#### 3.4.2 Modify the build script
|
||||
|
||||
|
@ -154,7 +154,7 @@ The **SConscript** script determines the files to be added during the generation
|
|||
|
||||
In this step, you need to modify the chip model and the address of the chip startup file. The modification content is shown in the figure below:
|
||||
|
||||
![修改启动文件和芯片型号](./figures/SConscript.png)
|
||||
![Modify the startup file and chip model](./figures_en/SConscript.png)
|
||||
|
||||
Note: If you cannot find the .s file of the corresponding series in the folder, it may be that multiple series of chips reuse the same startup file. At this time, you can generate the target chip project in CubeMX to see which startup file is used. Then modify the startup file name.
|
||||
|
||||
|
@ -162,15 +162,15 @@ Note: If you cannot find the .s file of the corresponding series in the folder,
|
|||
|
||||
The **template** file is a template file for generating the MDK/IAR project. By modifying the file, you can set the chip model used in the project and the download method. The project template file of MDK4/MDK5/IAR, as shown in the figure below:
|
||||
|
||||
![MDK/IAR 工程模板](./figures/template_1.png)
|
||||
![MDK/IAR engineering template](./figures_en/template_1.png)
|
||||
|
||||
The following takes the modification of the MDK5 template as an example to introduce how to modify the template configuration:
|
||||
|
||||
![选择芯片型号](./figures/template_2.png)
|
||||
![Select the chip model](./figures_en/template_2.png)
|
||||
|
||||
Modify the program download method:
|
||||
|
||||
![配置下载方式](./figures/template_3.png)
|
||||
![Configuring the Download Mode](./figures_en/template_3.png)
|
||||
|
||||
### 3.5 Regenerate the project
|
||||
|
||||
|
@ -180,17 +180,17 @@ Env tool is required to regenerate the project.
|
|||
|
||||
Enter the command menuconfig in the Env interface to configure the project and generate a new rtconfig.h file. As shown below:
|
||||
|
||||
![输入menuconfig进入配置界面](./figures/menuconfig_1.png)
|
||||
![Enter menuconfig to go to the configuration screen](./figures_en/menuconfig_1.png)
|
||||
|
||||
#### 3.5.2 Rebuild the MDK/IAR project
|
||||
|
||||
The following takes regenerating the MDK project as an example to introduce how to regenerate the BSP project. Use the Env tool to enter the command `scons --target=mdk5` to regenerate the project, as shown in the following figure:
|
||||
|
||||
![重新生成 BSP 工程](./figures/menuconfig_3.png)
|
||||
![Regenerate the BSP project](./figures_en/menuconfig_3.png)
|
||||
|
||||
Rebuild the project successfully:
|
||||
|
||||
![重新生成 BSP 工程](./figures/menuconfig_4.png)
|
||||
![Regenerate the BSP project](./figures_en/menuconfig_4.png)
|
||||
|
||||
At this point, the new BSP can be used. Next, we can use the commands `scons --target=mdk4` and `scons --target=iar` respectively to update the MDK4 and IAR projects so that the BSP becomes a complete BSP that can be submitted to GitHub (Making MDK4 project is optional).
|
||||
|
||||
|
@ -243,3 +243,4 @@ The specifications of making STM32 BSP are mainly divided into three aspects: en
|
|||
- When submitting libraries of different series of STM32, please refer to the HAL libraries of f1/f4 series and delete redundant library files.
|
||||
- Compile and test the BSP before submission to ensure that it compiles properly under different compilers.
|
||||
- Perform functional tests on the BSP before submission to ensure that the BSP meets the requirements in the engineering configuration chapter before submission.
|
||||
|
||||
|
|
After Width: | Height: | Size: 122 KiB |
After Width: | Height: | Size: 102 KiB |
After Width: | Height: | Size: 78 KiB |
After Width: | Height: | Size: 94 KiB |
After Width: | Height: | Size: 19 KiB |
After Width: | Height: | Size: 214 KiB |
After Width: | Height: | Size: 69 KiB |
After Width: | Height: | Size: 29 KiB |
After Width: | Height: | Size: 146 KiB |
After Width: | Height: | Size: 119 KiB |
After Width: | Height: | Size: 133 KiB |
After Width: | Height: | Size: 106 KiB |
After Width: | Height: | Size: 169 KiB |
After Width: | Height: | Size: 227 KiB |
After Width: | Height: | Size: 204 KiB |
After Width: | Height: | Size: 43 KiB |
After Width: | Height: | Size: 87 KiB |
After Width: | Height: | Size: 77 KiB |
After Width: | Height: | Size: 26 KiB |
After Width: | Height: | Size: 34 KiB |
After Width: | Height: | Size: 29 KiB |
After Width: | Height: | Size: 35 KiB |
After Width: | Height: | Size: 31 KiB |
After Width: | Height: | Size: 36 KiB |
After Width: | Height: | Size: 16 KiB |
After Width: | Height: | Size: 137 KiB |
After Width: | Height: | Size: 20 KiB |
After Width: | Height: | Size: 31 KiB |
After Width: | Height: | Size: 52 KiB |
After Width: | Height: | Size: 49 KiB |
After Width: | Height: | Size: 13 KiB |
After Width: | Height: | Size: 42 KiB |
After Width: | Height: | Size: 26 KiB |
After Width: | Height: | Size: 11 KiB |
After Width: | Height: | Size: 28 KiB |
After Width: | Height: | Size: 98 KiB |
After Width: | Height: | Size: 27 KiB |
After Width: | Height: | Size: 91 KiB |
After Width: | Height: | Size: 14 KiB |
After Width: | Height: | Size: 20 KiB |
After Width: | Height: | Size: 8.8 KiB |
After Width: | Height: | Size: 44 KiB |
After Width: | Height: | Size: 15 KiB |
After Width: | Height: | Size: 110 KiB |
After Width: | Height: | Size: 45 KiB |
After Width: | Height: | Size: 68 KiB |
After Width: | Height: | Size: 82 KiB |
After Width: | Height: | Size: 148 KiB |
After Width: | Height: | Size: 148 KiB |
After Width: | Height: | Size: 95 KiB |
After Width: | Height: | Size: 115 KiB |
After Width: | Height: | Size: 20 KiB |
After Width: | Height: | Size: 25 KiB |
After Width: | Height: | Size: 16 KiB |
After Width: | Height: | Size: 30 KiB |
After Width: | Height: | Size: 16 KiB |
After Width: | Height: | Size: 81 KiB |
After Width: | Height: | Size: 25 KiB |
After Width: | Height: | Size: 39 KiB |
After Width: | Height: | Size: 43 KiB |
After Width: | Height: | Size: 42 KiB |
After Width: | Height: | Size: 113 KiB |
After Width: | Height: | Size: 64 KiB |
After Width: | Height: | Size: 55 KiB |
After Width: | Height: | Size: 43 KiB |
After Width: | Height: | Size: 54 KiB |
After Width: | Height: | Size: 22 KiB |
After Width: | Height: | Size: 205 KiB |