STM32 MPU Family - MCU Support

Debug configuration

To debug an application, the debugger requires additional information to make the associations between the source code, the binaries generated from that original source and some other information. This information is included by default when the project is built using the "Debug" build configuration. The SystemWorkbench debugger used is Arm GDB.

More details about GDB are available here: GDB documentation.

In order to align the debug session with the source code, it is recommended to avoid any code optimization at compiler level. This can be adjust in the project Properties > C/C++ Build > Settings, in Tool Settings tab then select, MCU GCC Compiler > Optimization then Optimization Level is set to None (-O0)

A dedicated Debug Configuration is provided in order to handle Hybrid STM32. Indeed on the type of STM32 which typically run Linux or Android on the Cortex-A part, the MCU (i.e. the Cortex-M) is seen as a co-processor managed by Linux kernel side.
This means in order to Debug Cortex-M (MCU) in "Production Mode" we need the Linux kernel to load the Cortex-M image.
Note that an "Engineering Mode" is also proposed for Cortex-M preliminary debug. In that mode the Cortex-M (MCU) image is loaded via JTAG/SWD.

For the first time the user debug a program, a debug launch configuration must be created.
To create a debug configuration, use the following procedure:

It is not possible to set breakpoints before launching the image in that mode (Set breakpoint at: option). The image is indeed loaded by the Embedded Linux and we are running the Debugger in "attached mode". Note that after its attachment, the Debugger can take the control and set breakpoints. An infinite loop with variable test can be added at the very begin of the firmware in case of issue when integrating it into Linux framework.

If any change is made, click on Apply to save the configuration.





For more information about C/C++ development tools in Eclipse, please see C/C++ Development User Guide.