Skip to content

Commit 0810dd2

Browse files
committed
idf_size.py: Fix issue where diram size was halved in cases where iram 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 #9960
1 parent 766dc3e commit 0810dd2

File tree

4 files changed

+34134
-14
lines changed

4 files changed

+34134
-14
lines changed

tools/idf_size.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -584,13 +584,17 @@ def in_iram(x: MemRegions.Region) -> bool:
584584
r = StructureForSummary()
585585

586586
diram_filter = filter(in_diram, segments)
587-
r.diram_total = int(get_size(diram_filter) / 2)
587+
r.diram_total = get_size(diram_filter)
588588

589589
dram_filter = filter(in_dram, segments)
590590
r.dram_total = get_size(dram_filter)
591591
iram_filter = filter(in_iram, segments)
592592
r.iram_total = get_size(iram_filter)
593593

594+
# This fixes counting the diram twice if the cache fills the iram entirely
595+
if r.iram_total == 0:
596+
r.diram_total //= 2
597+
594598
def filter_in_section(sections: Iterable[MemRegions.Region], section_to_check: str) -> List[MemRegions.Region]:
595599
return list(filter(lambda x: LinkingSections.in_section(x.section, section_to_check), sections)) # type: ignore
596600

0 commit comments

Comments
 (0)