Skip to content

Commit a719fab

Browse files
committed
Shrink bluemicro833 build
1 parent 00dcf6b commit a719fab

File tree

2 files changed

+54
-0
lines changed

2 files changed

+54
-0
lines changed

ports/nrf/boards/bluemicro833/mpconfigboard.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ CIRCUITPY_RGBMATRIX = 0
3737
CIRCUITPY_SDCARDIO = 0
3838
CIRCUITPY_SYNTHIO = 0
3939
CIRCUITPY_TOUCHIO = 0
40+
CIRCUITPY_TRACEBACK = 0
4041
CIRCUITPY_ULAB = 0
4142
CIRCUITPY_USB_MIDI = 0
4243
CIRCUITPY_VECTORIO = 0

tools/diff_nm_sizes.py

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
"""This script diffs two dumps of symbol sizes by matching up the symbol names
2+
3+
To generate the input files do something like:
4+
5+
arm-none-eabi-nm --size-sort build-bluemicro833/firmware.elf > new_sizes.txt
6+
7+
The command will vary by board and along with git state.
8+
9+
To print the diff do:
10+
11+
python diff_nm_sizes.py old_sizes.txt new_sizes.txt
12+
"""
13+
14+
import sys
15+
import pathlib
16+
17+
old = pathlib.Path(sys.argv[-2])
18+
new = pathlib.Path(sys.argv[-1])
19+
old_symbols = {}
20+
old_total_size = 0
21+
longest_symbol = 0
22+
for line in old.read_text().split("\n"):
23+
if not line:
24+
continue
25+
size, t, name = line.split()
26+
old_size = int(size, 16)
27+
old_total_size += old_size
28+
old_symbols[name] = old_size
29+
longest_symbol = max(longest_symbol, len(name))
30+
31+
new_total_size = 0
32+
for line in new.read_text().split("\n"):
33+
if not line:
34+
continue
35+
size, t, name = line.split()
36+
size = int(size, 16)
37+
new_total_size += size
38+
if name not in old_symbols:
39+
print(f"{name:<{longest_symbol}}{size:>+6}")
40+
else:
41+
old_size = old_symbols[name]
42+
del old_symbols[name]
43+
if size == old_size:
44+
continue
45+
print(f"{name:<{longest_symbol}}{size - old_size:>+6}")
46+
47+
for name in old_symbols:
48+
old_size = old_symbols[name]
49+
print(f"{name:<{longest_symbol}}{-old_size:>+6}")
50+
51+
print()
52+
total_label = f"Total {new_total_size} - {old_total_size}"
53+
print(f"{total_label:<{longest_symbol}}{new_total_size - old_total_size:>+6}")

0 commit comments

Comments
 (0)