ST’s latest tool, STM32CubeIDE, is an Eclipse based IDE which provides an all-in-one development experience by integrating their previous TrueSTUDIO IDE with the STM32CubeMX code configurator. Among its many features are build and stack analyzers which help the developer keep an eye on memory consumption. These are very useful and provide vital information, but unfortunately are are not entirely straightforward to use.
I started by importing my project into STM32CubeIDE and building it. It built successfully, as shown below. Notice that the build output provides code size information, though not in a human-readable format. This is where the Build Analyzer comes in handy.
Unfortunately, after building the project, the Build Analyzer (the Memory Regions tab in particular) is not automatically populated with any code size information.
To get this information, we have to select the <project_name>.map
file in the Debug folder. In the Project Explorer, expand the Debug folder and single-click on the .map
file. If this file is not present, right-click on the Debug folder and chose Refresh.
UPDATE: The latest versions of STM32CubeIDE solve this issue by using the project name as the base name for the
.elf
file by default. Because this is also done for the.map
file, both files will have the same base name and the Build Analyzer will be automatically populated (as @M.Yaqoob mentioned in the comments section below).
It should also be noted that manually selecting the.map
file as mentioned above will cause the “FLASH” region in the Build Analyzer to report incorrect values (instead depicting the memory consumed by both Flash and RAM). The.elf
file should be selected instead. This is useful when multiple build configurations are utilized for the application and you wish to examine a specific build’s memory consumption details. Simply choose the appropriate.elf
file from the corresponding build directory (e.g. Debug, Release, etc.). Thanks to @wgoebel for pointing this out!
The Memory Regions tab should now be populated with memory usage statistics for the FLASH and RAM regions. Most useful is the Usage (%) column which visually shows how much memory is being consumed.