Using OpenOCD for debugging STM32F1xx Discovery board (ST-Link)

Jolle picture Jolle · Apr 29, 2013 · Viewed 18.3k times · Source

I got some problems getting OpenOCD to communicate with my STM32F100RB Discovery board (it uses ST-Link).

I am not used to working with open source tools, and therefore I've never had problems programming and debugging my embedded platforms. In the past week I've had more problems than I had ever imagined, just trying to get an IDE + FreeRTOS + Debugging up and running.

I have now decided to use Eclipse + Sourcery G++ Lite + OpenOCD for my embedded application. I have a little application compiled (good start...) and are now trying to program and debug using OpenOCD. When I am doing that I get the following error:

Open On-Chip Debugger 0.7.0-rc2 (2013-04-28-12:55)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.sourceforge.net/doc/doxygen/bugs.html
Error: Debug adapter doesn't support any transports?
Runtime Error: embedded:startup.tcl:20: 
in procedure 'script' 
at file "embedded:startup.tcl", line 58
at file "stm32f1x_stlink.cfg", line 17
in procedure 'transport' called at file "C:/openocd-0.7.0-            rc2/bin/../scripts/target/stm32_stlink.cfg", line 53
in procedure 'ocd_bouncer' 
at file "embedded:startup.tcl", line 20

I have no idea where to start, please help. Also: if anyone has a better opensource/free IDE for STM32 which "supports" FreeRTOS (i.e. for which a demo/template is available), I'll be very happy to hear about it :)

Edit:

Ok, I think that I used the wrong config-file in the first try. Now I am getting this instead:

C:\OpenOCD\openocd-0.7.0-rc2\bin>openocd-0.7.0-rc2.exe -f stlink-v2.cfg
Open On-Chip Debugger 0.7.0-rc2 (2013-04-28-12:55)
Licensed under GNU GPL v2
For bug reports, read
    http://openocd.sourceforge.net/doc/doxygen/bugs.html
Info : This adapter doesn't support configurable speed
Error: session's transport is not selected.
Error: allow transport 'hla_swd'
Error: allow transport 'hla_jtag'
Error: allow transport 'stlink_swim'
in procedure 'transport'
in procedure 'init'

Answer

Freddie Chopin picture Freddie Chopin · Nov 24, 2014

Why don't you just use the available board configuration? scripts/board/stm32vldiscovery.cfg This is for exactly your board. This way you won't need to specify interface and chip, just the board:

openocd-0.7.0-rc2.exe -f board/stm32vldiscovery.cfg