Skip to content

Commit

Permalink
[tools] Display total RAM/ROM size in size tool
Browse files Browse the repository at this point in the history
  • Loading branch information
salkinium committed Aug 17, 2022
1 parent b0728f3 commit cd3113f
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions tools/modm_tools/size.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@
"[{'name': 'flash', 'access': 'rx', 'start': 134217728, 'size': 65536}, \\
{'name': 'sram1', 'access': 'rwx', 'start': 536870912, 'size': 20480}]"
Program: 1.4 KiB (2.2% used)
Program: 1.4 KiB / 64.0 KiB (2.2% used)
(.build_id + .fastcode + .fastdata + .hardware_init + .rodata +
.table.copy.intern + .table.heap + .table.zero.intern + .text + .vector_rom)
Data: 3.0 KiB (15.1% used) = 20 B static (0.1%) + 3072 B stack (15.0%)
Data: 3.0 KiB / 20.0 KiB (15.1% used) = 20 B static (0.1%) + 3072 B stack (15.0%)
(.bss + .fastdata + .stack)
Heap: 17.0 KiB (84.9% available)
Heap: 17.0 KiB / 20.0 KiB (84.9% available)
(.heap1)
```
Expand All @@ -42,13 +42,13 @@


TEMPLATE_SIZE = """\
Program: {rom_fmt:>9s} ({rom_p:2.1f}% used)
Program: {rom_fmt:>9s} / {rom_total:>9s} ({rom_p:2.1f}% used)
({rom_s})
Data: {ram_fmt:>9s} ({ram_p:2.1f}% used) = {static} B static ({static_p:2.1f}%) + {stack} B stack ({stack_p:2.1f}%)
Data: {ram_fmt:>9s} / {ram_total:>9s} ({ram_p:2.1f}% used) = {static} B static ({static_p:2.1f}%) + {stack} B stack ({stack_p:2.1f}%)
({ram_s})
Heap: {heap_fmt:>11s} ({heap_p:2.1f}% available)
Heap: {heap_fmt:>11s} / {ram_total:>9s} ({heap_p:2.1f}% available)
({heap_s})
"""

Expand Down Expand Up @@ -139,6 +139,8 @@ def is_in_memory(name):
output = TEMPLATE_SIZE.format(ram_fmt=human_readable_format(subs["ram"]),
rom_fmt=human_readable_format(subs["rom"]),
heap_fmt=human_readable_format(subs["heap"]),
ram_total=human_readable_format(ram),
rom_total=human_readable_format(flash),
**subs)
return output

Expand Down

0 comments on commit cd3113f

Please sign in to comment.