build_memory_info: Report used, free, and total memory

.. intead of just free and total as before.
This commit is contained in:
Jeff Epler 2020-04-27 15:43:13 -05:00
parent 7eff89e9f9
commit 1efa7076b0
1 changed files with 6 additions and 4 deletions

View File

@ -66,10 +66,12 @@ for region in regions:
firmware_region = regions["FLASH_FIRMWARE"]
ram_region = regions["RAM"]
free_flash = firmware_region - text - data
free_ram = ram_region - data - bss
print("{} bytes free in flash firmware space out of {} bytes ({}kB).".format(free_flash, firmware_region, firmware_region / 1024))
print("{} bytes free in ram for stack and heap out of {} bytes ({}kB).".format(free_ram, ram_region, ram_region / 1024))
used_flash = data + text
free_flash = firmware_region - used_flash
used_ram = data + bss
free_ram = ram_region - used_ram
print("{} bytes used, {} bytes free in flash firmware space out of {} bytes ({}kB).".format(used_flash, free_flash, firmware_region, firmware_region / 1024))
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))
print()
# Check that we have free flash space. GCC doesn't fail when the text + data