GDB + CLion + STM32f4 + OpenOCD - > gdb错误,远程'g'包中的截断寄存器16

问题描述 投票:0回答:2

在我的Windows10上,有stm32f407vg发现板我正在做的例子:f4-blog-master

然后我收到了这个错误:

D:\Software\OpenOCD-20170821\bin\openocd.exe -c "tcl_port disabled" -s D:\Software\OpenOCD-20170821\share\openocd\scripts -f board/stm32f4discovery.cfg -c "program \"E:/EDA223_Real-Time-Systems/EDA223_CODE/STM32CubeMX/f4-blog-master/cmake-build-debug/f4-blog.elf\";reset init;"
GNU MCU Eclipse 64-bits Open On-Chip Debugger 0.10.0+dev-00404-g20463c28 (2018-0
1-23-12:30)
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 mi
ght differ compared to plain JTAG/SWD
adapter speed: 2000 kHz
adapter_nsrst_delay: 100
none separate
srst_only separate srst_nogate srst_open_drain connect_deassert_srst
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: libusb_open() failed with LIBUSB_ERROR_NOT_SUPPORTED
Info : STLINK v2 JTAG v29 API v2 SWIM v18 VID 0x0483 PID 0x374B
Info : using stlink api v2
Info : Target voltage: 2.883666
Info : stm32f4x.cpu: hardware has 6 breakpoints, 4 watchpoints
Info : Listening on port 3333 for gdb connections
Info : Unable to match requested speed 2000 kHz, using 1800 kHz
Info : Unable to match requested speed 2000 kHz, using 1800 kHz
adapter speed: 1800 kHz
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x080004c8 msp: 0x20020000
Info : Unable to match requested speed 8000 kHz, using 4000 kHz
Info : Unable to match requested speed 8000 kHz, using 4000 kHz
adapter speed: 4000 kHz
** Programming Started **
auto erase enabled
Info : device id = 0x10076413
Info : flash size = 1024kbytes
target halted due to breakpoint, current mode: Thread
xPSR: 0x61000000 pc: 0x20000046 msp: 0x20020000
wrote 16384 bytes from file E:/EDA223_Real-Time-Systems/EDA223_CODE/STM32CubeMX/
f4-blog-master/cmake-build-debug/f4-blog.elf in 0.788115s (20.302 KiB/s)
** Programming Finished **
Info : Unable to match requested speed 2000 kHz, using 1800 kHz
Info : Unable to match requested speed 2000 kHz, using 1800 kHz
adapter speed: 1800 kHz
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x080004c8 msp: 0x20020000
Info : Unable to match requested speed 8000 kHz, using 4000 kHz
Info : Unable to match requested speed 8000 kHz, using 4000 kHz
adapter speed: 4000 kHz
Info : tcl server disabled
Info : Listening on port 4444 for telnet connections
Info : accepting 'gdb' connection on tcp/3333
Info : dropped 'gdb' connection

代码上传,gdb获取连接,但调试器控制台说:

Truncated register 16 in remote 'g' packet
Debugger disconnected

怎么解决?

PS:我的OpenOCD设置似乎有效。除了正常的MinGW-w64之外,没有在工具链中设置任何东西。 Cmake设置是默认设置。在Debug config中我的目标是:UPLOAD,可执行文件:f4-blog.elf。

当我做Tools-> Run OpenOCD时,我得到了:

... 
Info : stm32f4x.cpu: hardware has 6 breakpoints, 4 watchpoints
Info : Listening on port 3333 for gdb connections

所以OpenOCD看起来很好,但是gdb崩溃了,为什么呢?

gdb clion disconnect stm32f4discovery openocd
2个回答
0
投票

尝试安装32位版本的MinGW。不要忘记将工具链更改为CLion中的这个新版本 - 这在我的案例中有所帮助。


0
投票

我遇到过同样的问题。为了解决这个问题,我首先在Settings > Build, Execution, Deployment > Toolchains中添加了一个基于i686-w64-mingw32(32位版本的mingw-w64)的工具链,就像SapuSeven建议的那样,但它仍然没有用,所以我也更改了这个工具链的“调试器”到我的ARM工具链安装的arm-none-eabi-gdb.exe调试器(我的计算机上的C:\Program Files (x86)\GNU Tools ARM Embedded\7 2018-q2-update\bin\arm-none-eabi-gdb.exe),它工作正常。确保通过在工具链列表中向上移动它来将此新工具链设置为默认工具链。

另外我认为“OCD循环”运行/调试配置的目标和可执行字段都应该设置为“<project_name> .elf”,如CLion docs所示,而不是“UPLOAD”。

© www.soinside.com 2019 - 2024. All rights reserved.