Skip to content

boards/common/stm32: make stm32wl.cfg version agnostic#21873

Merged
crasbe merged 2 commits intoRIOT-OS:masterfrom
crasbe:pr/stm32wl_openocd_cfg
Nov 12, 2025
Merged

boards/common/stm32: make stm32wl.cfg version agnostic#21873
crasbe merged 2 commits intoRIOT-OS:masterfrom
crasbe:pr/stm32wl_openocd_cfg

Conversation

@crasbe
Copy link
Copy Markdown
Contributor

@crasbe crasbe commented Nov 11, 2025

Contribution description

In OpenOCD v0.12.0 the default _TARGETNAME variable got removed for the STM32WL55 because the WL55 has two cores and therefore doesn't/shouldn't have a default CPU.

This however caused a breaking change between OpenOCD 0.11.0 that defined this (and did not know about $_CHIPNAME.cpu0) and OpenOCD 0.12.0 that did not define it.

Therefore, as a fallback, we define _TARGETNAME ourselves if it is not defined already.

Testing procedure

Flashing a Nucleo-WL55JC with OpenOCD v0.11.0:

cbuec@W11nMate:~/RIOTstuff/riot-guides/RIOT$ BOARD=nucleo-wl55jc OPENOCD=/usr/bin/openocd make -C examples/basic/hello-w
orld flash -j
make: Entering directory '/home/cbuec/RIOTstuff/riot-guides/RIOT/examples/basic/hello-world'
Building application "hello-world" for "nucleo-wl55jc" with CPU "stm32".

"make" -C /home/cbuec/RIOTstuff/riot-guides/RIOT/pkg/cmsis/
...
"make" -C /home/cbuec/RIOTstuff/riot-guides/RIOT/cpu/cortexm_common/periph
   text    data     bss     dec     hex filename
   8288       8    2292   10588    295c /home/cbuec/RIOTstuff/riot-guides/RIOT/examples/basic/hello-world/bin/nucleo-wl55jc/hello-world.elf
/home/cbuec/RIOTstuff/riot-guides/RIOT/dist/tools/openocd/openocd.sh flash /home/cbuec/RIOTstuff/riot-guides/RIOT/examples/basic/hello-world/bin/nucleo-wl55jc/hello-world.elf
### Flashing Target ###
Open On-Chip Debugger 0.11.0
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
hla_swd
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
srst_only separate srst_nogate srst_open_drain connect_assert_srst

Info : clock speed 500 kHz
Info : STLINK V3J15M7 (API v3) VID:PID 0483:374E
Info : Target voltage: 3.259416
Info : stm32wlx.cpu: hardware has 6 breakpoints, 4 watchpoints
Info : starting gdb server for stm32wlx.cpu on 0
Info : Listening on port 40043 for gdb connections
    TargetName         Type       Endian TapName            State
--  ------------------ ---------- ------ ------------------ ------------
 0* stm32wlx.cpu       hla_target little stm32wlx.cpu       reset

Info : Unable to match requested speed 500 kHz, using 200 kHz
Info : Unable to match requested speed 500 kHz, using 200 kHz
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x08000780 msp: 0x20000200
Info : device idcode = 0x10036497 (STM32WLEx - Rev 'unknown' : 0x1003)
Info : flash size = 256kbytes
Info : flash mode : single-bank
Warn : Adding extra erase range, 0x08002068 .. 0x080027ff
auto erase enabled
wrote 8296 bytes from file /home/cbuec/RIOTstuff/riot-guides/RIOT/examples/basic/hello-world/bin/nucleo-wl55jc/hello-world.elf in 0.668580s (12.118 KiB/s)

verified 8296 bytes in 0.442437s (18.311 KiB/s)

Info : Unable to match requested speed 500 kHz, using 200 kHz
Info : Unable to match requested speed 500 kHz, using 200 kHz
shutdown command invoked
Done flashing
make: Leaving directory '/home/cbuec/RIOTstuff/riot-guides/RIOT/examples/basic/hello-world'

Flashing a Nucleo-WL55JC with OpenOCD v0.12.0 Release:

cbuec@W11nMate:~/RIOTstuff/riot-guides/RIOT$ BOARD=nucleo-wl55jc OPENOCD=/usr/local/bin/openocd make -C examples/basic/hello-world flash-only
make: Entering directory '/home/cbuec/RIOTstuff/riot-guides/RIOT/examples/basic/hello-world'
/home/cbuec/RIOTstuff/riot-guides/RIOT/dist/tools/openocd/openocd.sh flash /home/cbuec/RIOTstuff/riot-guides/RIOT/examples/basic/hello-world/bin/nucleo-wl55jc/hello-world.elf
### Flashing Target ###
Open On-Chip Debugger 0.12.0-01004-g9ea7f3d64 (2025-11-11-14:41)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
hla_swd
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
srst_only separate srst_nogate srst_open_drain connect_assert_srst

Info : clock speed 500 kHz
Info : STLINK V3J15M7 (API v3) VID:PID 0483:374E
Info : Target voltage: 3.261008
Info : [stm32wlx.cpu0] Cortex-M4 r0p1 processor detected
Info : [stm32wlx.cpu0] target has 6 breakpoints, 4 watchpoints
Info : starting gdb server for stm32wlx.cpu0 on 0
Info : Listening on port 34559 for gdb connections
    TargetName         Type       Endian TapName            State
--  ------------------ ---------- ------ ------------------ ------------
 0* stm32wlx.cpu0      hla_target little stm32wlx.cpu       reset

Info : Unable to match requested speed 500 kHz, using 200 kHz
Info : Unable to match requested speed 500 kHz, using 200 kHz
[stm32wlx.cpu0] halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x08000758 msp: 0x20000200
Info : device idcode = 0x10036497 (STM32WLE/WL5x - Rev 'unknown' : 0x1003)
Info : RDP level 0 (0xAA)
Info : flash size = 256 KiB
Info : flash mode : single-bank
Warn : Adding extra erase range, 0x08002068 .. 0x080027ff
auto erase enabled
wrote 8296 bytes from file /home/cbuec/RIOTstuff/riot-guides/RIOT/examples/basic/hello-world/bin/nucleo-wl55jc/hello-world.elf in 0.670485s (12.083 KiB/s)

verified 8296 bytes in 0.464198s (17.453 KiB/s)

Info : Unable to match requested speed 500 kHz, using 200 kHz
Info : Unable to match requested speed 500 kHz, using 200 kHz
shutdown command invoked
Done flashing
make: Leaving directory '/home/cbuec/RIOTstuff/riot-guides/RIOT/examples/basic/hello-world'

Flashing a Nucleo-WL55JC with OpenOCD v0.12.0 upstream (and #21871 applied):

cbuec@W11nMate:~/RIOTstuff/riot-guides/RIOT$ BOARD=nucleo-wl55jc OPENOCD=/usr/local/bin/openocd make -C examples/basic/hello-world flash-only
make: Entering directory '/home/cbuec/RIOTstuff/riot-guides/RIOT/examples/basic/hello-world'
/home/cbuec/RIOTstuff/riot-guides/RIOT/dist/tools/openocd/openocd.sh flash /home/cbuec/RIOTstuff/riot-guides/RIOT/examples/basic/hello-world/bin/nucleo-wl55jc/hello-world.elf
### Flashing Target ###
Open On-Chip Debugger 0.12.0+dev-02261-gab22b0bf8-dirty (2025-11-11-13:27)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
Warn : DEPRECATED: auto-selecting transport "swd (dapdirect)". Use 'transport select swd' to suppress this message.
swd (dapdirect)
srst_only separate srst_nogate srst_open_drain connect_assert_srst
DEPRECATED! use 'tcl port' not 'tcl_port'
DEPRECATED! use 'telnet port', not 'telnet_port'
DEPRECATED! use 'gdb port', not 'gdb_port'
Info : STLINK V3J15M7 (API v3) VID:PID 0483:374E
Info : Target voltage: 3.261008
Info : Unable to match requested speed 500 kHz, using 200 kHz
Info : Unable to match requested speed 500 kHz, using 200 kHz
Info : clock speed 200 kHz
Info : SWD DPIDR 0x6ba02477
Info : [stm32wlx.cpu0] Cortex-M4 r0p1 processor detected
Info : [stm32wlx.cpu0] target has 6 breakpoints, 4 watchpoints
Info : [stm32wlx.cpu0] Examination succeed
Info : [stm32wlx.cpu0] starting gdb server on 0
Info : Listening on port 36761 for gdb connections
    TargetName         Type       Endian TapName            State
--  ------------------ ---------- ------ ------------------ ------------
 0* stm32wlx.cpu0      cortex_m   little stm32wlx.cpu       unknown
Info : Unable to match requested speed 500 kHz, using 200 kHz
Info : Unable to match requested speed 500 kHz, using 200 kHz
[stm32wlx.cpu0] halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x08000758 msp: 0x20000200
Info : device idcode = 0x10036497 (STM32WLE/WL5x - Rev 'unknown' : 0x1003)
Info : RDP level 0 (0xAA)
Info : flash size = 256 KiB
Info : flash mode : single-bank
Warn : Adding extra erase range, 0x08002068 .. 0x080027ff
auto erase enabled
wrote 8296 bytes from file /home/cbuec/RIOTstuff/riot-guides/RIOT/examples/basic/hello-world/bin/nucleo-wl55jc/hello-world.elf in 0.691818s (11.711 KiB/s)
verified 8296 bytes in 0.440535s (18.390 KiB/s)
Info : Unable to match requested speed 500 kHz, using 200 kHz
Info : Unable to match requested speed 500 kHz, using 200 kHz
shutdown command invoked
Done flashing
make: Leaving directory '/home/cbuec/RIOTstuff/riot-guides/RIOT/examples/basic/hello-world'

Issues/PRs references

Replaces #21615, fixes #21614.

@crasbe crasbe requested a review from maribu November 11, 2025 14:27
@crasbe crasbe requested a review from aabadie as a code owner November 11, 2025 14:27
@crasbe crasbe added Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors) CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR CI: skip compile test If set, CI server will run only non-compile jobs, but no compile jobs or their dependent jobs labels Nov 11, 2025
@github-actions github-actions bot added the Area: boards Area: Board ports label Nov 11, 2025
@crasbe
Copy link
Copy Markdown
Contributor Author

crasbe commented Nov 11, 2025

Ping @baptleduc: Perhaps you can give this a test with the Lora-E5-Dev board? :)

@crasbe crasbe enabled auto-merge November 11, 2025 14:33
@riot-ci
Copy link
Copy Markdown

riot-ci commented Nov 11, 2025

Murdock results

✔️ PASSED

c5b5af9 boards/lora-e5-dev: make OpenOCD config version agnostic

Success Failures Total Runtime
1 0 1 01m:18s

Artifacts

@crasbe crasbe added this pull request to the merge queue Nov 11, 2025
Merged via the queue into RIOT-OS:master with commit 41fb5a1 Nov 12, 2025
29 checks passed
@leandrolanzieri leandrolanzieri added this to the Release 2026.01 milestone Jan 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: boards Area: Board ports CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR CI: skip compile test If set, CI server will run only non-compile jobs, but no compile jobs or their dependent jobs Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Missing _TARGETNAME variable in stm32wlx target config causes flash failure

4 participants