cancel
Showing results for 
Search instead for 
Did you mean: 

Cannot debug with CMSIS-DAP + OpenOCD + CubeIDE in WIN10

Lsy.1
Associate II

I have got a new CMSIS-DAP debugger, and I tested it with Keil 5 where everything works fine. Now I want to use it in STM32CubeIDE.

My configure file for OpenOCD my_cmsis.cfg is

source [find interface/cmsis-dap.cfg]
transport select swd
source [find target/stm32f1x.cfg]
reset_config srst_only

and OpenOCD is started with command openocd.exe -f .\my_cmsis.cfg

In CubeIDE, in the "Debug Configurations..", in debugger tab, debugger was set to ST-LINK(OpenOCD) and GDB connection setting was set to connect to remote GDB server, port 3333. After click Debug, an error shows up:

Error in final launch sequence:
 
Failed to execute MI command:
target remote localhost:3333
 
Error message from debugger back end:
Remote communication error.  Target disconnected.: Success.
Failed to execute MI command:
target remote localhost:3333
 
Error message from debugger back end:
Remote communication error.  Target disconnected.: Success.
Remote communication error.  Target disconnected.: Success.

The output of OpenOCD:

Open On-Chip Debugger 0.10.0 (2020-07-29) [https://github.com/sysprogs/openocd]
Licensed under GNU GPL v2
libusb1 09e75e98b4d9ea7909e8837b7a3f00dda4589dc3
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
srst_only separate srst_nogate srst_open_drain connect_deassert_srst
 
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Info : CMSIS-DAP: SWD  Supported
Info : CMSIS-DAP: JTAG Supported
Info : CMSIS-DAP: FW Version = 2.0.0
Info : CMSIS-DAP: Interface Initialised (SWD)
Info : SWCLK/TCK = 1 SWDIO/TMS = 1 TDI = 1 TDO = 1 nTRST = 1 nRESET = 1
Info : CMSIS-DAP: Interface ready
Info : clock speed 1000 kHz
Info : SWD DPIDR 0x1ba01477
Info : stm32f1x.cpu: hardware has 6 breakpoints, 4 watchpoints
Info : starting gdb server for stm32f1x.cpu on 3333
Info : Listening on port 3333 for gdb connections
Info : accepting 'gdb' connection on tcp/3333
target halted due to debug-request, current mode: Thread
xPSR: 0x81000000 pc: 0x08000434 msp: 0x2000bfc8
Info : device id = 0x10036414
Info : flash size = 256kbytes
Warn : Prefer GDB command "target extended-remote 3333" instead of "target remote 3333"
Info : rejected 'gdb' connection, no more connections allowed
Info : dropped 'gdb' connection (error -400)

Software Version: CubeIDE 1.5.1, OpenOCD 2020-07-29 (I have also tried 2020-12-28 version but same thing happens). There is a configure software provided by the manufacture in which I checked the firmware version is latest.

I have also tried OpenOCD in MSYS2 where the output is slightly different, and debugger still not works:

# openocd -f carbase.cfg
Open On-Chip Debugger 0.10.0
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
adapter speed: 1000 kHz
adapter_nsrst_delay: 100
none separate
cortex_m reset_config sysresetreq
Info : CMSIS-DAP: SWD  Supported
Info : CMSIS-DAP: JTAG Supported
Info : CMSIS-DAP: Interface Initialised (SWD)
Info : CMSIS-DAP: FW Version = 2.0.0
Info : SWCLK/TCK = 1 SWDIO/TMS = 1 TDI = 1 TDO = 1 nTRST = 1 nRESET = 1
Info : CMSIS-DAP: Interface ready
Info : clock speed 1000 kHz
Info : SWD DPIDR 0x1ba01477
Info : stm32f1x.cpu: hardware has 6 breakpoints, 4 watchpoints
Info : accepting 'gdb' connection on tcp/3333
Info : device id = 0x10036414
Info : flash size = 256kbytes
undefined debug reason 7 - target needs reset
Info : rejected 'gdb' connection, no more connections allowed
Info : dropped 'gdb' connection

What should I do to make the debugger work in CubeIDE?

3 REPLIES 3
LaurentL
ST Employee

Hello,

Maybe you have to untick the live expression in debug configuration. This is using a second gdb connection.

Or use the openocd from CubeIde.

Rgds,

Laurent

Untick the live expression and the program loaded without any problem.

But how to use the openocd from CubeIDE? There is only ST-LINK(OpenOCD) not CMSIS-DAP(OpenOCD), and click debug will display "No ST-LINK detected!"

Openocd from CubeIde is in external tool openocd plugin.

But you're right, it won't work better as you do since you can't select CMSIS-DAP as STM32CubeIDe doesn't support it except as you're doing.

Rgds,

Laurent