STM32MP157C-DK2 board support and debug

Hi,

I am working to run and debug some zephyr-rtos sample code for M4 core in stm32mp157c-dk2 board. I could manage to compile my code successfully but when i try to load firmware.elf for debugging cortex-M4 core independent of cortex-A7 core i get the following error message. I have also tried with A7 core booted up but the same error message is shown on debug console of platformIO.
I am using platformIO on vscode and st-link with OpenOCD for debugging

undefinedC:\Users.platformio\packages\toolchain-gccarmnoneeabi\bin\arm-none-eabi-gdb.exe: warning: Couldn’t determine a path for the index cache directory.

Reading symbols from C:\Users\Documents\PlatformIO\Projects\test4_mp1.pio\build\disco_mp157c_dk2\firmware.elf…
PlatformIO Unified Debugger → Redirecting...
PlatformIO: debug_tool = stlink
PlatformIO: Initializing remote target…
xPack OpenOCD, x86_64 Open On-Chip Debugger 0.11.0-00155-ge392e485e (2021-03-15-16:44)
Licensed under GNU GPL v2
For bug reports, read
OpenOCD: Bug Reporting
srst_only srst_pulls_trst srst_gates_jtag srst_open_drain connect_deassert_srst

Info : tcl server disabled
Info : telnet server disabled
Info : STLINK V2J37M26 (API v2) VID:PID 0483:3752
Info : Target voltage: 3.177996
2
Info : Unable to match requested speed 5000 kHz, using 4000 kHz
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 : stm32mp15x.cm4: hardware has 6 breakpoints, 4 watchpoints
Info : stm32mp15x.cpu0: hardware has 6 breakpoints, 4 watchpoints
Info : stm32mp15x.cpu0 rev 5, partnum c07, arch f, variant 0, implementor 41
Info : stm32mp15x.cpu0: MPIDR level2 0, cluster 0, core 0, multi core, no SMT
Info : stm32mp15x.cpu1: hardware has 6 breakpoints, 4 watchpoints
Info : stm32mp15x.cpu1 rev 5, partnum c07, arch f, variant 0, implementor 41
Info : stm32mp15x.cpu1: MPIDR level2 0, cluster 0, core 1, multi core, no SMT
Info : starting gdb server for stm32mp15x.cpu0 on pipe
Info : starting gdb server for stm32mp15x.cm4 on pipe
Info : accepting ‘gdb’ connection from pipe
Info : New GDB Connection: 1, Target stm32mp15x.cpu0, state: halted
Info : accepting ‘gdb’ connection from pipe
Info : New GDB Connection: 2, Target stm32mp15x.cm4, state: halted
4
Error: GDB missing ack(2) - assumed good
undefined debug reason 8 - target needs reset
8

Error: GDB missing ack(2) - assumed good

SystemInit () at C:\Users.platformio\packages\framework-zephyr-hal-stm32\stm32cube\stm32mp1xx\soc\system_stm32mp1xx.c:149

149 CLEAR_REG(EXTI_C2->IMR3);

2

Error: GDB missing ack(2) - assumed good

15

Warn : negative reply, retrying

.pioinit:14: Error in sourced command file:

Reply contains invalid hex digit -72

i am not able to decipher what the error actually means. May i request anyone to suggest how to get the debug run for cortex M4 core in STM32MP157c-dk2 board? Any pointer or direction to look into will be very helpful.

This looks like OpenOCD and GDB don’t quite understand each other. Maybe OpenOCD has a bug, or GDB needs to be of a higher version.

Can you, as a first try, add

platform_packages = 
   toolchain-gccarmnoneeabi@~1.90301.0

to the platformio.ini to use a new arm-none-eabi-gcc 9.3.1 toolchain?

thanks for the reply. looking into OenOCD target>.cfg file i found this which seems related to the issue

this didn’t impact much.

Any pointers towards how to add a latest OpenOCD tool version for debug ?

You can use platform_pacakges to point tool-openocd to be sourced from a locally compiled bleeding edge version (that you must compile yourself). See link above and this for more details on packages.

Basically, make and make install the latest OpenOCD to some folder on your computer, copy the old package.json file cp ~/.patformio/packages/tool-openocd/package.json <your openocd install folder>/., then refer to the local installation via platform_packages = tool-openocd@file://<path to openocd install folder here> in the platformio.ini.

If that is till not working with the latest OpenOCD and toolchain version, please file a bug in OpenOCD for help.