cancel
Showing results for 
Search instead for 
Did you mean: 

Cannot debug CM4 on STM32MP151 (eng mode)

Mario Luzeiro
Senior

Both on Windows and on Linux, latest STM32CubeIDE, I cant get debug or run using ST-Link.

If I try to use ST-Link GDB Server

Error in final launch sequence:
     
    Failed to execute MI command:
    target remote localhost:61234
     
    Error message from debugger back end:
    Remote communication error.  Target disconnected.: Connection reset by peer.
    Failed to execute MI command:
    target remote localhost:61234
     
    Error message from debugger back end:
    Remote communication error.  Target disconnected.: Connection reset by peer.
    Remote communication error.  Target disconnected.: Connection reset by peer.

STMicroelectronics ST-LINK GDB server. Version 6.1.0
    Copyright (c) 2022, STMicroelectronics. All rights reserved.
     
    Starting server with the following options:
            Persistent Mode            : Disabled
            Logging Level              : 1
            Listen Port Number         : 61234
            Status Refresh Delay       : 15s
            Verbose Mode               : Disabled
            SWD Debug                  : Enabled
     
    ST-LINK device status: UNKNOWN
    Waiting for debugger connection...
    Debugger connected
    Waiting for debugger connection...
    Failed halting target
    Shutting down...
    Exit.

If I try to "Run" (instead of Debug) I got:

...
    Info : accepting 'gdb' connection on tcp/3333
    Info : Halt timed out, wake up GDB.
    Error: timed out while waiting for target halted
    Error executing event gdb-attach on target STM32MP151AACx.cm4:
     
    Info : New GDB Connection: 2, Target STM32MP151AACx.cm4, state: reset
    Warn : GDB connection 2 on target STM32MP151AACx.cm4 not halted
    Warn : negative reply, retrying
    Warn : negative reply, retrying
    Warn : negative acknowledgment, but no packet pending
    Warn : negative acknowledgment, but no packet pending
    Info : stlink_dap_op_connect(connect)
    Info : SWD DPIDR 0x6ba02477
    Info : Deferring arp_examine of STM32MP151AACx.cpu1
    Info : Use arp_examine command to examine it manually!
    Info : Deferring arp_examine of STM32MP151AACx.cm4
    Info : Use arp_examine command to examine it manually!
    Info : stlink_dap_op_connect(connect)
    Info : SWD DPIDR 0x6ba02477
    Info : Deferring arp_examine of STM32MP151AACx.cpu1
    Info : Use arp_examine command to examine it manually!
    Info : STM32MP151AACx.cm4: Cortex-M4 r0p1 processor detected
    Info : STM32MP151AACx.cm4: target has 6 breakpoints, 4 watchpoints
    Info : Halt timed out, wake up GDB.
    Error: timed out while waiting for target halted
     
    Warn : target not halted
    Info : target STM32MP151AACx.cm4 was not halted when resume was requested
    Info : dropped 'gdb' connection
    shutdown command invoked
    Info : dropped 'gdb' connection

 Using Open On-Chip Debugger

Open On-Chip Debugger 0.11.0+dev-00443-gcf12591 (2022-02-09-13:30) [ST Internal]
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.org/doc/doxygen/bugs.html
srst_only srst_pulls_trst srst_gates_jtag srst_open_drain connect_deassert_srst
 
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Info : STLINK V2J39S0 (API v2) VID:PID 0483:3748
Info : Target voltage: 2.908319
Info : clock speed 4000 kHz
Info : stlink_dap_op_connect(connect)
Info : SWD DPIDR 0x6ba02477
Info : stlink_dap_op_connect(connect)
Info : SWD DPIDR 0x6ba02477
Info : STM32MP151AACx.cm4: Cortex-M4 r0p1 processor detected
Info : STM32MP151AACx.cm4: target has 6 breakpoints, 4 watchpoints
Info : STM32MP151AACx.cm4: external reset detected
Info : STM32MP151AACx.cpu0: hardware has 6 breakpoints, 4 watchpoints
Info : gdb port disabled
Info : gdb port disabled
Info : gdb port disabled
Info : starting gdb server for STM32MP151AACx.cpu0 on 3334
Info : Listening on port 3334 for gdb connections
Info : starting gdb server for STM32MP151AACx.cm4 on 3333
Info : Listening on port 3333 for gdb connections
Info : accepting 'gdb' connection on tcp/3333
Info : Halt timed out, wake up GDB.
Error: timed out while waiting for target halted
Error executing event gdb-attach on target STM32MP151AACx.cm4:
 
Info : New GDB Connection: 1, Target STM32MP151AACx.cm4, state: reset
Warn : GDB connection 1 on target STM32MP151AACx.cm4 not halted
Warn : negative reply, retrying
Warn : negative reply, retrying
O.K.
 
