build_memory_info: Drop support for old FLASH region name

This led to incorrect results about free memory in the stm and i.mx ports
This commit is contained in:
Jeff Epler 2020-04-27 08:08:12 -05:00
parent 6f6dc835d2
commit 85a4dd939f

View File

@ -52,7 +52,7 @@ regions = {}
with open(sys.argv[1], "r") as f: with open(sys.argv[1], "r") as f:
for line in f: for line in f:
line = line.strip() line = line.strip()
if line.startswith(("FLASH_FIRMWARE", "FLASH", "RAM")): if line.startswith(("FLASH_FIRMWARE", "RAM")):
regions[line.split()[0]] = line.split("=")[-1] regions[line.split()[0]] = line.split("=")[-1]
for region in regions: for region in regions:
@ -63,11 +63,7 @@ for region in regions:
space = M_PATTERN.sub(M_REPLACE, space) space = M_PATTERN.sub(M_REPLACE, space)
regions[region] = int(eval(space)) regions[region] = int(eval(space))
# TODO Remove check for both FLASH_FIRMWARE and FLASH after all ports are converted to use FLASH_FIRMWARE. firmware_region = regions["FLASH_FIRMWARE"]
try:
firmware_region = regions["FLASH_FIRMWARE"]
except KeyError:
firmware_region = regions["FLASH"]
ram_region = regions["RAM"] ram_region = regions["RAM"]
free_flash = firmware_region - text - data free_flash = firmware_region - text - data