Преглед изворни кода

Merge branch 'bugfix/fix_esp32s3_diram_calculation' into 'master'

Tools: Fix diram size calculation

Closes IDFGH-8504

See merge request espressif/esp-idf!21243
Roland Dobai пре 3 година
родитељ
комит
2eabf60291

+ 5 - 1
tools/idf_size.py

@@ -584,13 +584,17 @@ class StructureForSummary(object):
         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
 

Разлика између датотеке није приказан због своје велике величине
+ 20495 - 0
tools/test_idf_size/app_esp32s3_32k_icache.map


+ 26 - 13
tools/test_idf_size/expected_output

@@ -4421,7 +4421,7 @@ Total sizes:
 Used static IRAM:   46786 bytes ( 239934 remain, 16.3% used)
       .text size:   45759 bytes
    .vectors size:    1027 bytes
-Used stat D/IRAM:   11772 bytes ( 123396 remain, 8.7% used)
+Used stat D/IRAM:   11772 bytes ( 258564 remain, 4.4% used)
       .data size:    9252 bytes
       .bss  size:    2520 bytes
 Used Flash size :  114851 bytes
@@ -4429,13 +4429,26 @@ Used Flash size :  114851 bytes
          .rodata:   27132 bytes
 Total image size:  170889 bytes (.bin may be padded larger)
 
+***
+Running idf_size.py for esp32s3 configured with 32KB of icache...
+Total sizes:
+Used stat D/IRAM:   71186 bytes ( 274670 remain, 20.6% used)
+      .data size:   11900 bytes
+      .bss  size:    3200 bytes
+      .text size:   55059 bytes
+   .vectors size:    1027 bytes
+Used Flash size :  132883 bytes
+           .text:   99451 bytes
+         .rodata:   33176 bytes
+Total image size:  200869 bytes (.bin may be padded larger)
+
 ***
 Running idf_size.py for esp32s3 with overflow...
 Total sizes:
 Used static IRAM:  337906 bytes ( -51186 remain, 117.9% used) Overflow detected! You can run idf.py size-files for more information.
       .text size:  336879 bytes
    .vectors size:    1027 bytes
-Used stat D/IRAM:   94049 bytes (  41119 remain, 69.6% used)
+Used stat D/IRAM:   94049 bytes ( 176287 remain, 34.8% used)
       .data size:   68929 bytes
       .bss  size:   25120 bytes
 Used Flash size :  461714 bytes
@@ -4449,7 +4462,7 @@ Total sizes:
 Used static IRAM:   46786 bytes ( 239934 remain, 16.3% used)
       .text size:   45759 bytes
    .vectors size:    1027 bytes
-Used stat D/IRAM:   11772 bytes ( 123396 remain, 8.7% used)
+Used stat D/IRAM:   11772 bytes ( 258564 remain, 4.4% used)
       .data size:    9252 bytes
       .bss  size:    2520 bytes
 Used Flash size :  114851 bytes
@@ -4463,7 +4476,7 @@ Total sizes:
 Used static IRAM:   46786 bytes ( 239934 remain, 16.3% used)
       .text size:   45759 bytes
    .vectors size:    1027 bytes
-Used stat D/IRAM:   11772 bytes ( 123396 remain, 8.7% used)
+Used stat D/IRAM:   11772 bytes ( 258564 remain, 4.4% used)
       .data size:    9252 bytes
       .bss  size:    2520 bytes
 Used Flash size :  114851 bytes
@@ -4507,7 +4520,7 @@ Total sizes:
 Used static IRAM:   46786 bytes ( 239934 remain, 16.3% used)
       .text size:   45759 bytes
    .vectors size:    1027 bytes
-Used stat D/IRAM:   11772 bytes ( 123396 remain, 8.7% used)
+Used stat D/IRAM:   11772 bytes ( 258564 remain, 4.4% used)
       .data size:    9252 bytes
       .bss  size:    2520 bytes
 Used Flash size :  114851 bytes
@@ -4773,7 +4786,7 @@ Total sizes:
 Used static IRAM:   46786 bytes ( 239934 remain, 16.3% used)
       .text size:   45759 bytes
    .vectors size:    1027 bytes
