Forums › Reference, Evaluation, and Development Boards › OSD32MP1-BRK › M4 Debugging with IAR workbench
Tagged: e
Is it possible to debug the M4 in non-Engineering Mode with IAR workbench and ST-LINK? If so, how can I do this? I can debug in Engineering Mode, but I would also like to debug in non-Engineering mode.
Thanks
Craig
Hello Craig Kleinrichert,
M4 supports 2 debug modes:
1. Via JTAG/SWD (ST-link) in Engineering Mode using STM32 Cube IDE
2. Via Linux Core in Production Mode using STM32 CubeIDE
We have not validated the IAR workbench flow.
The following tutorial videos from ST provide further clarity:
1. STM32MP1 Tips & Tricks – 04 How to debug M4 in production mode with STM32CubeIDE – https://www.youtube.com/watch?v=YIhzzgJmop0
2. STM32MP1 Tips & Tricks – 03 How to debug M4 in engineering mode with STM32CubeIDE – https://www.youtube.com/watch?v=HX9rO8IukeI
The important thing to keep in mind is that when you’re trying to debug in Production mode, it is mandatory to properly assign resources like clocks, interrupts and other interfaces (GPIO/I2C/SPI) to M4 in the Linux Device Tree. Otherwise, resources are assigned to A7 by default. A good example for this is demonstrated in STM32MP157C-DK2 platform’s boot process. During boot process, DK2 platform will ask the user to select one of the boot modes:
Select the boot mode
1 2 3 | 1: stm32mp157c-dk2-sdcard (uses "stm32mp157c-dk2.dts" device tree) 2: stm32mp157c-dk2-a7-examples-sdcard (uses "stm32mp157c-dk2-a7-examples.dts" device tree) 3: stm32mp157c-dk2-m4-examples-sdcard (uses "stm32mp157c-dk2-m4-examples.dts" device tree) |
Depending on the selection, the platform pulls a different device tree and boots up. Among the above options, option #1 is the Default option (does not support M4 debug) but option #3 allows you debug M4 in production mode. The device trees referenced above corresponding to each boot mode are available as part of OpenSTLinux Developer Package – https://wiki.st.com/stm32mpu-ecosystem-v3/wiki/STM32MP1_Developer_Package_-_Linux_kernel#Archives. I have also attached the device tree sources for all three boot modes to this thread for quick reference.
Observe the resource allocation differences between “stm32mp157c-dk2.dts” and “stm32mp157c-dk2-m4-examples.dts” as captured here – https://www.diffchecker.com/zRWjSmbQ/. Similar modifications may be needed to your custom device tree to assign resources for M4 and debug it in production mode.
Depending on your M4 use case, the above videos and device tree references should help you configure your device for M4 use and debug in production mode.
Craig,
In addition to Eshtaartha’s notes on M4 debug in production mode, please see https://community.st.com/t5/stm32-mpus-other-tools/how-to-generate-elf-file-for-cortex-m4-using-iar/td-p/84786 for a discussion on 3rd party tools working with MP1.
Best,
Neeraj
Octavo Systems LLC all rights reserved
OCTAVO is registered in the U.S. Patent and Trademark Office. OSD, C-SiP, and the Octavo Logo are trademarks of Octavo Systems LLC.
"*" indicates required fields
"*" indicates required fields
"*" indicates required fields
"*" indicates required fields