Why i have a diffrence between code size in arm-none-eabi-size, output.map file and arm-none-eabi-nm?

Viewed 1428

In my ARM STM32 project(Eclipse and Gcc) output of command arm-none-eabi-size is

   text    data     bss     dec     hex filename
 103784     232   75064  179080   2bb88 project.elf

To check code size I tried also diffrent approach. I have opened output.map, analyzed it and sumed up .text section, .bss section, .data section etc. Suprisingly I've received diffrent code summary

# Sections :
-----------------------
comment  :  8323  bytes.
igot  :  0  bytes.
debug_ranges  :  17208  bytes.
text  :  277702  bytes.
rodata  :  6048  bytes.
eh_frame  :  4  bytes.
fini  :  12  bytes.
iplt  :  0  bytes.
debug_frame  :  76068  bytes.
group  :  29528  bytes.
jcr  :  4  bytes.
debug_line  :  518087  bytes.
debug_macro  :  4878468  bytes.
init  :  12  bytes.
rel  :  0  bytes.
fini_array  :  8  bytes.
debug_str  :  13228775  bytes.
debug_info  :  334376  bytes.
preinit_array  :  0  bytes.
bss  :  143413  bytes.
debug_abbrev  :  52355  bytes.
isr_vector  :  912  bytes.
data  :  451  bytes.
init_array  :  8  bytes.
debug_aranges  :  8248  bytes.

So my third approach was to check code size based on arm-none-eabi-eabi-nm -S --size-sort --radix=d project.elf output. I've sumed each 'tT', 'dD', 'wW' etc. sections and results are third time diffrent than arm-none-eabi-size and output.map.

Who to belive? How to read these files(project.elf, output.map) to have real code size, memory usage etc. Maybe there is another way to achive this. I mean for example analyze binary file project.bin?

P.S. Probably you think what i want to achive. My company want to add new library to project. I have to check how much binary file will be bigger with these library and check memory usage, static and dynamic allocation. I need to have reliable results of code sections size to check it.

0 Answers
Related