O.K.:0xE00FFFD0
 
Info : accepting 'gdb' connection on tcp/3333
Info : Halt timed out, wake up GDB.
Error: timed out while waiting for target halted
Error executing event gdb-attach on target STM32MP151AACx.cm4:
 
Info : New GDB Connection: 2, Target STM32MP151AACx.cm4, state: reset
Warn : GDB connection 2 on target STM32MP151AACx.cm4 not halted
Warn : negative reply, retrying
Warn : negative reply, retrying
Warn : negative acknowledgment, but no packet pending
Warn : negative acknowledgment, but no packet pending
Info : stlink_dap_op_connect(connect)
Info : SWD DPIDR 0x6ba02477
Info : Deferring arp_examine of STM32MP151AACx.cpu1
Info : Use arp_examine command to examine it manually!
Info : Deferring arp_examine of STM32MP151AACx.cm4
Info : Use arp_examine command to examine it manually!
Info : stlink_dap_op_connect(connect)
Info : SWD DPIDR 0x6ba02477
Info : Deferring arp_examine of STM32MP151AACx.cpu1
Info : Use arp_examine command to examine it manually!
Info : STM32MP151AACx.cm4: Cortex-M4 r0p1 processor detected
Info : STM32MP151AACx.cm4: target has 6 breakpoints, 4 watchpoints
Info : Halt timed out, wake up GDB.
Error: timed out while waiting for target halted
 
Warn : target STM32MP151AACx.cm4 is not halted (add breakpoint)
Error: can't add breakpoint: target running

5 REPLIES 5
Olivier GALLIEN
ST Employee

Hi @Mario Luzeiro​ ,

The only working configuration on MP1 is ST-Link (OpenOCD).

Which ST-Link probe are you using?

Which version of st-link firmware and CubeiDE ?

Thanks

Olivier

Olivier GALLIEN
In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.

I'm using a ST-Link from a Nucleo board. Latest firmware.

I fount that debug capabilities on Linux build was missing. I fixed it.

However, I'm still having issues. I found I cannot start a debug session if I have debug breakpoints. I can only add it after the session start. Is that a known issue?

Olivier GALLIEN
ST Employee

Hi @Mario Luzeiro​ 

you post state (eng mode) = CM4 alone... but your comment about Linux and symptom you are observing make me think you are in production mode with A7 running Linux

Could you please clarify ?

Thx

Olivier

Olivier GALLIEN
In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.

Sorry for the confusion I mixed the thread, as in fact I have issues on all cases :\

Back to Eng mode, CM4 alone.

If I start the STM32MP1 and try to debug in Eng Mode (status is idle and green), I got the problem:

Error: timed out while waiting for target halted
 
Warn : target STM32MP151AACx.cm4 is not halted (add breakpoint)
Error: can't add breakpoint: target running

If I start the STM32MP1 and debug via LinuxCore/ProductionMode (this mode works with some other issues), then if I switch to debug (without power cycle STM32MP1) to EngMode, I am able to debug step by step but (on my case) the FreeRTOS does not start.

osKernelStart returns osErrorISR.

I also have other Interrupts setup and they dont work / and no break point.

Mario Luzeiro
Senior

I still having issues debugging, new error message:

Info : starting gdb server for STM32MP151AACx.cpu0 on 3334
Info : Listening on port 3334 for gdb connections
Info : starting gdb server for STM32MP151AACx.cm4 on 3333
Info : Listening on port 3333 for gdb connections
Info : accepting 'gdb' connection on tcp/3333
Info : Halt timed out, wake up GDB.
Error: timed out while waiting for target halted
Error executing event gdb-attach on target STM32MP151AACx.cm4:
 
Info : New GDB Connection: 1, Target STM32MP151AACx.cm4, state: reset
Warn : GDB connection 1 on target STM32MP151AACx.cm4 not halted
Warn : negative reply, retrying
Warn : negative reply, retrying
O.K.
 
O.K.:0xE00FFFD0
 
Info : accepting 'gdb' connection on tcp/3333
Info : Halt timed out, wake up GDB.
Error: timed out while waiting for target halted
Error executing event gdb-attach on target STM32MP151AACx.cm4:
 
Info : New GDB Connection: 2, Target STM32MP151AACx.cm4, state: reset
Warn : GDB connection 2 on target STM32MP151AACx.cm4 not halted
Warn : negative reply, retrying
Warn : negative reply, retrying
Warn : negative acknowledgment, but no packet pending
Warn : negative acknowledgment, but no packet pending
Warn : target not halted
Info : target STM32MP151AACx.cm4 was not halted when resume was requested