Printing Code Size Information in Eclipse

For the GNU ARM tools it is easy to print out the code and date size information, see

But this is all for ARM cores. What if I use other architectures like S08 or ColdFire in Eclipse?

Code Size Information in Build Console

Code Size Information in Build Console

GNU Size Tool

The solution is to use the ‘size’ tool which is part of the GNU tool chain. If you are using CodeWarrior for MCU, then it gets installed as part of the ARM toolchain. If you are using a different GNU toolchain, then very likely you have this tool already installed. The ‘size’ tool reports the size of the objects and section sizes in a (ELF/Dwarf) file.

Post-Build Step

To have the size printed at the end of each build, I’m adding it as ‘post-build-step’ to the build settings. For this I go into the project properties (select the project, menu Project > Properties). Then go into C/C++ Build > Settings and select the ‘Build Steps’ tab. There I call the ‘size’ command for the output file of the linker:

Post Build Step to print the size

Post Build Step to print the size

I’m using this command:

"${ARM_GNU_TOOLS_HOME}/bin/arm-none-eabi-size"  --format=berkeley ${BuildArtifactFileName}

In my Eclipse, the variable ‘ARM_GNU_TOOLS_HOME’ points to where I have the GNU tools installed. Inside the bin folder, I call the ‘size’ program (or size.exe): the name depends on GNU tool chain installed, or you can point to the generic ‘size’ command.

The –format option specifies the output format for the size information. The last option is the output file of my linker, and here I’m using again a variable.

Console Output

With this, it reports at the end of the build process the code/data size, such as:

C:/Freescale/CW MCU v10.6/gnu/bin/mingw32-make --no-print-directory post-build
"C:\Freescale\CW MCU v10.6\eclipse\../Cross_Tools/arm-none-eabi-gcc-4_7_3/bin/arm-none-eabi-size"  --format=berkeley SRB_Master.abs
   text       data        bss        dec        hex    filename
  17153          0       2664      19817       4d69    SRB_Master.abs

Happy Sizing 🙂

14 thoughts on “Printing Code Size Information in Eclipse

  1. Erich,

    Back in the old Classic CodeWarrior, the left most panel listed all the files in a project, and how much ROM and RAM memory they used up. This was very handy, especially when using the smaller 9S08 or ColdFire 1 MCUs.


    Is it possible to get that info out of the newer Eclipse based CodeWarrior?


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

  3. Pingback: Tutorial: How to Erase the FLASH with the GNU debugger | MCU on Eclipse

  4. Pingback: Code Coverage for Embedded Target with Eclipse, gcc and gcov | MCU on Eclipse

What do you think?

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

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