Fixes printsizes.py to show .rodata usage.

This commit is contained in:
Travis Goodspeed 2019-05-17 11:21:29 -04:00
parent 24cb908cb5
commit 2ad4832858

View File

@ -23,10 +23,12 @@ def printsizes(stream):
text=elffile.get_section_by_name('.text'); text=elffile.get_section_by_name('.text');
textlen=len(text.data()); textlen=len(text.data());
codeperc=textlen*100.0/32768; rodata=elffile.get_section_by_name('.rodata');
print("\t%d bytes of .text (%d %%)" % (textlen,codeperc)); rodatalen=len(rodata.data());
if codeperc>80: codeperc=(textlen+rodatalen)*100.0/32768;
print("WARNING: %d percent of code is used!"%codeperc); print("\t%d bytes of .text, %d bytes of .rodata (%d%% Flash)" % (textlen,rodatalen,codeperc));
if codeperc>90:
print("WARNING: %d percent of Flash is used!"%codeperc);
datalen=0; datalen=0;
bsslen=0; bsslen=0;
@ -42,7 +44,7 @@ def printsizes(stream):
dataperc=(datalen+bsslen+noinitlen)*100.0/4096; dataperc=(datalen+bsslen+noinitlen)*100.0/4096;
if datalen+bsslen+noinitlen>0: if datalen+bsslen+noinitlen>0:
print("\t%d bytes of .data, %d bytes of .bss, %d bytes of .noinit (%d %%)" print("\t%d bytes of .data, %d bytes of .bss, %d bytes of .noinit (%d%% RAM)"
%(datalen,bsslen,noinitlen,dataperc)); %(datalen,bsslen,noinitlen,dataperc));
if dataperc>80: if dataperc>80:
print("WARNING: %d percent of data is used!"%dataperc); print("WARNING: %d percent of data is used!"%dataperc);