Gdb可以';t连接到stm32上的OpenOCD

Gdb可以';t连接到stm32上的OpenOCD,gdb,stm32,openocd,Gdb,Stm32,Openocd,正在尝试调试STM32L476 Nucleo-64板上的示例闪烁led代码,但gdb无法连接到OpenOCD(由于错误,连接几乎立即中断)。我到处都读过很多帖子,但没有一篇有用。尝试使用-c向OpenOCD添加命令,但没有改变行为 我的代码在Eclipse的发行版和调试配置中进行编译。我可以使用拖放的方式来刷新bin文件(而电路板上有内置的STLink插件),看起来代码在电路板上运行得很好(LED闪烁) 使用以下版本在Centos7上交叉编译: 工具链(gdb):gcc-arm-none-ea

正在尝试调试STM32L476 Nucleo-64板上的示例闪烁led代码,但gdb无法连接到OpenOCD(由于错误,连接几乎立即中断)。我到处都读过很多帖子,但没有一篇有用。尝试使用-c向OpenOCD添加命令,但没有改变行为

我的代码在Eclipse的发行版和调试配置中进行编译。我可以使用拖放的方式来刷新bin文件(而电路板上有内置的STLink插件),看起来代码在电路板上运行得很好(LED闪烁)

使用以下版本在Centos7上交叉编译:

  • 工具链(gdb):gcc-arm-none-eabi-8-2018-q4-major
  • OpenOCD:0.10.0-11-20190118-1134
由于使用eclipse不起作用,我尝试了命令行

(我在此环境中不是一名经验丰富的开发人员,因此我找不到任何比stm32l4discovery.cfg更靠近我的stm32l476板的配置文件,请告诉我使用它是否可能存在一些问题)

开始了,

GNU MCU Eclipse 64-bit Open On-Chip Debugger 0.10.0+dev-00462-gdd1d90111 (2019-01-18-11:37)
Licensed under GNU GPL v2
For bug reports, read
    http://openocd.org/doc/doxygen/bugs.html
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
adapter speed: 500 kHz
adapter_nsrst_delay: 100
none separate
srst_only separate srst_nogate srst_open_drain connect_deassert_srst
Info : clock speed 500 kHz
Info : STLINK V2J28M17 (API v2) VID:PID 0483:374B
Info : Target voltage: 3.244386
Info : stm32l4x.cpu: hardware has 6 breakpoints, 4 watchpoints
Info : Listening on port 3333 for gdb connections
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
然后启动GDB:

./arm-none-eabi-gdb ~/eclipse-workspace/test-blink-led/Debug/test-blink-led.elf
然后在gdb中运行以下命令:

(gdb) target remote localhost:3333
Remote debugging using localhost:3333
Remote connection closed
如图所示,gdb连接会立即断开,OpenOCD会提示以下错误:

Info : accepting 'gdb' connection on tcp/3333
target halted due to debug-request, current mode: Thread 
xPSR: 0x01000000 pc: 0x080022e6 msp: 0x20017ff8
Info : device id = 0x10076415
Warn : STM32 flash size failed, probe inaccurate - assuming 1024k flash
Info : flash size = 1024kbytes
Error: auto_probe failed
Error: Connect failed. Consider setting up a gdb-attach event for the target to prepare target for GDB connect, or use 'gdb_memory_map disable'.
Error: attempted 'gdb' connection rejected
Error: jtag status contains invalid mode value - communication failure
Polling target stm32l4x.cpu failed, trying to reexamine
Examination failed, GDB will be halted. Polling again in 100ms
所以,对于那些每天都在类似平台上做这件事的极客们,有谁能帮助我,告诉我哪里做错了。缺少任何编译时标志是否会导致此问题


我有好几天都在挠头,所以请告诉我您的提示。

原因之一可能是您的STLINK固件看起来很旧(如您的日志所示,STLINK V2J28M17)。我建议下载应用程序以升级固件。该软件是一个多平台Java应用程序。它在Debian GNU/Linux中完美地工作

目前,我使用另一台gdb服务器进行gdb调试任务,在一些Nucleo和定制板上没有任何问题。我使用
target extended remote
命令加入服务器的端口。也许您也可以尝试在OpenOCD下使用此命令进行连接。

试试看 telnet本地主机4444


它对我有用,而3333没有

你是女神。我想不起来了。看起来固件已经过时了。升级到V2J34M25(API v2)后,它成功连接,尽管我还有一些其他问题。谢谢您的时间。4444端口确实是用于telnet连接的,但实际上3333是gdb服务器端口。
Info : accepting 'gdb' connection on tcp/3333
target halted due to debug-request, current mode: Thread 
xPSR: 0x01000000 pc: 0x080022e6 msp: 0x20017ff8
Info : device id = 0x10076415
Warn : STM32 flash size failed, probe inaccurate - assuming 1024k flash
Info : flash size = 1024kbytes
Error: auto_probe failed
Error: Connect failed. Consider setting up a gdb-attach event for the target to prepare target for GDB connect, or use 'gdb_memory_map disable'.
Error: attempted 'gdb' connection rejected
Error: jtag status contains invalid mode value - communication failure
Polling target stm32l4x.cpu failed, trying to reexamine
Examination failed, GDB will be halted. Polling again in 100ms