列出二进制文件的内存映像大小。
size [-A|-B|-G|--format=compatibility]
[--help]
[-d|-o|-x|--radix=number]
[--common]
[-t|--totals]
[--target=bfdname] [-V|--version]
[objfile...]
elf32-littlearm elf32-littlearm-fdpic elf32-bigarm elf32-bigarm-fdpic elf32-little elf32-big srec symbolsrec verilog tekhex binary ihex plugin
arm-none-eabi-size main.o
arm-none-eabi-size app.elf
[-d|-o|-x|--radix=number]
arm-none-eabi-size -x ./build/app.elf
输出方式 | 选项缩写 | 选项详细表示 |
---|---|---|
类似 System V | -A | –format=sysv |
Berkeley size | -B | –format=berkeley |
GNU size | -G | –format=gnu |
默认输出选项是 -B 即 berkeley 方式。
arm-none-eabi-size -A -x ./build/app.elf
./build/app.elf :
section size addr
.isr_vector 0x1e4 0x8000000
.text 0x4694 0x80001e4
.rodata 0x9c 0x8004878
.init_array 0x4 0x8004914
.fini_array 0x4 0x8004918
.data 0xdc 0x20000000
.bss 0xd18 0x200000e0
._user_heap_stack 0x600 0x20000df8
.ARM.attributes 0x29 0x0
.comment 0xa7 0x0
.debug_info 0x1835c 0x0
.debug_abbrev 0x3dd7 0x0
.debug_loc 0xb0d9 0x0
.debug_aranges 0xbf8 0x0
.debug_ranges 0xe88 0x0
.debug_line 0xb221 0x0
.debug_str 0x3dd5 0x0
.debug_frame 0x1bbc 0x0
Total 0x3f61e
如上所示,详细列出了向量表、text、rodata、data、bss、_user_heap_stack 等段的起始地址和size。
arm-none-eabi-size -B -x ./build/app.elf
text data bss dec hex filename
0x4914 0xe4 0x1318 23824 5d10 ./build/app.elf
arm-none-eabi-size -G -x ./build/app.elf
text data bss total filename
0x4694 0x364 0x1318 0x5d10 ./build/app.elf