Debug and Release code sizes

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Debug and Release code sizes

623 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by JohnR on Mon Nov 01 09:11:18 MST 2010
I am trying to understand Debug and Release sizes, both as reported by the compiler and what is shown in Windows Explorer. The application SimpleDemo uses the FreeRTOS_Library, LPC13xx_Lib and libCMSISv1p30_LPC13xx
with sizes as shown by the compiler and then the corresponding size on disk

SimpleDemo.axf: Debug   
text    data     bss     dec     hex filename
7788     532    2344   10664    29a8 SimpleDemo.axf
On disk: SimpleDemo.axf  333 KB
SimpleDemo.axf: Release
   text    data     bss     dec     hex filename
   7244     532    2344   10120    2788 SimpleDemo.axf
On disk: SimpleDemo.axf  114KB

FreeRTOS_Library - Debug
arm-none-eabi-gcc -D__REDLIB__ -DDEBUG
   text    data     bss     dec     hex filename
    168       0       0     168      a8 list.o (ex libFreeRTOS_Library.a)
   1256       0       0    1256     4e8 queue.o (ex libFreeRTOS_Library.a)
   3180       0     256    3436     d6c tasks.o (ex libFreeRTOS_Library.a)
    304       4    2072    2380     94c heap_2.o (ex libFreeRTOS_Library.a)
    368       4       0     372     174 port.o (ex libFreeRTOS_Library.a)
     92       0      50     142      8e basic_io.o (ex libFreeRTOS_Library.a)
     24       0       0      24      18 consoleprint.o (ex libFreeRTOS_Library.a)
On disk: libFreeRTOS_Library.a  260KB
FreeRTOS_Library - Release
arm-none-eabi-gcc -D__REDLIB__ -DNDEBUG
   text    data     bss     dec     hex filename
    168       0       0     168      a8 list.o (ex libFreeRTOS_Library.a)
   1256       0       0    1256     4e8 queue.o (ex libFreeRTOS_Library.a)
   3180       0     256    3436     d6c tasks.o (ex libFreeRTOS_Library.a)
    304       4    2072    2380     94c heap_2.o (ex libFreeRTOS_Library.a)
    368       4       0     372     174 port.o (ex libFreeRTOS_Library.a)
     92       0      50     142      8e basic_io.o (ex libFreeRTOS_Library.a)
     24       0       0      24      18 consoleprint.o (ex libFreeRTOS_Library.a)
On disk: libFreeRTOS_Library.a  39KB

LPC13xx_Lib Debug
arm-none-eabi-size libFreeRTOS_Library.a ; # arm-none-eabi-objdump -h -S libFreeRTOS_Library.a >libFreeRTOS_Library.lss
   text    data     bss     dec     hex filename
    160       0       0     160      a0 clkconfig.o (ex libLPC13xx_Lib.a)
   1708       0       0    1708     6ac gpio.o (ex libLPC13xx_Lib.a)
    536       0       0     536     218 timer16.o (ex libLPC13xx_Lib.a)
    552       0       0     552     228 timer32.o (ex libLPC13xx_Lib.a)
    568       1       4     573     23d uart.o (ex libLPC13xx_Lib.a)
On disk: LPC13xx_Lib 180 KB

LPC13xx_Lib Release
arm-none-eabi-size libFreeRTOS_Library.a ; # arm-none-eabi-objdump -h -S libFreeRTOS_Library.a >libFreeRTOS_Library.lss
   text    data     bss     dec     hex filename
    128       0       0     128      80 clkconfig.o (ex libLPC13xx_Lib.a)
   1208       0       0    1208     4b8 gpio.o (ex libLPC13xx_Lib.a)
    504       0       0     504     1f8 timer16.o (ex libLPC13xx_Lib.a)
    520       0       0     520     208 timer32.o (ex libLPC13xx_Lib.a)
    476       1       4     481     1e1 uart.o (ex libLPC13xx_Lib.a)
On disk: LPC13xx_Lib 181 KB

On disk: Debug  libCMSISv1p30_LPC13xx.a 58Kb
On disk: Release libCMSISv1p30_LPC13xx.a 53Kb

I don't understand why the compiler shows exactly the same size for both Release and Debug versions of the FreeRTOS_Library, while Explorer reports quite different values. Also if I add the individual sizes of the 4 components of this application, the sum again does not match the Explorer value for the size of the executable.
I must be missing something stupid so any help would be appreciated.
John.
0 Kudos
Reply
3 Replies

594 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by CodeRedSupport on Mon Nov 01 11:20:40 MST 2010
No ELF/DWARF information is downloaded.

The arm-none-eabi-size command lists the real sizes of your text (code) data (data) and zero-init (bss) data. Only text and data are downloaded.
0 Kudos
Reply

594 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by JohnR on Mon Nov 01 10:10:47 MST 2010
Thanks for the reply. I had actually recently downloaded the DWARF info you suggested.

I did understand that the DWARF data was included in the ELF file but what I did not realise that almost the same amount of DWARF data seemed to be included in both release and debug map files.

How much actually gets downloaded to the chip?

John.
0 Kudos
Reply

594 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by CodeRedSupport on Mon Nov 01 09:25:29 MST 2010
The size of the file on disk bears little resemblance to the amount of code/data in your application.
An executable "axf" file is a ELF(DWARF) format file.
A library is an "ar" format file, containig object files of ELF(DWARF) format.

Google for ELF/DWARF for more information on these formats.

(very) Simply, as well as your code/data, the file also contains symbol information about your executable. If it was built for debug, then it will also include all the Debug information too. In most cases, this completely dwarfs (no pun intended) the amount of code/data in your executable
0 Kudos
Reply