edu
edu

Reputation: 161

GCC tool for size analysis?

I develop for embedded platforms by using GCC (arm-none-eabi-gcc). For size analysis, I use: arm-none-eabi-size and the .map file.

Because I'm having problems about size of my code, my question is: Is there any tool for size analysis more powerful? Any with statisticts or size by files? Or with the possibility to order functions by size?

Any suggestion will be welcome.

Upvotes: 6

Views: 9157

Answers (2)

j123b567
j123b567

Reputation: 3439

You can use arm-none-eabi-objdump -t Application.elf. It will show you the size of all functions and global variables (as hex number).

address    type section size     name
------------------------------------------------
0000d600 l     F .text  00000198 uip_arp_update

Global variables are in .bss section, functions are in .text section and constant data is in .data section.

You can also use arm-none-eabi-size *.o in appropriate directory to see sizes of all intermediate files.

It is also possible to use nm tool

arm-none-eabi-nm -t d -S --size-sort Application.elf


It is also usefull to use -ffunction-sections -fdata-sections as compile parameter and -Wl,--gc-sections as linker parameter so it will delete all unused functions and data from your binary.

Upvotes: 10

You could customize your GCC with MELT for that purpose.

The justcountipa pass in the xtramelt-ana-simple.melt file is doing something similar (count the Gimple instructions in functions)

Upvotes: 1

Related Questions