-Used stat D/IRAM:   11772 bytes ( 123396 remain, 8.7% used)
+Used stat D/IRAM:   11772 bytes ( 258564 remain, 4.4% used)
       .data size:    9252 bytes
       .bss  size:    2520 bytes
 Used Flash size :  114851 bytes
@@ -16560,10 +16573,10 @@ Producing JSON output for esp32s3...
     "diram_vectors": 0,
     "diram_rodata": 0,
     "diram_other": 0,
-    "diram_total": 135168,
+    "diram_total": 270336,
     "used_diram": 11772,
-    "used_diram_ratio": 0.08709161931818182,
-    "diram_remain": 123396,
+    "used_diram_ratio": 0.04354580965909091,
+    "diram_remain": 258564,
     "flash_code": 87463,
     "flash_rodata": 27132,
     "flash_other": 256,
@@ -20334,7 +20347,7 @@ Total sizes:,,,
 Used static IRAM,46786 bytes (239934 remain 16.3% used),,,
 .text size,45759 bytes,,,
 .vectors size,1027 bytes,,,
-Used stat D/IRAM,11772 bytes (123396 remain 8.7% used),,,
+Used stat D/IRAM,11772 bytes (258564 remain 4.4% used),,,
 .data size,9252 bytes,,,
 .bss  size,2520 bytes,,,
 Used Flash size ,114851 bytes,,,
@@ -20345,7 +20358,7 @@ Total sizes:,,,
 Used static IRAM,46786 bytes (239934 remain 16.3% used),,,
 .text size,45759 bytes,,,
 .vectors size,1027 bytes,,,
-Used stat D/IRAM,11772 bytes (123396 remain 8.7% used),,,
+Used stat D/IRAM,11772 bytes (258564 remain 4.4% used),,,
 .data size,9252 bytes,,,
 .bss  size,2520 bytes,,,
 Used Flash size ,114851 bytes,,,
@@ -20386,7 +20399,7 @@ Total sizes:,,,
 Used static IRAM,46786 bytes (239934 remain 16.3% used),,,
 .text size,45759 bytes,,,
 .vectors size,1027 bytes,,,
-Used stat D/IRAM,11772 bytes (123396 remain 8.7% used),,,
+Used stat D/IRAM,11772 bytes (258564 remain 4.4% used),,,
 .data size,9252 bytes,,,
 .bss  size,2520 bytes,,,
 Used Flash size ,114851 bytes,,,
@@ -20649,7 +20662,7 @@ Total sizes:,,,
 Used static IRAM,46786 bytes (239934 remain 16.3% used),,,
 .text size,45759 bytes,,,
 .vectors size,1027 bytes,,,
-Used stat D/IRAM,11772 bytes (123396 remain 8.7% used),,,
+Used stat D/IRAM,11772 bytes (258564 remain 4.4% used),,,
 .data size,9252 bytes,,,
 .bss  size,2520 bytes,,,
 Used Flash size ,114851 bytes,,,

+ 2 - 0
tools/test_idf_size/test.sh

@@ -125,6 +125,8 @@ csv_test() {
     && python -m coverage run -a $IDF_PATH/tools/idf_size.py --target esp32c3 --archive_details libdriver.a app_esp32c3.map &>> output \
     && echo -e "\n***\nRunning idf_size.py for esp32s3..." &>> output \
     && python -m coverage run -a $IDF_PATH/tools/idf_size.py --target esp32s3 app_esp32s3.map &>> output \
+    && echo -e "\n***\nRunning idf_size.py for esp32s3 configured with 32KB of icache..." &>> output \
+    && python -m coverage run -a $IDF_PATH/tools/idf_size.py --target esp32s3 app_esp32s3_32k_icache.map &>> output \
     && echo -e "\n***\nRunning idf_size.py for esp32s3 with overflow..." &>> output \
     && python -m coverage run -a $IDF_PATH/tools/idf_size.py --target esp32s3 overflow_esp32s3.map &>> output \
     && echo -e "\n***\nRunning idf_size.py for esp32s3 (target autodetected)..." &>> output \

Неке датотеке нису приказане због велике количине промена