Skip to content

Commit 4c5f858

Browse files
gramsay0kartben
authored andcommitted
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>
1 parent 179f3c6 commit 4c5f858

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

scripts/footprint/size_report

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,11 @@ def get_section_ranges(elf):
207207
ram_size = 0
208208
unassigned_size = 0
209209

210+
xip = any(section.get_symbol_by_name('CONFIG_XIP')
211+
for section in elf.iter_sections('SHT_SYMTAB'))
212+
if args.verbose:
213+
print(f'INFO: XIP={xip}')
214+
210215
for section in elf.iter_sections():
211216
size = section['sh_size']
212217
sec_start = section['sh_addr']
@@ -232,14 +237,16 @@ def get_section_ranges(elf):
232237
print_section_info(section, "ROM txt section")
233238

234239
elif (flags & SHF_WRITE_ALLOC) == SHF_WRITE_ALLOC:
235-
# Data occupies both ROM and RAM
236-
# since at boot, content is copied from ROM to RAM
237-
rom_addr_ranges.append(bound)
238-
rom_size += size
240+
# Read/write data
241+
if xip:
242+
# For XIP, the data section occupies both ROM and RAM
243+
# since at boot, content is copied from ROM to RAM
244+
rom_addr_ranges.append(bound)
245+
rom_size += size
239246
ram_addr_ranges.append(bound)
240247
ram_size += size
241248
is_assigned = True
242-
print_section_info(section, "ROM,RAM section")
249+
print_section_info(section, "DATA r/w section")
243250

244251
elif (flags & SHF_ALLOC) == SHF_ALLOC:
245252
# Read only data

0 commit comments

Comments
 (0)