This repository was archived by the owner on Jun 26, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathbinsize.py
More file actions
executable file
·69 lines (53 loc) · 1.99 KB
/
binsize.py
File metadata and controls
executable file
·69 lines (53 loc) · 1.99 KB
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/usr/bin/env python
from subprocess import Popen, PIPE
class app(object):
def __init__(self):
pass
motolink = app()
motolink.name = "MotoLink"
motolink.path = "app/build/motolink.elf"
motolink.max_ccm = 8*1024
motolink.max_ram = 40*1024
motolink.max_rom = 192*1024
bootloader = app()
bootloader.name = "BootLoader"
bootloader.path = "bootloader/build/bootloader.elf"
bootloader.max_ccm = 8*1024
bootloader.max_ram = 40*1024
bootloader.max_rom = 64*1024
APPS = [motolink, bootloader]
for app in APPS:
ccm = 0
ram = 0
rom = 0
p = Popen(["arm-none-eabi-size", "-A", app.path], stdout=PIPE)
if p.wait() == 0:
output = p.stdout.read()
lines = filter(None, output.split("\n"))
for line in lines:
columns = filter(None, line.split(" "))
if ".stacks" in columns[0]:
ram += int(columns[1])
elif ".ram4" in columns[0]:
ccm += int(columns[1])
rom += int(columns[1])
elif ".bss" in columns[0]:
ram += int(columns[1])
elif ".data" in columns[0]:
ram += int(columns[1])
rom += int(columns[1])
elif ".text" in columns[0]:
rom += int(columns[1])
elif ".startup" in columns[0]:
rom += int(columns[1])
print ""
print app.name
print "CCM used: {}% - {:4.1f}/{}k".format((ccm*100)/app.max_ccm,
ccm/1024.0,
app.max_ccm/1024.0)
print "RAM used: {}% - {:4.1f}/{}k".format((ram*100)/app.max_ram,
ram/1024.0,
app.max_ram/1024.0)
print "ROM used: {}% - {:4.1f}/{}k".format((rom*100)/app.max_rom,
rom/1024.0,
app.max_rom/1024.0)