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
adapter speed: 2000 kHz
adapter_nsrst_delay: 100
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!

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

| improve this answer | |
  • \$\begingroup\$ I'll go ahead and give that a try. Also, what information does the SVD file contain? Register definitions? \$\endgroup\$ – 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

| improve this answer | |
  • \$\begingroup\$ Thanks, I'll give this a go. However, I am using JTAG, not SWD \$\endgroup\$ – Gus W Nov 12 '18 at 19:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.