Listing Code and Data Size with GNU nm in Eclipse

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:

Symbol Viewer in MCUXpresso IDE

Symbol Viewer in MCUXpresso IDE

One way to use that view is to use the context menu on the .elf/.axf file:

View Symbols

View Symbols

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:

Symbols of object file

Symbols of object file

You can generate that kind of information using the ‘nm’ command, e.g.

arm-none-eabi-nm -S --size-sort -s MyBinary.axf

nm command line output

nm command line output

💡 Alternatively, have a look at the ‘Map File Browser’: http://www.sikorskiy.net/prj/amap/

Happy Sizing 🙂

Links

 

9 thoughts on “Listing Code and Data Size with GNU nm in Eclipse

  1. Pingback: Listing Code and Data Size for each Source File with GNU and Eclipse | MCU on Eclipse

  2. Pingback: Listing Code and Data Size for all Files with the GNU size Utility in a Post-Build Action | MCU on Eclipse

What do you think?

This site uses Akismet to reduce spam. Learn how your comment data is processed.