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 🙂
Links
- 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/
I recommend Map File Browser
http://www.sikorskiy.net/prj/amap/
LikeLike
Oh, that’s indeed a nice one! Thanks for sharing.
LikeLike
Cool little feature Erich. I had been using a GUI app from here for the same purpose:
https://github.com/govind-mukundan/MapViewer
Seems like everyone has their own favourite !! 🙂
LikeLike
Oh, yet another one! Nice! 🙂
LikeLike
mmh it does not seems available for eclipse Neon CDT 😦
LikeLike
No, the view is not part of Neon (unfortunately). It is part of the NXP MCUXpresso IDE. But the same information can be retrieved using the GNU nm command too.
LikeLike
Thanks and its quite useful!
LikeLike
Pingback: Listing Code and Data Size for each Source File with GNU and Eclipse | MCU on Eclipse
Pingback: Listing Code and Data Size for all Files with the GNU size Utility in a Post-Build Action | MCU on Eclipse