The map file produced by the GNU linker includes lots of information, however it is very cryptic to read. In “Listing Code and Data Size for each Source File with GNU and Eclipse” I showed how the GNU size utility can be used to report the code and data size for each object file. The Eclipse based MCUXpresso IDE comes with another nice view which shows detailed information about code and data allocation:
One way to use that view is to use the context menu on the .elf/.axf file:
Using it on the linked binary shows all the variables (symbols) allocated in it, and I can sort the names/addresses/etc.
I can use it on an archive/library file or single object file too:
You can generate that kind of information using the ‘nm’ command, e.g.
arm-none-eabi-nm -S --size-sort -s MyBinary.axf
💡 Alternatively, have a look at the ‘Map File Browser’: http://www.sikorskiy.net/prj/amap/
Happy Sizing 🙂
- Listing Code and Data Size for each Source File with GNU and Eclipse
- MCUXpresso IDE: http://www.nxp.com/mcuxpresso/ide
- GNU nm command: https://sourceware.org/binutils/docs/binutils/nm.html
- Map File Browser: http://www.sikorskiy.net/prj/amap/