# Utilizing the Build Analyzer in STM32CubeIDE

**URL:** <https://forum.digikey.com/t/utilizing-the-build-analyzer-in-stm32cubeide/3882>\
**Category:** Development Boards, Kits, Programmers\
**Tags:** stmicroelectronics, evaluation-boards, tech-tips\
**Created:** [July 11, 2019, 5:47pm UTC](https://forum.digikey.com/t/utilizing-the-build-analyzer-in-stm32cubeide/3882 "2019-07-11T17:47:01Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Matt\_Mielke](https://sea2.discourse-cdn.com/digikey/user_avatar/forum.digikey.com/matt_mielke/32/71373_2.png) [@Matt\_Mielke](https://forum.digikey.com/u/Matt_Mielke)\
**Post date:** [July 11, 2019, 5:47pm UTC](https://forum.digikey.com/t/utilizing-the-build-analyzer-in-stm32cubeide/3882/1 "2019-07-11T17:47:01Z")

</div>

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.

 ![stm32cubeide_build_output](https://global.discourse-cdn.com/digikey/original/2X/5/5d0b7a6d97c24757a3ec4de486839bd1e22ef130.png)

Unfortunately, after building the project, the Build Analyzer (the _Memory Regions_ tab in particular) is not automatically populated with any code size information.

 ![stm32cubeide_build_analyzer_empty](https://global.discourse-cdn.com/digikey/original/2X/c/c4c0d9337fb29eea2e9f96b2b47f0fe9f17e84c0.png)

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**.

 ![stm32cubeide_debug_folder](https://global.discourse-cdn.com/digikey/original/2X/1/14c35919b181daad7d1fcbc53318752ada8fbd8d.png)

> **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.

 ![stm32cubeide_build_analyzer_populated](https://global.discourse-cdn.com/digikey/original/2X/4/49da2b6d35e3ce29e4de8786e12b9c5df4e4e683.png)

---

<div class="post-metadata">

**Author:** ![M.Yaqoob](https://avatars.discourse-cdn.com/v4/letter/m/a3d4f5/32.png) [@M.Yaqoob](https://forum.digikey.com/u/M.Yaqoob)\
**Post date:** [March 11, 2021, 7:17am UTC](https://forum.digikey.com/t/utilizing-the-build-analyzer-in-stm32cubeide/3882/2 "2021-03-11T07:17:52Z")

</div>

Hi,  
To fix this permanently, you need to have your .map file name similar to your .elf file name.  
In your example,  
elf file name = STM32L476RG\_NUCLEO.elf  
map file name = ST\_test.map

You can force your .map file name to STM32L476RG\_NUCLEO.map by following these steps:

1. Go to Properties\>\>C/C++ Build \>\> Settings \>\> Tool Settings \>\> MCU GCC Linker \>\> Miscellaneous
2. Add the following flag: -Wl,-Map=STM32L476RG\_NUCLEO.map

Enjoy

---

<div class="post-metadata">

**Author:** ![Matt\_Mielke](https://sea2.discourse-cdn.com/digikey/user_avatar/forum.digikey.com/matt_mielke/32/71373_2.png) [@Matt\_Mielke](https://forum.digikey.com/u/Matt_Mielke)\
**Post date:** [March 11, 2021, 6:33pm UTC](https://forum.digikey.com/t/utilizing-the-build-analyzer-in-stm32cubeide/3882/3 "2021-03-11T18:33:24Z")

</div>

Great tip!! Thanks for the contribution! 😀

---

<div class="post-metadata">

**Author:** ![wgoebel](https://avatars.discourse-cdn.com/v4/letter/w/e9a140/32.png) [@wgoebel](https://forum.digikey.com/u/wgoebel)\
**Post date:** [February 3, 2022, 12:57pm UTC](https://forum.digikey.com/t/utilizing-the-build-analyzer-in-stm32cubeide/3882/4 "2022-02-03T12:57:25Z")

</div>

ST Build analyzer is sometimes showing wrong usage in case selecting the map file;  
in my case I have several build configurations (debug / release, device specific) in the same project, build analyzer tab  
often shows wrong information (although map/elf file name are identical). Selecting the elf file of the selected build configuration usually works best.

---

<div class="post-metadata">

**Author:** ![Jenny\_1307](https://avatars.discourse-cdn.com/v4/letter/j/c67d28/32.png) [@Jenny\_1307](https://forum.digikey.com/u/Jenny_1307)\
**Post date:** [February 3, 2022, 5:22pm UTC](https://forum.digikey.com/t/utilizing-the-build-analyzer-in-stm32cubeide/3882/5 "2022-02-03T17:22:57Z")

</div>

Hello wgoebel, welcome to the Forum!

I have sent your question to our Product Specialist and as soon as I have his reply, I will relay it to you here.  
Thanks!
