forked from tenbaht/sduino
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstat.awk
More file actions
executable file
·32 lines (25 loc) · 902 Bytes
/
stat.awk
File metadata and controls
executable file
·32 lines (25 loc) · 902 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/usr/bin/gawk -f
# text data bss dec hex filename
# 0 4673 0 4673 1241 build-stm8sblue/libmake.ihx
/ [ls]_/ {
v=strtonum("0x"$1);
type=substr($2,1,1);
name=substr($2,3);
arr[name][type]=v;
# print v,type,name,$0
}
END {
bss = arr["DATA"]["l"]+arr["INITIALIZED"]["l"];
rom = arr["CODE"]["l"]+arr["INITIALIZER"]["l"];
for (n in arr)
print arr[n]["l"] "\t" n;
# print n, arr[n]["s"],arr[n]["l"];
print "memory usage statics"
print "--------------------"
print "RAM:\t\t" arr["DATA"]["l"]+arr["INITIALIZED"]["l"];
print "Flash:\t\t" arr["CODE"]["l"]+arr["INITIALIZER"]["l"];
for (n in arr) printf("%s\t",n);
for (n in arr) print arr[n]["l"] "\t";
print " text\t data\t bss\t dec\t hex\tfilename";
printf ("%7i\t%7i\t%7i\t%7i\t%7x\t%s\n",0,rom,bss,rom,rom,FILENAME);
}