Skip to content

Conversation

@crasbe
Copy link
Contributor

@crasbe crasbe commented Oct 9, 2025

Contribution description

Unfortunately the PR #20939 that added several new STM32C0 based boards went stale, so I took the liberty to take it over.

The fixup commit changes the copyright notice to the new SPDX format and the headerguards to #pragma once as well as fixing a typo in the KConfig file. The flashing information now points to the guide merged in #21767 (following the scheme from #21337).

For the time being I did not include the STM32C0116-DK and STM32C0316-DK because I have neither of them for testing available.

Testing procedure

I have not tested this yet with real hardware, but that will happen soon.

Issues/PRs references

This is continued from #20939.
Tracking Issue #19264.

@crasbe crasbe added the Type: new feature The issue requests / The PR implemements a new feature for RIOT label Oct 9, 2025
@crasbe crasbe added the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Oct 9, 2025
@crasbe crasbe requested a review from vincent-d as a code owner October 9, 2025 11:53
@crasbe crasbe added the CI: skip compile test If set, CI server will run only non-compile jobs, but no compile jobs or their dependent jobs label Oct 9, 2025
@github-actions github-actions bot added Platform: ARM Platform: This PR/issue effects ARM-based platforms Area: doc Area: Documentation Area: build system Area: Build system Area: boards Area: Board ports Area: cpu Area: CPU/MCU ports Area: Kconfig Area: Kconfig integration labels Oct 9, 2025
@crasbe crasbe added CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR and removed 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 Oct 9, 2025
@crasbe crasbe requested a review from kaspar030 as a code owner October 9, 2025 11:55
@github-actions github-actions bot added the Area: CI Area: Continuous Integration of RIOT components label Oct 9, 2025
@riot-ci
Copy link

riot-ci commented Oct 9, 2025

Murdock results

✔️ PASSED

e0f9f11 cpu/stm32: update STM32C0 CMSIS version

Success Failures Total Runtime
10515 0 10516 33m:13s

Artifacts

@crasbe crasbe added the CI: no fast fail don't abort PR build after first error label Oct 9, 2025
@github-actions github-actions bot added the Area: examples Area: Example Applications label Oct 9, 2025
@github-actions github-actions bot added the Area: tests Area: tests and testing framework label Oct 9, 2025
@crasbe
Copy link
Contributor Author

crasbe commented Oct 9, 2025

Well it's never easy... The latest OpenOCD release (0.12.0) does not support the STM32C071 yet. The latest sourcecode does support it, but the standard programming method hla_swd is deprecated (or rather: it throws an error and says that the adapter does not support it).

cbuec@W11nMate:~/RIOTstuff/riot-nrfvendor/RIOT$ sudo BOARD=nucleo-c071rb OPENOCD=/usr/local/bin/openocd make -C tests/sys/shell flash-only
make: Entering directory '/home/cbuec/RIOTstuff/riot-nrfvendor/RIOT/tests/sys/shell'
/home/cbuec/RIOTstuff/riot-nrfvendor/RIOT/dist/tools/openocd/openocd.sh flash /home/cbuec/RIOTstuff/riot-nrfvendor/RIOT/tests/sys/shell/bin/nucleo-c071rb/tests_shell.elf
### Flashing Target ###
Open On-Chip Debugger 0.12.0+dev-02228-ge5888bda3-dirty (2025-10-09-21:04)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
Debug adapter doesn't support 'hla_swd' transport
make: *** [/home/cbuec/RIOTstuff/riot-nrfvendor/RIOT/tests/sys/shell/../../../Makefile.include:866: flash-only] Error 1
make: Leaving directory '/home/cbuec/RIOTstuff/riot-nrfvendor/RIOT/tests/sys/shell'

