Skip to content

Commit 8d7f68d

Browse files
committed
Update Templates
- make board agnostic - sync to CMSIS-Toolbox_2.13.0 - unify Readme - pack version update
1 parent ab92a7a commit 8d7f68d

8 files changed

Lines changed: 474 additions & 442 deletions

File tree

Keil.STM32N6xx_DFP.pdsc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
</licenseSets>
1414

1515
<releases>
16-
<release version="1.1.1-dev">
16+
<release version="1.2.0-dev">
1717
Active development ...
1818
</release>
1919
</releases>

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,4 +58,3 @@ to report misbehavior (i.e. bugs) or start discussions about enhancements. This
5858
is your best way to interact directly with the maintenance team and the community.
5959
We encourage you to append implementation suggestions as this helps to decrease the
6060
workload of the maintenance team.
61-

Templates/FSBL/CubeMX.csolution.yml

Lines changed: 10 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,28 @@
11
# A solution is a collection of related projects that share same base configuration.
22
solution:
3-
created-for: CMSIS-Toolbox@2.12.0
3+
created-for: CMSIS-Toolbox@2.13.0
44
cdefault:
55

66
# List of tested compilers that can be selected
77
select-compiler:
88
- compiler: AC6
99

10+
# Miscellaneous toolchain controls directly passed to the tools
11+
misc:
12+
- for-compiler: AC6 # change to -gdwarf-4 for debugging using uVision
13+
C-CPP:
14+
- -gdwarf-5
15+
ASM:
16+
- -gdwarf-5
17+
1018
# List the packs that define the device and/or board.
1119
packs:
1220
- pack: Keil::STM32N6xx_DFP
1321
- pack: ARM::CMSIS
14-
- pack: Keil::STM32N6570-DK_BSP
1522

1623
# List different hardware targets that are used to deploy the solution.
1724
target-types:
18-
- type: STM32N657X0HxQ
19-
target-set:
20-
- set: ExtMemLoader
21-
images:
22-
- project-context: ExtMemLoader.Debug
23-
- set: FSBL
24-
images:
25-
- project-context: FSBL.Debug
26-
load: symbols
27-
- image: $OutDir()$/FSBL-trusted.bin
28-
load-offset: 0x70000000
29-
load: image
30-
debugger:
31-
name: ST-Link@pyOCD
32-
clock: 4000000
33-
protocol: swd
34-
device: STM32N657X0HxQ
35-
board: STM32N6570-DK:Rev.C
36-
memory:
37-
- name: Ext-Flash
38-
access: rx
39-
start: 0x70000000
40-
size: 0x100000
41-
algorithm: ExtMemLoader.axf
25+
- type: STM32N6
4226

4327
# List of different build configurations.
4428
build-types:

Templates/FSBL/README.md

Lines changed: 123 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
# FSBL Template for STM32N6 series
33

4-
The [first stage bootloader (FSBL)](https://community.st.com/t5/stm32-mcus/stm32n6-fsbl-explained/ta-p/764307) is a key component in the boot process of STM32N6 microcontrollers. It is responsible for initializing the system, configuring the hardware, and loading the application code from external memory into the internal or external memories for execution.
4+
The [first stage bootloader (FSBL)](https://community.st.com/t5/stm32-mcus/stm32n6-fsbl-explained/ta-p/764307) is a key component in the boot process of STM32N6 microcontrollers. It is responsible for initializing the system, configuring the hardware, and loading the application code from external memory into the internal or external memories for execution.
55

66
This FSBL *csolution template project* can be used to build 512KB basic firmware application (`FSBL.cproject.yml`) that executes in internal RAM (Application as part of the FSBL).
77
The `ExtMemLoader.cproject.yml` implements a *flash algorithm* that generates a binary library capable of programming an application into external memory.
@@ -10,18 +10,18 @@ The `ExtMemLoader.cproject.yml` implements a *flash algorithm* that generates a
1010

1111
The bootROM copies FSBL image (512KB) from external Flash (Octo SPI Flash Memory) to the internal RAM (AXI SRAM2) and starts executing it, blinking a LED in an infinite loop with a 0.5 second period.
1212

13-
## Steps to Create, Build, Load and Debug using the Basic Template csolution project
13+
## Steps to Create, Build, Load and Debug using the FSBL Template csolution project
1414

15-
> **Prerequisites:**
15+
> **Prerequisites**
1616
>
17-
>- **Required Packs:**
18-
> - [Keil.STM32N6xx_DFP 1.1.1](https://github.com/Open-CMSIS-Pack/STM32N6xx_DFP) or higher
17+
>- **Required Packs**
18+
> - [Keil.STM32N6xx_DFP 1.2.0](https://github.com/Open-CMSIS-Pack/STM32N6xx_DFP) or higher
1919
> - Board specific pack
2020
> > STM32N6570-DK board: [Keil.STM32N6570-DK_BSP](https://github.com/Open-CMSIS-Pack/STM32N6570-DK_BSP)
21-
>- **Required CMSIS Tools and Extensions:**
21+
>- **Required CMSIS Tools and Extensions**
2222
> - Arm CMSIS Solution 1.64.2
2323
> - Arm CMSIS Debugger 1.3.0
24-
>- **Required ST tools and Firmware Package:**
24+
>- **Required ST tools and Firmware Package**
2525
> - [STM32CubeMX 6.16.1](https://www.st.com/en/development-tools/stm32cubemx.html)
2626
> - [STM32Cube_FW_N6 1.3.0](https://www.st.com/en/embedded-software/stm32cuben6.html)
2727
> - [STM32CubeProgrammer 2.21.0](https://www.st.com/en/development-tools/stm32cubeprog.html)
@@ -33,112 +33,139 @@ The bootROM copies FSBL image (512KB) from external Flash (Octo SPI Flash Memory
3333

3434
> `target` is Device name or Board name.
3535
36-
- Select `target` and **FSBL** (from DFP) and click **Create**
37-
- Select **AC6** compiler and click **OK**
38-
- Launch STM32CubeMX (CMSIS view → expand Project `target` → expand and locate Device:CubeMX component) and click **Run Configuration Generator**
36+
- Select `target` and `template` **FSBL** (from DFP) and click **Create**
37+
- Launch STM32CubeMX (CMSIS view → expand Project `target` → expand and locate Device:CubeMX component → click **Run Configuration Generator**)
3938

4039
## Configuration in STM32CubeMX
4140

4241
Configure `target` in STM32CubeMX
4342

44-
> [STM32N6570-DK board](https://github.com/Open-CMSIS-Pack/STM32N6570-DK_BSP/blob/main/Examples/FSBL/Configuration.md#configuration-in-stm32cubemx) STM32CubeMX configuration
43+
> STM32CubeMX configuration example for the [STM32N6570-DK board](https://github.com/Open-CMSIS-Pack/STM32N6570-DK_BSP/blob/main/Examples/FSBL/Configuration.md#configuration-in-stm32cubemx)
4544
4645
## Configuration in VSCode
4746

48-
### FSBL/FSBL.cproject.yml
49-
50-
- #### Add linker script
51-
52-
```yaml
53-
# Linker script definition
54-
linker:
55-
- script: ../STM32CubeMX/<target>/STM32CubeMX/MDK-ARM/FSBL/<target>_axisram2_fsbl.sct
56-
for-compiler: AC6
57-
```
58-
59-
- #### Add post-build command to add header to the generated binary
47+
### *.csolution.yml
48+
49+
- Add `target-set` with `set` and `memory` configuration settings
50+
51+
```yaml
52+
target-types:
53+
- type: STM32N6
54+
target-set:
55+
- set: ExtMemLoader
56+
images:
57+
- project-context: ExtMemLoader.Debug
58+
- set: FSBL
59+
images:
60+
- project-context: FSBL.Debug
61+
load: symbols
62+
- image: $OutDir()$/FSBL-trusted.bin
63+
load-offset: 0x70000000
64+
load: image
65+
debugger:
66+
name: ST-Link@pyOCD
67+
clock: 4000000
68+
protocol: swd
69+
memory:
70+
- name: Ext-Flash
71+
access: rx
72+
start: 0x70000000
73+
size: 0x00100000
74+
algorithm: ExtMemLoader.axf
75+
```
6076
61-
```yaml
62-
# Post-build commands to add header
63-
executes:
64-
- execute: Generate_trusted_bin
65-
run: $ENV{STM32_PRG_PATH}/STM32_SigningTool_CLI.exe -bin $input$ -s -nk -of 0x80000000 -align -t fsbl -o $output$ -hv 2.3
66-
input:
67-
- $bin()$
68-
output:
69-
- $OutDir()$/FSBL-trusted.bin
70-
```
71-
72-
> The OTP configuration for flash source selection is configurable via fuses in BOOTROM_CONFIG_2[8:5], OTP_WORD11 using **STM32CubeProgrammer**. Requires the **default** boot configuration to have sNOR device attached boot. For more information, please check [UM3234](https://www.st.com/resource/en/user_manual/um3234-how-to-proceed-with-boot-rom-on-stm32n6-mcus-stmicroelectronics.pdf).
77+
### FSBL/FSBL.cproject.yml
7378
79+
- Add linker script
80+
81+
```yaml
82+
# Linker script definition
83+
linker:
84+
- script: ../STM32CubeMX/<target>/STM32CubeMX/MDK-ARM/FSBL/<target>_axisram2_fsbl.sct
85+
for-compiler: AC6
86+
```
87+
88+
- Add post-build command to add header to the generated binary
89+
90+
```yaml
91+
# Post-build command to add header
92+
executes:
93+
- execute: Generate_trusted_bin
94+
run: $ENV{STM32_PRG_PATH}/STM32_SigningTool_CLI.exe -bin $input$ -s -nk -of 0x80000000 -align -t fsbl -o $output$ -hv 2.3
95+
input:
96+
- $bin()$
97+
output:
98+
- $OutDir()$/FSBL-trusted.bin
99+
```
100+
101+
> The OTP configuration for flash source selection is configurable via fuses in BOOTROM_CONFIG_2[8:5], OTP_WORD11 using **STM32CubeProgrammer**. Requires the **default** boot configuration to have sNOR device attached boot. For more information, please check [UM3234](https://www.st.com/resource/en/user_manual/um3234-how-to-proceed-with-boot-rom-on-stm32n6-mcus-stmicroelectronics.pdf).
102+
74103
### STM32CubeMX/`target`/FSBL.cgen.yml
75104

76-
- #### Comment redundant files
77-
78-
```yaml
79-
# - file: ./STM32CubeMX/Middlewares/ST/STM32_ExtMem_Manager/stm32_extmem.c
80-
# - file: ./STM32CubeMX/Middlewares/ST/STM32_ExtMem_Manager/sal/stm32_sal_xspi.c
81-
# - file: ./STM32CubeMX/Middlewares/ST/STM32_ExtMem_Manager/sal/stm32_sal_sd.c
82-
# - file: ./STM32CubeMX/Middlewares/ST/STM32_ExtMem_Manager/nor_sfdp/stm32_sfdp_data.c
83-
# - file: ./STM32CubeMX/Middlewares/ST/STM32_ExtMem_Manager/nor_sfdp/stm32_sfdp_driver.c
84-
# - file: ./STM32CubeMX/Middlewares/ST/STM32_ExtMem_Manager/psram/stm32_psram_driver.c
85-
# - file: ./STM32CubeMX/Middlewares/ST/STM32_ExtMem_Manager/sdcard/stm32_sdcard_driver.c
86-
# - file: ./STM32CubeMX/Middlewares/ST/STM32_ExtMem_Manager/user/stm32_user_driver.c
87-
# - file: ./STM32CubeMX/Middlewares/ST/STM32_ExtMem_Loader/core/memory_wrapper.c
88-
# - file: ./STM32CubeMX/Middlewares/ST/STM32_ExtMem_Loader/core/systick_management.c
89-
# - file: ./STM32CubeMX/Middlewares/ST/STM32_ExtMem_Loader/MDK-ARM/FlashDev.c
90-
# - file: ./STM32CubeMX/Middlewares/ST/STM32_ExtMem_Loader/MDK-ARM/FlashPrg.c
91-
# - file: ./STM32CubeMX/Middlewares/ST/STM32_ExtMem_Loader/STM32Cube/stm32_device_info.c
92-
# - file: ./STM32CubeMX/Middlewares/ST/STM32_ExtMem_Loader/STM32Cube/stm32_loader_api.c
93-
```
105+
- Comment redundant files
106+
107+
```yaml
108+
# - file: ./STM32CubeMX/Middlewares/ST/STM32_ExtMem_Manager/stm32_extmem.c
109+
# - file: ./STM32CubeMX/Middlewares/ST/STM32_ExtMem_Manager/sal/stm32_sal_xspi.c
110+
# - file: ./STM32CubeMX/Middlewares/ST/STM32_ExtMem_Manager/sal/stm32_sal_sd.c
111+
# - file: ./STM32CubeMX/Middlewares/ST/STM32_ExtMem_Manager/nor_sfdp/stm32_sfdp_data.c
112+
# - file: ./STM32CubeMX/Middlewares/ST/STM32_ExtMem_Manager/nor_sfdp/stm32_sfdp_driver.c
113+
# - file: ./STM32CubeMX/Middlewares/ST/STM32_ExtMem_Manager/psram/stm32_psram_driver.c
114+
# - file: ./STM32CubeMX/Middlewares/ST/STM32_ExtMem_Manager/sdcard/stm32_sdcard_driver.c
115+
# - file: ./STM32CubeMX/Middlewares/ST/STM32_ExtMem_Manager/user/stm32_user_driver.c
116+
# - file: ./STM32CubeMX/Middlewares/ST/STM32_ExtMem_Loader/core/memory_wrapper.c
117+
# - file: ./STM32CubeMX/Middlewares/ST/STM32_ExtMem_Loader/core/systick_management.c
118+
# - file: ./STM32CubeMX/Middlewares/ST/STM32_ExtMem_Loader/MDK-ARM/FlashDev.c
119+
# - file: ./STM32CubeMX/Middlewares/ST/STM32_ExtMem_Loader/MDK-ARM/FlashPrg.c
120+
# - file: ./STM32CubeMX/Middlewares/ST/STM32_ExtMem_Loader/STM32Cube/stm32_device_info.c
121+
# - file: ./STM32CubeMX/Middlewares/ST/STM32_ExtMem_Loader/STM32Cube/stm32_loader_api.c
122+
```
94123

95124
### STM32CubeMX/`target`/STM32CubeMX/FSBL/Src/main.c
96125

97-
- #### Add code to blink LED
126+
- Add code to blink LED
98127

99-
```c
100-
/* USER CODE BEGIN 3 */
101-
HAL_GPIO_TogglePin(LED_GPIO_Port, LED_Pin);
102-
HAL_Delay(500);
103-
}
104-
/* USER CODE END 3 */
105-
```
128+
```c
129+
/* USER CODE BEGIN 3 */
130+
HAL_GPIO_TogglePin(LED_GPIO_Port, LED_Pin);
131+
HAL_Delay(500);
132+
}
133+
/* USER CODE END 3 */
134+
```
106135

107136
### ExtMemLoader/ExtMemLoader.cproject.yml
108137

109-
- #### Modify TrustZone mode from secure to "off"
110-
111-
- #### Add linker script
138+
- Add linker script
112139

113-
```yaml
114-
# Linker script definition
115-
linker:
116-
- script: ../STM32CubeMX/<target>/STM32CubeMX/MDK-ARM/ExtMemLoader/stm32n6xx_extmemloader_mdkarm.sct
117-
for-compiler: AC6
118-
```
140+
```yaml
141+
# Linker script definition
142+
linker:
143+
- script: ../STM32CubeMX/<target>/STM32CubeMX/MDK-ARM/ExtMemLoader/stm32n6xx_extmemloader_mdkarm.sct
144+
for-compiler: AC6
145+
```
119146

120-
- #### Add post build commands to move ExtMemLoader.axf to root
147+
- Add post build command to move ExtMemLoader.axf to root
121148

122-
```yaml
123-
# Post-build commands
124-
executes:
125-
- execute: Copy_ExtMemLoader_to_root
126-
run: ${CMAKE_COMMAND} -E copy $input$ $output$
127-
input:
128-
- ../out/ExtMemLoader/<target>/Debug/ExtMemLoader.axf
129-
output:
130-
- ../ExtMemLoader.axf
131-
```
149+
```yaml
150+
# Post-build command
151+
executes:
152+
- execute: Copy_ExtMemLoader_to_root
153+
run: ${CMAKE_COMMAND} -E copy $input$ $output$
154+
input:
155+
- ../out/ExtMemLoader/<target>/<build-type>/ExtMemLoader.axf
156+
output:
157+
- ../ExtMemLoader.axf
158+
```
132159

133160
### STM32CubeMX/`target`/ExtMemLoader.cgen.yml
134161

135-
- #### Comment redundant file
162+
- Comment redundant file
136163

137-
```yaml
138-
# - file: ./STM32CubeMX/MDK-ARM/startup_<target>_fsbl.c
139-
```
164+
```yaml
165+
# - file: ./STM32CubeMX/MDK-ARM/startup_<target>_fsbl.c
166+
```
140167

141-
> [STM32N6570-DK board](https://github.com/Open-CMSIS-Pack/STM32N6570-DK_BSP/blob/main/Examples/FSBL/Configuration.md#configuration-in-vscode) VSCode configuration
168+
> STM32CubeMX configuration example for the [STM32N6570-DK board](https://github.com/Open-CMSIS-Pack/STM32N6570-DK_BSP/blob/main/Examples/FSBL/Configuration.md#configuration-in-vscode)
142169

143170
## Build and Load in VSCode
144171

@@ -152,23 +179,23 @@ Configure `target` in STM32CubeMX
152179

153180
### Load application to target
154181

155-
- Set the boot mode configuration in **development mode** and reset board after each power on cycle
156-
- To flash `target` click **Views and More Actions** and click **Load application to target**
157-
- Set the boot mode configuration in **flash mode** and reset board
158-
- Configured LED should blink (in FSBL/Src/main.c)
182+
- Set the boot mode configuration in **development mode** and reset board after each power on cycle
183+
- To flash `target` click **Views and More Actions** and click **Load application to target**
184+
- Set the boot mode configuration in **flash mode** and reset board
185+
- Configured LED should blink (in FSBL/Src/main.c)
159186

160187
## Debug in VSCode
161188

162-
- To debug application in:
163-
- **FLASH MODE:**
189+
- To debug application in
190+
- **FLASH MODE**
164191
- Set the boot mode configuration in **flash mode** and reset board
165192
> To flash an unprogrammed (virgin) `target`, ensure that the board is in development mode.
166193
- Open `.vscode\launch.json` file and modify configuration named "STLink@pyOCD (launch)" under **initCommands** and **customResetCommands**:
167194
- Modify the command from **tbreak main** to **thbreak main**
168195
- Click **Load & Debug application** button and now program should wait in main function to start debug
169196
- With Continue (F5) button, LED should blink in flash mode
170197

171-
- **DEVELOPMENT MODE:**
198+
- **DEVELOPMENT MODE**
172199
- Set the boot mode configuration in **development mode** and reset board
173200
- Open `.vscode\launch.json` file and modify configuration named "STLink@pyOCD (launch)"
174201
- Comment line
@@ -182,7 +209,7 @@ Configure `target` in STM32CubeMX
182209
```json
183210
"initCommands": [
184211
"monitor reset halt",
185-
"load out/FSBL/<target>/Debug/FSBL.hex",
212+
"load out/FSBL/<target>/<build-type>/FSBL.hex",
186213
"set $pc = Reset_Handler",
187214
"set $sp = (int) &Image$$ARM_LIB_STACK$$ZI$$Limit",
188215
"thbreak main"
@@ -195,7 +222,7 @@ Configure `target` in STM32CubeMX
195222
"monitor reset halt",
196223
"maintenance flush register-cache",
197224
"maintenance flush dcache",
198-
"load out/FSBL/<target>/Debug/FSBL.hex",
225+
"load out/FSBL/<target>/<build-type>/FSBL.hex",
199226
"set $pc = Reset_Handler",
200227
"set $sp = (int) &Image$$ARM_LIB_STACK$$ZI$$Limit",
201228
"thbreak main",
@@ -206,4 +233,4 @@ Configure `target` in STM32CubeMX
206233
- Click **Load & Debug application** button and now program should wait in main function to start debug
207234
- With Continue (F5) button, configured LED should blink in development mode
208235

209-
> [STM32N6570-DK board](https://github.com/Open-CMSIS-Pack/STM32N6570-DK_BSP/blob/main/Examples/FSBL#build-and-load-in-vscode) Build, Load and Debug configuration
236+
> [STM32N6570-DK board](https://github.com/Open-CMSIS-Pack/STM32N6570-DK_BSP/blob/main/Examples/FSBL#build-and-load-in-vscode) Build, Load and Debug configuration

0 commit comments

Comments
 (0)