cancel
Showing results for 
Search instead for 
Did you mean: 

Nucleo STM32H5 debugging OpenOCD

margce
Associate III

Hi all,

I recently got a Nucleo STM32H563ZI board to start doing development with the STM32H5x family of microcontrollers but I'm having issues trying to setup a debug session in VSCode. I've download the STM32 OpenOCD version and compiled it as it seems to have support for STM32h5x.

 

Has anyone successfully launched a debug session in VSCode? 

I'm using Cortex-Debug and have tried different configurations with openocd but no luck. 

Thanks!

martin

12 REPLIES 12
tebel
Associate II

Thanks! Will take a look at and get back to you if I need anything.

Hi Nemui,

I stumbled onto this after needing to incorporate an STM32H5 project with PlatformIO and the standard OpenOCD installation doesn't include H5 support. I've replaced the local installation with your compiled binaries (many thanks!) but am running into an issue seemingly from the OpenOCD build when trying to upload or debug:

embedded:startup.tcl:28: Error: Can't find interface/stlink.cfg
in procedure 'script' 
at file "embedded:startup.tcl", line 28
*** [upload] Error 1

I've verified that there is in fact a file at interface/stlink.cfg, but wondering if you have any tips on this.


Dear SSpen,

Can you execute OpenOCD standalone(execute OpenOCD from windows powershell)?
If executes correctly,problems may be in PlatformIO settings.

Here is my example output.

 

PS C:\Devz\ARM\ocd> ./openocd.exe  -s C:/Devz/ARM/OCD/tcl -f interface/stlink-dap.cfg -c "transport select dapdirect_swd" -f target/stm32h5x_flash.cfg -c "mt_flash main.elf"
Open On-Chip Debugger 0.12.0+dev-00552-ga35e254c5 (2024-03-28-21:18)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
dapdirect_swd
Info : STLINK V3J13M4 (API v3) VID:PID 0483:3754
Info : Target voltage: 3.278828
Info : Unable to match requested speed 480 kHz, using 200 kHz
Info : Unable to match requested speed 480 kHz, using 200 kHz
Info : clock speed 200 kHz
Info : stlink_dap_op_connect(connect)
Info : SWD DPIDR 0x6ba02477
Info : [stm32h5x.cpu] Cortex-M33 r0p4 processor detected
Info : [stm32h5x.cpu] target has 8 breakpoints, 4 watchpoints
Info : [stm32h5x.cpu] Examination succeed
Info : starting gdb server for stm32h5x.cpu on 3333
Info : Listening on port 3333 for gdb connections
Info : Unable to match requested speed 480 kHz, using 200 kHz
Info : Unable to match requested speed 480 kHz, using 200 kHz
CPU in Non-Secure state
[stm32h5x.cpu] halted due to breakpoint, current mode: Thread
xPSR: 0xf9000000 pc: 0x08030d68 msp: 0x20050000
Info : Unable to match requested speed 4000 kHz, using 3300 kHz
Info : Unable to match requested speed 4000 kHz, using 3300 kHz
Info : device idcode = 0x10016484 (STM32H56/H57xx - Rev Z : 0x1001)
Info : TZEN = 0xC3 : TrustZone disabled by option bytes
Info : Product State = 0xED : 'Open'
Info : flash size = 2048kbytes
Info : flash mode : dual-bank
Info : Padding image section 1 at 0x08074924 with 28 bytes
Info : Padding image section 2 at 0x0807cd8c with 4 bytes (bank write end alignment)
Warn : Adding extra erase range, 0x0807cd90 .. 0x0807dfff
Info : wrote 511376 bytes from file main.elf in 2.114525s (236.172 KiB/s)
Info : verified 511344 bytes in 1.253187s (398.472 KiB/s)
Info : Unable to match requested speed 480 kHz, using 200 kHz
Info : Unable to match requested speed 480 kHz, using 200 kHz
shutdown command invoked

 


Best regards,
Nemui