# How to connect custom stm32 board to debugger

I have a custom STM32 microcontroller board. I have verified all of the electrical connections, and I am able to program the board with Texane's st-flash utility. However, I would like to debug the board as well, and I am having trouble doing this. I am using Visual Studio Code with cortex-debug extension. The extension (I haven't used the command line utility for debugging much, not sure if it has the same requirements) requires that I have the SVD file for the specific chip - something I was unable to find online. The chip is the STM32F439ZIT6. For other boards, including the F407 discovery, I have not had any issues programming or debugging the board, but I also already have the SVD files for those chips that I found online. So, my question is where can I find the SVD files? Or how do I make them?

Alternatively, I looked a bit into using OpenOCD to debug - however I have been unsuccessful in getting that working at all. The most success I've had is running

openocd -f interface/stlink-v2-1.cfg -f target/stm32f4x.cfg


but this hits the error:

Info : auto-selecting first available session transport "hla_swd". To override use 'transport select <transport>'.
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
none separate
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
Error: open failed
in procedure 'init'
in procedure 'ocd_bouncer'


I think OpenOCD might be more powerful and something useful to learn, but from what I've found, there aren't many resources for using it with the ST-Link programmers and a custom board.

Thanks for help!

• Try these files, first match on google: – A.R.C. Nov 12 '18 at 7:19
• github.com/posborne/cmsis-svd/tree/master/data/STMicro – A.R.C. Nov 12 '18 at 7:19
• @A.R.C. I saw those files, but there isn't one for the STM32F439, unfortunately – Gus W Nov 12 '18 at 19:57
• Check out if there is a similar device listed. They are compatible most of the time. – A.R.C. Nov 13 '18 at 6:43

I'd try the SVD file for STM32F429, as they are almost identical to the STM32F439, the only difference is that STM32F429 lacks the AES encryption module.

Looking into the STM32F429.svd files found on the net, they include definitions for the encryption module as well, so they are apparently for both MCUs.

• I'll go ahead and give that a try. Also, what information does the SVD file contain? Register definitions? – Gus W Nov 12 '18 at 19:57

Check your board again, sometimes you can't image how funny u are.

And Try this shell when use ST-LINK SWD mode:

openocd_stlink.cfg: source [find interface/stlink-v2-1.cfg transport select swd source [find target/stm32f4x.cfg]

then run openocd in shell:

openocd -f ./openocd_stlink.cfg

• Thanks, I'll give this a go. However, I am using JTAG, not SWD – Gus W Nov 12 '18 at 19:58