You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: bsp/stm32/docs/How to make a STM32 BSP for RT-Thread.md
+29-5Lines changed: 29 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -166,11 +166,32 @@ The other two link script files are link.icf used by IAR and link.lds used by th
166
166
167
167
The **SConscript** script determines the files to be added during the generation and compilation of the MDK/IAR project.
168
168
169
-
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:
169
+
In this step, you need to modify the chip model and the address of the chip startup file. There are two SConscript files in the BSP directory, and only the one in the root directory needs to be modified, as shown below:
170
170
171
-

171
+
```diff
172
+
# for module compiling
173
+
import os
174
+
Import('RTT_ROOT')
175
+
Import('env')
176
+
from building import *
172
177
173
-
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.
178
+
cwd = GetCurrentDir()
179
+
objs = []
180
+
list = os.listdir(cwd)
181
+
182
+
- # The following macro definition statement exists in the template before modification:
183
+
- env.Append(CPPDEFINES = ['STM32H723xx'])# Target chip macro definition, hal library will use this macro definition for judgment
184
+
+ # Modify the macro definition to the corresponding chip model. For example, for STM32F103xB, the modified content is as follows:
185
+
+ env.Append(CPPDEFINES = ['STM32F103xB'])
186
+
for d in list:
187
+
path = os.path.join(cwd, d)
188
+
if os.path.isfile(os.path.join(path, 'SConscript')):
Note: Due to the BSP weight loss plan, the templates in the template directory are outdated, and the SConscript file may be different from the example. Please refer to the actual BSP or wait for an update.
174
195
175
196
#### 3.4.3 Modify the project template
176
197
@@ -190,6 +211,10 @@ Modify the program download method:
190
211
191
212
Env tool is required to regenerate the project.
192
213
214
+
Before regenerating the project, you must execute the `pkgs --update` command in the Env tool.
215
+
216
+
This command will automatically pull the corresponding HAL library package according to the Kconfig configuration, which is the key to subsequent compilation success.
217
+
193
218
#### 3.5.1 Regenerate the rtconfig.h file
194
219
195
220
Enter the command menuconfig in the Env interface to configure the project and generate a new rtconfig.h file. As shown below:
@@ -255,5 +280,4 @@ The specifications of making STM32 BSP are mainly divided into three aspects: en
255
280
- Only submit documents necessary for the BSP and delete irrelevant intermediate documents. Please check other BSPs for documents that can be submitted.
256
281
- When submitting libraries of different series of STM32, please refer to the HAL libraries of f1/f4 series and delete redundant library files.
257
282
- Compile and test the BSP before submission to ensure that it compiles properly under different compilers.
258
-
- Perform functional tests on the BSP before submission to ensure that the BSP meets the requirements in the engineering configuration chapter before submission.
259
-
283
+
- Perform functional tests on the BSP before submission to ensure that the BSP meets the requirements in the engineering configuration chapter before submission.
0 commit comments