diff options
| author | Dan Halbert <halbert@halwitz.org> | 2019-12-10 17:57:17 -0500 |
|---|---|---|
| committer | Dan Halbert <halbert@halwitz.org> | 2019-12-10 20:27:30 -0500 |
| commit | 013c84086288141696e4c09250c61b6f2dbdf4d2 (patch) | |
| tree | f636b74008cc4b5a0745c9e2111ed40b68b52777 /tools | |
| parent | d628d2a261bb28b84c6b257a990bd9a30cbe369c (diff) | |
working on all ports
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/build_memory_info.py | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/tools/build_memory_info.py b/tools/build_memory_info.py index f128561ab..afe49650e 100644 --- a/tools/build_memory_info.py +++ b/tools/build_memory_info.py @@ -41,7 +41,8 @@ data = 0 bss = 0 # stdin is the linker output. for line in sys.stdin: - print(line) + # Uncomment to see linker output. + # print(line) line = line.strip() if not line.startswith("text"): text, data, bss = map(int, line.split()[:3]) @@ -51,7 +52,7 @@ regions = {} with open(sys.argv[1], "r") as f: for line in f: line = line.strip() - if line.startswith(("FLASH_FIRMWARE", "RAM")): + if line.startswith(("FLASH_FIRMWARE", "FLASH", "RAM")): regions[line.split()[0]] = line.split("=")[-1] for region in regions: @@ -62,10 +63,17 @@ for region in regions: space = M_PATTERN.sub(M_REPLACE, space) regions[region] = eval(space) -free_flash = regions["FLASH_FIRMWARE"] - text - data -free_ram = regions["RAM"] - data - bss -print("{} bytes free in flash firmware space out of {} bytes ({}kB).".format(free_flash, regions["FLASH_FIRMWARE"], regions["FLASH_FIRMWARE"] / 1024)) -print("{} bytes free in ram for heap out of {} bytes ({}kB).".format(free_ram, regions["RAM"], regions["RAM"] / 1024)) +# TODO Remove check for both FLASH_FIRMWARE and FLASH after all ports are converted to use FLASH_FIRMWARE. +try: + firmware_region = regions["FLASH_FIRMWARE"] +except KeyError: + firmware_region = regions["FLASH"] +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 heap out of {} bytes ({}kB).".format(free_ram, ram_region, ram_region / 1024)) print() # Check that we have free flash space. GCC doesn't fail when the text + data |