I found this comment that daplink_swd should be used instead (https://review.openocd.org/c/openocd/+/8525/2..7/tcl/board/st_nucleo_c0.cfg#b5) but apparently that is also deprecated again and swd should be used.

cbuec@W11nMate:~/RIOTstuff/riot-nrfvendor/RIOT$ sudo BOARD=nucleo-c071rb OPENOCD=/usr/local/bin/openocd make -C tests/sys/shell flash-only
make: Entering directory '/home/cbuec/RIOTstuff/riot-nrfvendor/RIOT/tests/sys/shell'
/home/cbuec/RIOTstuff/riot-nrfvendor/RIOT/dist/tools/openocd/openocd.sh flash /home/cbuec/RIOTstuff/riot-nrfvendor/RIOT/tests/sys/shell/bin/nucleo-c071rb/tests_shell.elf
### Flashing Target ###
Open On-Chip Debugger 0.12.0+dev-02228-ge5888bda3-dirty (2025-10-09-21:04)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
Warn : DEPRECATED! use 'transport select swd', not 'transport select dapdirect_swd' <============================
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 V2J45M31 (API v2) VID:PID 0483:374B
Info : Target voltage: 3.260170
Info : Unable to match requested speed 2000 kHz, using 1800 kHz
Info : Unable to match requested speed 2000 kHz, using 1800 kHz
Info : clock speed 1800 kHz
Info : SWD DPIDR 0x0bc11477
Info : [stm32c0x.cpu] Cortex-M0+ r0p1 processor detected
Info : [stm32c0x.cpu] target has 4 breakpoints, 2 watchpoints
Info : [stm32c0x.cpu] Examination succeed
Info : [stm32c0x.cpu] starting gdb server on 0
Info : Listening on port 46869 for gdb connections
    TargetName         Type       Endian TapName            State
--  ------------------ ---------- ------ ------------------ ------------
 0* stm32c0x.cpu       cortex_m   little stm32c0x.cpu       unknown
[stm32c0x.cpu] halted due to debug-request, current mode: Thread
xPSR: 0xf1000000 pc: 0x080008a4 msp: 0x20000200
Info : device idcode = 0x10016493 (STM32C071xx - Rev Z : 0x1001)
Info : RDP level 0 (0xAA)
Info : flash size = 128 KiB
Info : flash mode : single-bank
Info : Padding image section 1 at 0x08003fdc with 4 bytes (bank write end alignment)
Warn : Adding extra erase range, 0x08003fe0 .. 0x08003fff
auto erase enabled
wrote 16352 bytes from file /home/cbuec/RIOTstuff/riot-nrfvendor/RIOT/tests/sys/shell/bin/nucleo-c071rb/tests_shell.elf in 0.581683s (27.453 KiB/s)
verified 16348 bytes in 0.205263s (77.778 KiB/s)
shutdown command invoked
Done flashing
make: Leaving directory '/home/cbuec/RIOTstuff/riot-nrfvendor/RIOT/tests/sys/shell'

THAT however clashes with older OpenOCD versions (0.11.0 that is shipped with my WSL Ubuntu) which results in an error:
Error: Debug adapter doesn't support 'swd' transport 🫠

cbuec@W11nMate:~/RIOTstuff/riot-nrfvendor/RIOT$ sudo BOARD=nucleo-c071rb OPENOCD=/usr/bin/openocd make -C tests/sys/shell flash-only
make: Entering directory '/home/cbuec/RIOTstuff/riot-nrfvendor/RIOT/tests/sys/shell'
/home/cbuec/RIOTstuff/riot-nrfvendor/RIOT/dist/tools/openocd/openocd.sh flash /home/cbuec/RIOTstuff/riot-nrfvendor/RIOT/tests/sys/shell/bin/nucleo-c071rb/tests_shell.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
Error: Debug adapter doesn't support 'swd' transport

make: *** [/home/cbuec/RIOTstuff/riot-nrfvendor/RIOT/tests/sys/shell/../../../Makefile.include:866: flash-only] Error 1
make: Leaving directory '/home/cbuec/RIOTstuff/riot-nrfvendor/RIOT/tests/sys/shell'

Nevertheless here is a successful flashing process and the shell:

cbuec@W11nMate:~/RIOTstuff/riot-nrfvendor/RIOT$ sudo BOARD=nucleo-c071rb make -C tests/sys/shell flash term
make: Entering directory '/home/cbuec/RIOTstuff/riot-nrfvendor/RIOT/tests/sys/shell'
Building application "tests_shell" for "nucleo-c071rb" with CPU "stm32".

"make" -C /home/cbuec/RIOTstuff/riot-nrfvendor/RIOT/pkg/cmsis/
...
"make" -C /home/cbuec/RIOTstuff/riot-nrfvendor/RIOT/sys/ztimer
   text    data     bss     dec     hex filename
  16172     176    2512   18860    49ac /home/cbuec/RIOTstuff/riot-nrfvendor/RIOT/tests/sys/shell/bin/nucleo-c071rb/tests_shell.elf
/home/cbuec/RIOTstuff/riot-nrfvendor/RIOT/dist/tools/openocd/openocd.sh flash /home/cbuec/RIOTstuff/riot-nrfvendor/RIOT/tests/sys/shell/bin/nucleo-c071rb/tests_shell.elf
### Flashing Target ###
Open On-Chip Debugger 0.12.0+dev-02228-ge5888bda3-dirty (2025-10-09-21:04)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
Warn : DEPRECATED! use 'transport select swd', not 'transport select dapdirect_swd'
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 V2J45M31 (API v2) VID:PID 0483:374B
Info : Target voltage: 3.260170
Info : Unable to match requested speed 2000 kHz, using 1800 kHz
Info : Unable to match requested speed 2000 kHz, using 1800 kHz
Info : clock speed 1800 kHz
Info : SWD DPIDR 0x0bc11477
Info : [stm32c0x.cpu] Cortex-M0+ r0p1 processor detected
Info : [stm32c0x.cpu] target has 4 breakpoints, 2 watchpoints
Info : [stm32c0x.cpu] Examination succeed
Info : [stm32c0x.cpu] starting gdb server on 0
Info : Listening on port 40007 for gdb connections
    TargetName         Type       Endian TapName            State
--  ------------------ ---------- ------ ------------------ ------------
 0* stm32c0x.cpu       cortex_m   little stm32c0x.cpu       unknown
[stm32c0x.cpu] halted due to debug-request, current mode: Thread
xPSR: 0xf1000000 pc: 0x080008a4 msp: 0x20000200
Info : device idcode = 0x10016493 (STM32C071xx - Rev Z : 0x1001)
Info : RDP level 0 (0xAA)
Info : flash size = 128 KiB
Info : flash mode : single-bank
Info : Padding image section 1 at 0x08003fdc with 4 bytes (bank write end alignment)
Warn : Adding extra erase range, 0x08003fe0 .. 0x08003fff
auto erase enabled
wrote 16352 bytes from file /home/cbuec/RIOTstuff/riot-nrfvendor/RIOT/tests/sys/shell/bin/nucleo-c071rb/tests_shell.elf in 0.588064s (27.155 KiB/s)
verified 16348 bytes in 0.216457s (73.755 KiB/s)
shutdown command invoked
Done flashing
/home/cbuec/RIOTstuff/riot-nrfvendor/RIOT/dist/tools/pyterm/pyterm -p "/dev/ttyACM0" -b "115200" -ln "/tmp/pyterm-root" -rn "2025-10-09_23.09.35-tests_shell-nucleo-c071rb"
2025-10-09 23:09:35,526 # Connect to serial port /dev/ttyACM0
Welcome to pyterm!
Type '/exit' to exit.
help
2025-10-09 23:10:03,240 # help
2025-10-09 23:10:03,243 # Command              Description
2025-10-09 23:10:03,246 # ---------------------------------------
2025-10-09 23:10:03,251 # bufsize              Get the shell's buffer size
2025-10-09 23:10:03,254 # start_test           starts a test
2025-10-09 23:10:03,257 # end_test             ends a test
2025-10-09 23:10:03,261 # echo                 prints the input command
2025-10-09 23:10:03,265 # empty                print nothing on command
2025-10-09 23:10:03,269 # periodic             periodically print command
2025-10-09 23:10:03,273 # xfa_test1            xfa test command 1
2025-10-09 23:10:03,276 # xfa_test2            xfa test command 2
2025-10-09 23:10:03,281 # app_metadata         Returns application metadata
2025-10-09 23:10:03,286 # pm                   interact with layered PM subsystem
2025-10-09 23:10:03,291 # ps                   Prints information about running threads.
2025-10-09 23:10:03,296 # version              Prints current RIOT_VERSION
2025-10-09 23:10:03,299 # reboot               Reboot the node
> version
2025-10-09 23:10:06,674 # version
2025-10-09 23:10:06,678 # 2025.10-devel-430-g73149-pr/stm32c0_new
>

Copy link
Member

@AnnsAnns AnnsAnns left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's really hard to find any code to complain about in a crasbe PR 😔 I can confirm that both the board and docs build though (Can not flash, I thought I had one at home but its a different nucleo)

@crasbe
Copy link
Contributor Author

crasbe commented Oct 10, 2025

It's really hard to find any code to complain about in a crasbe PR 😔

Oh stop it you 😳 👉 👈

But credit where credit is due, that code was not written by me (and I also can't and won't take credit for the mistakes 🤣 ).

Copy link
Member

@AnnsAnns AnnsAnns left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's true, thank you jasonparkerbissell / jparker324 (Are these two people? 😅) for the OG PR.

Considering that this is a revamp of the old PR, I'd count your successful flash test as enough for this but I also wouldn't mind if somebody else could verify it. Either way, thank you for your final touches to get this merge-able 🐸 👍

@crasbe crasbe force-pushed the pr/stm32c0_new branch 2 times, most recently from 8a79d06 to e0f9f11 Compare October 10, 2025 11:14
@github-actions github-actions bot removed the Area: CI Area: Continuous Integration of RIOT components label Oct 10, 2025
@crasbe crasbe enabled auto-merge October 10, 2025 11:15
@crasbe crasbe added this pull request to the merge queue Oct 10, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to no response for status checks Oct 10, 2025
@AnnsAnns
Copy link
Member

Did Murdock fall asleep?

@crasbe
Copy link
Contributor Author

crasbe commented Oct 13, 2025 via email

@AnnsAnns
Copy link
Member

Oh :(

@crasbe crasbe added this pull request to the merge queue Oct 14, 2025
Merged via the queue into RIOT-OS:master with commit 5afe64e Oct 14, 2025
25 checks passed
@crasbe crasbe deleted the pr/stm32c0_new branch October 14, 2025 21:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: boards Area: Board ports Area: build system Area: Build system Area: cpu Area: CPU/MCU ports Area: doc Area: Documentation Area: examples Area: Example Applications Area: Kconfig Area: Kconfig integration Area: tests Area: tests and testing framework CI: no fast fail don't abort PR build after first error CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Platform: ARM Platform: This PR/issue effects ARM-based platforms Type: new feature The issue requests / The PR implemements a new feature for RIOT

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants