Skip to content

Commit 367641a

Browse files
committed
feat(wb0): add new STM32CubeProgrammer options
STM32WB0x series have a flash base address of 0x10040000, while other series have 0x8000000. This means that the STM32CubeProgrammer requires a different set of options to flash the board. Moreover, by default the start address is 0x10040000, which makes it begin execution directly in user flash. This skips the bootloader code which performs some bookkeeping (notably, updating RAM_VR.ResetReason). As a result, RAM_VR.ResetReason and RCC->CSR will hold invalid values until PORRESET, or two regular RESET cycles occur (only 1 for RCC->CSR). So, force board to begin execution in bootloader (0x10000000) after flashing via STM32CubeProgrammer to ensure proper system behavior at all times. Signed-off-by: Frederic Pillon <[email protected]>
1 parent 094710a commit 367641a

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

boards.txt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -920,6 +920,9 @@ Nucleo_64.menu.pnum.NUCLEO_WB09KE.build.variant=STM32WB0x/WB05KZV_WB05TZF_WB09KE
920920
Nucleo_64.menu.pnum.NUCLEO_WB09KE.build.st_extra_flags=-D{build.product_line} {build.xSerial} -D__CORTEX_SC=0
921921
Nucleo_64.menu.pnum.NUCLEO_WB09KE.openocd.target=stm32wb0x
922922
Nucleo_64.menu.pnum.NUCLEO_WB09KE.debug.svd_file={runtime.tools.STM32_SVD.path}/svd/STM32WB0x/STM32WB09.svd
923+
Nucleo_64.menu.pnum.NUCLEO_WB09KE.upload.address=0x10040000
924+
Nucleo_64.menu.pnum.NUCLEO_WB09KE.upload.mode=hwRstPulse
925+
Nucleo_64.menu.pnum.NUCLEO_WB09KE.upload.start=0x10000000
923926

924927
# NUCLEO_WB15CC
925928
Nucleo_64.menu.pnum.NUCLEO_WB15CC=Nucleo WB15CC
@@ -1002,7 +1005,7 @@ Nucleo_64.menu.upload_method.MassStorage.upload.tool=massStorageCopy
10021005

10031006
Nucleo_64.menu.upload_method.swdMethod=STM32CubeProgrammer (SWD)
10041007
Nucleo_64.menu.upload_method.swdMethod.upload.protocol=swd
1005-
Nucleo_64.menu.upload_method.swdMethod.upload.options=
1008+
Nucleo_64.menu.upload_method.swdMethod.upload.options=-a {upload.address} -m {upload.mode} -s {upload.start}
10061009
Nucleo_64.menu.upload_method.swdMethod.upload.tool=stm32CubeProg
10071010

10081011
Nucleo_64.menu.upload_method.jlinkMethod=STM32CubeProgrammer (J-Link)
@@ -13124,6 +13127,9 @@ GenWB0.build.flash_offset=0x0
1312413127
GenWB0.upload.maximum_size=0
1312513128
GenWB0.upload.maximum_data_size=0
1312613129
GenWB0.openocd.target=stm32wb0x
13130+
GenWB0.upload.address=0x10040000
13131+
GenWB0.upload.mode=hwRstPulse
13132+
GenWB0.upload.start=0x10000000
1312713133

1312813134
# Generic WB05KZVx
1312913135
GenWB0.menu.pnum.GENERIC_WB05KZVX=Generic WB05KZVx
@@ -13164,7 +13170,7 @@ GenWB0.menu.pnum.GENERIC_WB09TEFX.debug.svd_file={runtime.tools.STM32_SVD.path}/
1316413170
# Upload menu
1316513171
GenWB0.menu.upload_method.swdMethod=STM32CubeProgrammer (SWD)
1316613172
GenWB0.menu.upload_method.swdMethod.upload.protocol=swd
13167-
GenWB0.menu.upload_method.swdMethod.upload.options=
13173+
GenWB0.menu.upload_method.swdMethod.upload.options=-a {upload.address} -m {upload.mode} -s {upload.start}
1316813174
GenWB0.menu.upload_method.swdMethod.upload.tool=stm32CubeProg
1316913175

1317013176
GenWB0.menu.upload_method.jlinkMethod=STM32CubeProgrammer (J-Link)

platform.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,9 @@ upload.vid.0=0x0483
117117
upload.pid.0=0xdf11
118118
upload.vid={upload.vid.0}
119119
upload.pid={upload.pid.0}
120+
upload.address=0x8000000
121+
upload.mode=UR
122+
upload.start=0x8000000
120123

121124
# To customize the USB manufacturer or product string, must add defines
122125
# for them, e.g.:

0 commit comments

Comments
 (0)