Skip to content

Commit

Permalink
idf_size.py: Fix issue where diram size was halved in cases where ira…
Browse files Browse the repository at this point in the history
…m was not fully filled with cache

This fixes an attempted fix for diram size calculation where it was counted twice, however the fix did not account for cases where iram was not fully filled with cache and therefore was of non 0 size.
Now the calculation should be correct regardless of the cache size.

Closes espressif/esp-idf#9960
  • Loading branch information
DNedic committed Nov 28, 2022
1 parent 4ca2ca7 commit 64ff3e1
Show file tree
Hide file tree
Showing 4 changed files with 34,134 additions and 14 deletions.
6 changes: 5 additions & 1 deletion tools/idf_size.py
Original file line number Diff line number Diff line change
Expand Up @@ -584,13 +584,17 @@ def in_iram(x: MemRegions.Region) -> bool:
r = StructureForSummary()

diram_filter = filter(in_diram, segments)
r.diram_total = int(get_size(diram_filter) / 2)
r.diram_total = get_size(diram_filter)

dram_filter = filter(in_dram, segments)
r.dram_total = get_size(dram_filter)
iram_filter = filter(in_iram, segments)
r.iram_total = get_size(iram_filter)

# This fixes counting the diram twice if the cache fills the iram entirely
if r.iram_total == 0:
r.diram_total //= 2

def filter_in_section(sections: Iterable[MemRegions.Region], section_to_check: str) -> List[MemRegions.Region]:
return list(filter(lambda x: LinkingSections.in_section(x.section, section_to_check), sections)) # type: ignore

Expand Down

0 comments on commit 64ff3e1

Please sign in to comment.