简体   繁体   中英

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

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 (ie 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'

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

要回答第二个问题,您没有提供适用于您的主板的配置文件(STM32F100RB Discovery),openocd只知道您的适配器(ST-Link),因此出现错误消息。

您还需要引用stm32f1x.cfg文件:

openocd-0.7.0-rc2.exe -f stlink-v2.cfg -f stm32f1x.cfg

I encounter the same issue. When i try this command:

openocd-x64-0.8.0 -f interface\stlink-v2.cfg -f target\stm32f1x.cfg

I get the following:

c:\>openocd-x64-0.8.0 -f interface\stlink-v2.cfg -f target\stm32f1x.cfg
Open On-Chip Debugger 0.8.0 (2014-04-28-08:42)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.sourceforge.net/doc/doxygen/bugs.html
Error: session's transport is not selected.
Runtime Error: embedded:startup.tcl:20:
in procedure 'script'
at file "embedded:startup.tcl", line 58
in procedure 'swj_newdap' called at file "C:/openocd-0.8.0//scripts/target\stm32f1x.cfg", line 37
in procedure 'transport' called at file "C:/openocd-0.8.0//scripts/target/swj-dp.tcl", line 26
in procedure 'ocd_bouncer'
at file "embedded:startup.tcl", line 20

EDIT:

Nevermind, I found it... my stlink is a V2 version, so I tried with the V2 config and stm32f1x_stlink.cfg. No it started without a glitch. Next step is to connect with GDB and Eclipse.

Cheers!

Alex

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM