Skip to content

Commit 1efa707

Browse files
committed
build_memory_info: Report used, free, and total memory
.. intead of just free and total as before.
1 parent 7eff89e commit 1efa707

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

tools/build_memory_info.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,12 @@
6666
firmware_region = regions["FLASH_FIRMWARE"]
6767
ram_region = regions["RAM"]
6868

69-
free_flash = firmware_region - text - data
70-
free_ram = ram_region - data - bss
71-
print("{} bytes free in flash firmware space out of {} bytes ({}kB).".format(free_flash, firmware_region, firmware_region / 1024))
72-
print("{} bytes free in ram for stack and heap out of {} bytes ({}kB).".format(free_ram, ram_region, ram_region / 1024))
69+
used_flash = data + text
70+
free_flash = firmware_region - used_flash
71+
used_ram = data + bss
72+
free_ram = ram_region - used_ram
73+
print("{} bytes used, {} bytes free in flash firmware space out of {} bytes ({}kB).".format(used_flash, free_flash, firmware_region, firmware_region / 1024))
74+
print("{} bytes used, {} bytes free in ram for stack and heap out of {} bytes ({}kB).".format(used_ram, free_ram, ram_region, ram_region / 1024))
7375
print()
7476

7577
# Check that we have free flash space. GCC doesn't fail when the text + data

0 commit comments

Comments
 (0)