[core] Add dynamic FAL_PART_TABLE generation

This commit is contained in:
Kuba Szczodrzyński
2022-05-27 15:29:21 +02:00
parent 7ddbc09564
commit 4b050e11cf
2 changed files with 12 additions and 9 deletions

View File

@@ -37,13 +37,16 @@ flash_layout: dict = board.get("flash")
if flash_layout:
defines = {}
flash_size = 0
fal_items = ""
for name, layout in flash_layout.items():
name = name.upper()
(offset, _, length) = layout.partition("+")
defines[f"FLASH_{name}_OFFSET"] = offset
defines[f"FLASH_{name}_LENGTH"] = length
fal_items += f"FAL_PART_TABLE_ITEM({name.lower()}, {name})"
flash_size = max(flash_size, int(offset, 16) + int(length, 16))
defines["FLASH_LENGTH"] = flash_size
defines["FAL_PART_TABLE"] = "{" + fal_items + "}"
env.Append(CPPDEFINES=defines.items())
env.Replace(**defines)