Przeglądaj źródła

tools/idf_size: Fixed bug with wrong memory calculation

simon.chupin 4 lat temu
rodzic
commit
40eede261e

+ 4 - 9
tools/idf_size.py

@@ -228,11 +228,10 @@ def load_map_data(map_file: TextIO) -> Tuple[str, Dict, Dict]:
     detected_chip = detect_target_chip(map_file)
     sections = load_sections(map_file)
 
-    # Exclude the .dummy section, which usually means shared region among I/D buses
-    dummy_keys = [key for key in sections if key.endswith(('.dummy'))]
-    if dummy_keys:
-        sections.pop(*dummy_keys)
-
+    # Exclude the dummy and .text_end section, which usually means shared region among I/D buses
+    for key in list(sections.keys()):
+        if key.endswith(('dummy', '.text_end')):
+            sections.pop(key)
     return detected_chip, segments, sections
 
 
@@ -569,8 +568,6 @@ class StructureForSummary(object):
         r.dram_total = get_size(dram_filter)
         iram_filter = filter(in_iram, segments)
         r.iram_total = get_size(iram_filter)
-        if r.diram_total == 0:
-            r.diram_total = r.dram_total + r.iram_total
 
         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
@@ -578,8 +575,6 @@ class StructureForSummary(object):
         dram_sections = list(filter(in_dram, sections))
         iram_sections = list(filter(in_iram, sections))
         diram_sections = list(filter(in_diram, sections))
-        if not diram_sections:
-            diram_sections = dram_sections + iram_sections
         flash_sections = filter_in_section(sections, 'flash')
 
         dram_data_list = filter_in_section(dram_sections, 'data')

Plik diff jest za duży
+ 355 - 445
tools/test_idf_size/expected_output


+ 9 - 9
tools/test_idf_size/expected_output.json

@@ -14,19 +14,19 @@
     "iram_total": 131072,
     "used_iram_ratio": 0.297027587890625,
     "iram_remain": 92140,
-    "diram_data": 9324,
-    "diram_bss": 8296,
-    "diram_text": 37908,
-    "diram_vectors": 1024,
+    "diram_data": 0,
+    "diram_bss": 0,
+    "diram_text": 0,
+    "diram_vectors": 0,
     "diram_rodata": 0,
     "diram_other": 0,
-    "diram_total": 311808,
-    "used_diram": 56552,
-    "used_diram_ratio": 0.18136802134646962,
-    "diram_remain": 255256,
+    "diram_total": 0,
+    "used_diram": 0,
+    "used_diram_ratio": 0,
+    "diram_remain": 0,
     "flash_code": 146944,
     "flash_rodata": 39580,
     "flash_other": 0,
     "used_flash_non_ram": 186524,
-    "total_size": 283036
+    "total_size": 234780
 }

+ 1 - 6
tools/test_idf_size/expected_output.txt

@@ -5,12 +5,7 @@ Used static DRAM:   17620 bytes ( 163116 remain, 9.7% used)
 Used static IRAM:   38932 bytes (  92140 remain, 29.7% used)
       .text size:   37908 bytes
    .vectors size:    1024 bytes
-Used stat D/IRAM:   56552 bytes ( 255256 remain, 18.1% used)
-      .data size:    9324 bytes
-      .bss  size:    8296 bytes
-      .text size:   37908 bytes
-   .vectors size:    1024 bytes
 Used Flash size :  186524 bytes
       .text     :  146944 bytes
       .rodata   :   39580 bytes
-Total image size:  283036 bytes (.bin may be padded larger)
+Total image size:  234780 bytes (.bin may be padded larger)

+ 1 - 4
tools/test_idf_size/size_schema.json

@@ -77,10 +77,7 @@
                 "(^\\.flash\\.(rodata|text|appdesc|rodata_noload)$)": {
                     "$ref": "#/$defs/archive_details"
                 },
-                "(^\\.flash_rodata_dummy$)": {
-                    "$ref": "#/$defs/archive_details"
-                },
-                "(^\\.iram0\\.(text|vectors|text_end|bss|data)$)": {
+                "(^\\.iram0\\.(text|vectors|bss|data)$)": {
                     "$ref": "#/$defs/archive_details"
                 },
                 "(^\\.rtc\\.(bss|data|text)$)": {

Niektóre pliki nie zostały wyświetlone z powodu dużej ilości zmienionych plików