cancel
Showing results for 
Search instead for 
Did you mean: 

Connecting and debuging STM32MP157F with M4 core

Bennny
Associate II

Hi.

I'm trying to develop some SW on the M4 core of STM32MP157FAD1 on custom board with custom Linux.
After 2 days of fighting I'm finally able to run the tty echo example on it.

But I still struggle with connection to the board.

  1. Why CubeIDE Debugger requires Serial port?
    We have the SSH accessible through the USB ETH over IP, that should be enough.
  2. The Debugger resolve wrongly IP of the board:
    We have pppd interface in the Linux. The debugger wrongly detects it's IP as the debugger IP.
    It results with this error:
    Bennny_0-1755093460860.png
    I'm also getting this error in console, it looks like the script/commands are interpreted wrongly:
    Bennny_3-1755093756718.png
  3. I'm still not able to get the ST-Link to work. It always ends with this error:
    Bennny_2-1755093680468.png

     

Thank you

P.S.

For others who also struggle to get it to work, check your device tree, CubeMX doesn't generate proper mbox m4_rproc. Add to end of the dts to the user section this:

&m4_rproc {
	mboxes = <&ipcc 0>, <&ipcc 1>, <&ipcc 2>, <&ipcc 3>;
	mbox-names = "vq0", "vq1", "shutdown", "detach";
};

 To have the trace0 interface, you must add define for build preprocessor __LOG_TRACE_IO_

6 REPLIES 6
Bennny
Associate II

Some update:
I was finally able to get the st-link debugger to work on a custom board. What I found, SWO pin is also needed (I had connected only SW data and clock).
I also had to add manual routing to my notebook to be able to work with the wrong IP address (I didn't find any way how to fix this, it's obvious bug in the debugger).

But I have one more question. If I want to debug e.g. initialization part of the code (start of the main loop before while(1)), I'm not able to do that.
When I place breakpoint here, it never stops on it (because program is already after this BP). When I do terminate and relaunch, it loads the whole program again like running the debugger for the first time! So the debugger connects again after some time of the program run (which is long time after the breakpoint).
Is there any way how to overcome this or is it another bug?

Hello @Bennny 

 

Sorry for the late reply.

The app demo provided in CubeIDE doesn't provide debug capabilities from the start, it was just intended to demonstrate ttyRPM

 You need to put a while(debug) at 1 where you want to debug the init code, then change the debug value in the IDE.

Bennny
Associate II

Thank you for the reply.
So I simply "halt" the program in the init by endless loop, which gives time to the debuger to connect.

Hello @Bennny 

 

Yes, in the wiki we recommend doing so, like for instance in the Cortex M33 but this can apply to all cores.

https://wiki.st.com/stm32mpu/wiki/How_to_build_and_debug_secure_project_on_Cortex-M33_coprocessor_in_STM32CubeIDE#Setting_up_the_debug_configuration

 

 

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.

Bennny
Associate II

Points 1 and 2 from the OP are still not answered, so I don't want to mark this topic as answered.