scripts: footprint: Exclude data section from rom_report if XIP=n

For XIP=n, the data section is only in RAM

Signed-off-by: Grant Ramsay <gramsay@enphaseenergy.com>
This commit is contained in:
Grant Ramsay 2025-02-20 20:56:24 +13:00 committed by Benjamin Cabé
commit 4c5f858869

View file

@ -207,6 +207,11 @@ def get_section_ranges(elf):
ram_size = 0 ram_size = 0
unassigned_size = 0 unassigned_size = 0
xip = any(section.get_symbol_by_name('CONFIG_XIP')
for section in elf.iter_sections('SHT_SYMTAB'))
if args.verbose:
print(f'INFO: XIP={xip}')
for section in elf.iter_sections(): for section in elf.iter_sections():
size = section['sh_size'] size = section['sh_size']
sec_start = section['sh_addr'] sec_start = section['sh_addr']
@ -232,14 +237,16 @@ def get_section_ranges(elf):
print_section_info(section, "ROM txt section") print_section_info(section, "ROM txt section")
elif (flags & SHF_WRITE_ALLOC) == SHF_WRITE_ALLOC: elif (flags & SHF_WRITE_ALLOC) == SHF_WRITE_ALLOC:
# Data occupies both ROM and RAM # Read/write data
# since at boot, content is copied from ROM to RAM if xip:
rom_addr_ranges.append(bound) # For XIP, the data section occupies both ROM and RAM
rom_size += size # since at boot, content is copied from ROM to RAM
rom_addr_ranges.append(bound)
rom_size += size
ram_addr_ranges.append(bound) ram_addr_ranges.append(bound)
ram_size += size ram_size += size
is_assigned = True is_assigned = True
print_section_info(section, "ROM,RAM section") print_section_info(section, "DATA r/w section")
elif (flags & SHF_ALLOC) == SHF_ALLOC: elif (flags & SHF_ALLOC) == SHF_ALLOC:
# Read only data # Read only data