|
@@ -100,10 +100,18 @@ Configure the system clock, peripheral pins, etc. The steps are shown in the fig
|
|
|
|
|
|
#### 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:
|
|
|
+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. The content of this function is as follows:
|
|
|
|
|
|

|
|
|
|
|
|
+If your MCU clock tree is relatively advanced and you have configured peripherals to use PLL2, PLL3, or other non-default settings, resulting in the generation of the `PeriphCommonClock_Config()` function, please copy it as well. Since `rt-thread` does not explicitly call this function, you can manually add a call to it within `SystemClock_Config()`. The function content may look like the following:
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+If your MCU includes an MPU peripheral and you do not want to use the `Memory Protection` provided by `rt-thread`, but instead prefer the configuration generated by `CubeMX`, you can copy `MPU_Config()`. Similarly, since `rt-thread` does not explicitly call this function, you can use `INIT_BOARD_EXPORT` or other methods to ensure it is called automatically. The function content may look like the following (it is recommended to configure it carefully in sections for actual use):
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
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:
|
|
|
|
|
|

|