ROM management problems

Hi all,
I’m using an STM Nucleo L073RZ board to design a temperature controller with several features (PID, auto-tuning, USBSerial communication, display+keypad controls, internal storage to store some parameters,…) using code published by third party authors and the Mbed studio app to code it.
I just finished to write the first version of the code (I still don’t have the MCU in my hands, so I could not test each feature separately), next step is to debug it.
I tried to build it with the “debug” default profile, but I got several (~650) “L6406E: No space in execution regions with .ANY selector matching foo.o”.
I switched to the “develop” version then, and I could barely compile it (192770 bytes/192Kbytes used). Since I compiled it, I could have several files, including the map memory report (here you can find the pastebin copy of it).
From such report we can see that the largest part of my memory is taken by the mbed OS (72251 bytes) and a library called [lib] (92581 bytes).
Is it normal to have so much space occupied by these standard libraries? Any tip to free it (i.e. a decent explanation about how to use the bare metal version instead of the full one)?

Also, do any of you know what is that library [lib]?

Thanks in advance,

If you are not using RTOS features, one easy thing you can do is use the bare metal profile, see here for instructions to enable it.

Which tool did you use to generate that memory map report? Didn’t know of this one, looks very good.

As you correctly said, and as visible in its submodules in the report, “lib” is the standard library. It gets linked module-wise into the binary as you use it in your code. Some modules take a huge amount of ROM. Your report indicates that the “locale” module is taking the most space. You must check which standard library calls are using that module and try to remove it. You could try to build without the standard library (-nostdlib option) to see which parts of the code are using it.

Yeah, I found that guide already. But at point 1.4 it say tom open the mbed_app.json file that I can’t find in my project folder, so, well, I cannot really proceed further with such guide.

I’m using the Mbed studio desktop app with default settings (develop build profile). This is the first time I’m programming an ARM MCU (before I used ATMEL, Freescale and Arduino hardwares and softwares), so I tried to pick up the “newbie”/suggested resources.

Also, since you suggested that, do you know how I’m supposed to add your option (-nostdlib) to the profile I’m using? If there is an option to modify them is very counter intuitive…

Just create mbed_app.json file in the root of your program.
Anyway you are right, it could be Open/Create… than just Open…

BR, Jan

Ok, tomorrow I will try. Thanks for the tip!

I have seen that before, it’s the html output format from in Mbed. Personally I find it very hard to read…

1 Like

Yeah I guess the chart generated by GitHub - ARMmbed/mbed-os-linker-report: Post-processing of linker output to calculate and visualize memory usage for elf-sections is more useful. is unfortunately not accurate though…