cancel
Showing results for 
Search instead for 
Did you mean: 

How to debug STM32MP1(Cortex-M4) firmware on user board?

HAPPYDAY
Associate II

I have the STM32MP157C-DK2, and I plan to make a user board.

Before creating a user board, I have a question.

1. I want to know how to debug Cortex-M4 firmware on the user board. GDB debug is used in No. 7 in the link below.

https://wiki.st.com/stm32mpu/wiki/Getting_started/STM32MP1_boards/STM32MP157x-DK2/Develop_on_Arm%C2%AE_Cortex%C2%AE-M4/Modify,_rebuild_and_reload_a_firmware

In STM32CubeIDE, STM32MP157C-DK2 can debug the firmware through ST-LINK MCU (OpenOCD), but there is no ST-LINK MCU on the user board, so I am curious about how to debug in STM32CubeIDE. Is debugging by connecting Segger J-link or ST-LINK (V2/V3) to the user board? I want to know if it is possible and how to do it if possible.

3 REPLIES 3
Olivier GALLIEN
ST Employee

Hi @HAPPYDAY​ ,

If there's no embed ST-Link in your design you can use external STLinkV2/V3 probe since you expose SWD signal on one connector.

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.

Debugging works by connecting cables to CN7 and CN11 in STM32MP157C-DK2 and setting them as shown in the attached figure.

0693W000008xl87QAA.jpgHowever, if you connect ST-LINK v2/v3 to CN12 pin header of STM32MP157C-DK2 and set it as shown in the attached picture, debugging will not proceed and a command aborted message will be displayed as shown in the attached picture.

0693W000008xl9jQAA.jpgDebugging does not work even if the resistors of SB17, SB19, SB20, SB22 are removed from the board and the debugging settings are changed. I don't know what the problem is. I want to know how I can debug using ST-LINK.

Hello Olivier,

so, is it possible to use a STLink V2 (i.e. without Virtual COM Ports on connector) and without using the gdbserver on the STLink Embedded Hardware?

I am able to upload the firmware on the CoProcessor M4:

echo "firmwarename" > /sys/class/remoteproc/remoteproc0/firmware

run it using the following command:

echo "start" > /sys/class/remoteproc/remoteproc0/state

and it works, even compiled on debug mode, the trace is working fine:

cat /sys/kernel/debug/remoteproc/remoteproc0/trace0

Now I am trying to figure out how to debug it with a OpenOCD JTAG or STLink V2 debugger without using STM32CubeIDE.

Do I need to start gdbserver on the Linux core? How to find the ProcessID to attach? The PID is not shown as the code is running in a RPMSG based co-processor... Are there useful documentation on that instead of tell me: USE STLINKV3 AND STM32CUBEIDE sentence... ;)

Thank you,

Gianluca