Skip to content

Instantly share code, notes, and snippets.

@doegox
Created July 18, 2019 20:41
Show Gist options
  • Save doegox/4dace4170c96e9516b69f3ea683000d1 to your computer and use it in GitHub Desktop.
Save doegox/4dace4170c96e9516b69f3ea683000d1 to your computer and use it in GitHub Desktop.
Crappy script to get some stats on Proxmark3 FW
proxmark3-RRG.git$ ./show-sizes.sh
Bootphase1 @00000: 512/512
Bootphase2 @00200: 3488/7680 = 45.4167%
Text+Data @02000: 234576/253952 = 92.3702%
234576/516096 = 45.452%
10 largest .text:
=================
text data bss dec hex filename
21339 166 132 21637 5485 armsrc/obj/iso14443a.o
17670 3 1057 18730 492a armsrc/obj/mifarecmd.o
13790 0 327 14117 3725 armsrc/obj/hitagS.o
13755 377 50 14182 3766 armsrc/obj/mifaresim.o
13445 20 1 13466 349a armsrc/obj/lfdemod.o
12167 15 82 12264 2fe8 armsrc/obj/iclass.o
11543 0 0 11543 2d17 armsrc/obj/aes.o
10790 10 0 10800 2a30 armsrc/obj/lfops.o
9748 19 8 9775 262f armsrc/obj/appmain.o
8290 76 45 8411 20db armsrc/obj/hitag2.o
10 largest .data:
=================
text data bss dec hex filename
0 38207 0 38207 953f armsrc/obj/fpga_all.o
13755 377 50 14182 3766 armsrc/obj/mifaresim.o
21339 166 132 21637 5485 armsrc/obj/iso14443a.o
8290 76 45 8411 20db armsrc/obj/hitag2.o
13445 20 1 13466 349a armsrc/obj/lfdemod.o
9748 19 8 9775 262f armsrc/obj/appmain.o
12167 15 82 12264 2fe8 armsrc/obj/iclass.o
3575 13 82 3670 e56 armsrc/obj/usb_cdc.o
952 12 2067 3031 bd7 armsrc/obj/usart.o
2088 12 0 2100 834 armsrc/obj/lfsampling.o
10 largest .bss:
================
text data bss dec hex filename
981 3 40008 40992 a020 armsrc/obj/BigBuf.o
952 12 2067 3031 bd7 armsrc/obj/usart.o
17670 3 1057 18730 492a armsrc/obj/mifarecmd.o
1644 0 514 2158 86e armsrc/obj/crc16.o
13790 0 327 14117 3725 armsrc/obj/hitagS.o
4746 10 300 5056 13c0 armsrc/obj/felica.o
2331 0 223 2554 9fa armsrc/obj/epa.o
21339 166 132 21637 5485 armsrc/obj/iso14443a.o
3575 13 82 3670 e56 armsrc/obj/usb_cdc.o
12167 15 82 12264 2fe8 armsrc/obj/iclass.o
#!/bin/bash
( objdump -h bootrom/obj/bootrom.elf;objdump -h armsrc/obj/fullimage.elf )|gawk '
/\.bootphase1/{b1=strtonum("0x"$3)}
/\.bootphase2/{b2=strtonum("0x"$3)}
/\.text/{t=strtonum("0x"$3)}
/\.data/{d=strtonum("0x"$3)}
END{
print "Bootphase1 @00000: " b1"/"(0x200)
print "Bootphase2 @00200: " b2"/"(0x2000-0x200) "\t\t= " b2/(0x2000-0x200)*100"%"
print "Text+Data @02000: " t+d"/"(0x40000-0x2000) "\t= " (t+d)/(0x40000-0x2000)*100"%"
print " " t+d"/"(0x80000-0x2000) "\t= " (t+d)/(0x80000-0x2000)*100"%"}
'
echo
echo "10 largest .text:"
echo "================="
echo " text data bss dec hex filename"
LANG=C arm-none-eabi-size armsrc/obj/*.o |grep -v fullimage|tail -n+2|sort -k1 -n -r|head -n10
echo
echo "10 largest .data:"
echo "================="
echo " text data bss dec hex filename"
LANG=C arm-none-eabi-size armsrc/obj/*.o |grep -v fullimage|tail -n+2|sort -k2 -n -r|head -n10
echo
echo "10 largest .bss:"
echo "================"
echo " text data bss dec hex filename"
LANG=C arm-none-eabi-size armsrc/obj/*.o |grep -v fullimage|tail -n+2|sort -k3 -n -r|head -n10
#| awk 'NR==1 {line =$0; next} 1; END{print line}'|tac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment