eclipse 使用 OpenOCD 调试 STM32F1xx 探索板(ST-Link)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/16287915/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Using OpenOCD for debugging STM32F1xx Discovery board (ST-Link)
提问by Jolle
I got some problems getting OpenOCD to communicate with my STM32F100RB Discovery board (it uses ST-Link).
我在让 OpenOCD 与我的 STM32F100RB 探索板(它使用 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.
我不习惯使用开源工具,因此我在编程和调试嵌入式平台时从未遇到过问题。在过去的一周里,我遇到的问题比我想象的要多,只是试图让 IDE + FreeRTOS + Debugging 启动并运行。
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:
我现在决定为我的嵌入式应用程序使用 Eclipse + Sourcery G++ Lite + OpenOCD。我编译了一个小应用程序(良好的开始...),现在正在尝试使用 OpenOCD 进行编程和调试。当我这样做时,我收到以下错误:
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 :)
我不知道从哪里开始,请帮忙。另外:如果有人有更好的 STM32 开源/免费 IDE,它“支持”FreeRTOS(即有演示/模板可用),我会很高兴听到它:)
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'
回答by Freddie Chopin
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:
为什么不直接使用可用的电路板配置?scripts/board/stm32vldiscovery.cfg 这正是您的董事会。这样你就不需要指定接口和芯片,只需要指定板子:
openocd-0.7.0-rc2.exe -f board/stm32vldiscovery.cfg
回答by Alexper
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.
没关系,我找到了……我的 stlink 是 V2 版本,所以我尝试使用 V2 配置和 stm32f1x_stlink.cfg。不,它开始时没有出现故障。下一步是连接 GDB 和 Eclipse。
Cheers!
干杯!
Alex
亚历克斯
回答by étienne
To answer your second question, you didn't provide the configuration file for your board ( STM32F100RB Discovery), openocd only knows about your adapter (ST-Link), therefore the error message.
要回答您的第二个问题,您没有提供您的开发板的配置文件(STM32F100RB Discovery),openocd 只知道您的适配器(ST-Link),因此是错误消息。
回答by amo
You need to also reference the stm32f1x.cfg file:
您还需要引用 stm32f1x.cfg 文件:
openocd-0.7.0-rc2.exe -f stlink-v2.cfg -f stm32f1x.cfg