On my Windows10, having stm32f407vg discovery boards I'm doing example: f4-blog-master
Then I got this error:
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
Code is uploaded, gdb get connection, but then debugger console says:
Truncated register 16 in remote 'g' packet
Debugger disconnected
How to fix it?
PS: My OpenOCD settings seems valid. Did not set anything in toolchain besides normal MinGW-w64. Cmake settings are default ones. In Debug config I target: UPLOAD, executable: f4-blog.elf.
When I do Tools-> Run OpenOCD, I got:
...
Info : stm32f4x.cpu: hardware has 6 breakpoints, 4 watchpoints
Info : Listening on port 3333 for gdb connections
So OpenOCD seems fine, but gdb is crashing, why?
I had the same issue. To fix it, I first added a toolchain based on i686-w64-mingw32 (32-bit version of mingw-w64) in Settings > Build, Execution, Deployment > Toolchains like SapuSeven suggested, but it still did not work, so I also changed the "Debugger" of this toolchain to the arm-none-eabi-gdb.exe debugger of my ARM toolchain installation (C:\Program Files (x86)\GNU Tools ARM Embedded\7 2018-q2-update\bin\arm-none-eabi-gdb.exe on my computer) and it worked. Make sure to set this new toolchain as the default one by moving it up in the toolchains list.
Also I think that both the Target and Executable fields of the "OCD loop" run/debug configuration should be set to "< project_name >.elf" as shown in the CLion docs, rather than "UPLOAD".
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With