소스 검색

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 https://github.com/espressif/esp-idf/issues/9960
Djordje Nedic 3 년 전
부모
커밋
0810dd20e8
4개의 변경된 파일20528개의 추가작업 그리고 14개의 파일을 삭제
  1. 5 1
      tools/idf_size.py
  2. 20495 0
      tools/test_idf_size/app_esp32s3_32k_icache.map
  3. 26 13
      tools/test_idf_size/expected_output
  4. 2 0
      tools/test_idf_size/test.sh

+ 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 \

이 변경점에서 너무 많은 파일들이 변경되어 몇몇 파일들은 표시되지 않았습니다.