-
Notifications
You must be signed in to change notification settings - Fork 7.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[tools/idf_size.py][components/esp_system/ld/esp32s3/memory.ld.in] Wrong ouput of idf.py size (IDFGH-8504) #9960
Comments
Thank you for the report! We have noticed this issue internally as well. We'll let you know once the fix is available. |
@sbithinx I have looked into this issue, the value of 345856B is infact the correct value for DIRAM, 512K is the sum of all RAM regions, while DIRAM is only 416KB:
The calculation when cache is 16k is wrong and that is being fixed at the moment. |
@DNedic Thanks for the update, I wasn't considering the reserved memory by the second stage bootloader. However, it would be nice, if the |
@sbithinx Thank you for the suggestion! |
…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 #9960 Fix expected output
…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
…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 #9960 Fix expected output
Answers checklist.
IDF version.
v4.4.2
Operating System used.
Linux
How did you build your project?
Command line with idf.py
If you are using Windows, please specify command line type.
No response
What is the expected behavior?
Correct statistics about the memory usage of ESP32-S3-based project, when
idf.py
is called with the optionsize
,size-files
orsize-components
.What is the actual behavior?
Currently the output of
idf.py size-files
for our ESP32-S3-based project with 16 KB as 'CONFIG_ESP32S3_INSTRUCTION_CACHE_SIZE` looks like this:It can be assured, that our software is not using ~16 KB more than the available RAM. I spend a lot of hours tracing down the issue in the
tools/idf_size.py
script.It seems, that
idf_size.py
is not able to handle, if only 16 KB are configured, instead of the maximal available 32 KB, asCONFIG_ESP32S3_INSTRUCTION_CACHE_SIZE
.If 32 KB are configured as
CONFIG_ESP32S3_INSTRUCTION_CACHE_SIZE
. The output looks better, but another issue can be seen:Keep in mind, this the output for our project with just
CONFIG_ESP32S3_INSTRUCTION_CACHE_SIZE
changed. If the reported bytes are added up:Used stat D/IRAM: 283947 + 61909 remain = 345856 Bytes
The ESP32-S3 has 512 KB integrated RAM and
345856 Bytes != 512 KB
, even if the configuredCONFIG_ESP32S3_INSTRUCTION_CACHE_SIZE
is subtracted. This can be traced down to sectionMemory Configuration
in the MAP-file:As you can see, the reported size of
iram0_0_seg
anddram0_0_seg
is0x54700
which is the same value as calculated earlier:345856 Bytes
. I debugged theidf_size.py
script to find the root for the reported information.It comes from the
components/esp_system/ld/esp32s3/memory.ld.in
linker file:https://github.com/espressif/esp-idf/blob/5ee663d5926bcb7e09c64f1eb8500f94e1bdc18c/components/esp_system/ld/esp32s3/memory.ld.in#L37:L49
https://github.com/espressif/esp-idf/blob/5ee663d5926bcb7e09c64f1eb8500f94e1bdc18c/components/esp_system/ld/esp32s3/memory.ld.in#L69:L70
If the calculation is extended:
SRAM_IRAM_SIZE = ((SRAM_IRAM_END - (SRAM_DIRAM_I_START - SRAM_DRAM_START)) - SRAM_DRAM_START) + ICACHE_SIZE + CONFIG_ESP32S3_INSTRUCTION_CACHE_SIZE
and the absolute values are put in place:
SRAM_IRAM_SIZE = ((0x403CC700 - (0x40378000 - 0x3FC88000)) - 0x3FC88000) + 0x8000 - 0x8000 = 0x54700
At this point I really don't understand why two different address ranges are used mixed here. Escpecially because this step:
I_D_SRAM_OFFSET = SRAM_DIRAM_I_START - SRAM_DRAM_START = 0x40378000 - 0x3FC88000 = 0x6F0000
Why is the DRAM-Start-Address in the data bus address range subtracted from the D/IRAM-Start-Address in the instruction bus address range? This does not really make sense to me.
For
CONFIG_ESP32S3_INSTRUCTION_CACHE_SIZE
set to 32 KB the calculatedSRAM_IRAM_SIZE
should be at least 480 KB (Internal SRAM 1 + Internal SRAM 2), 416 (Internal SRAM 1) or 512 KB (Internal SRAM 0 + Internal SRAM 1 + Internal SRAM 2), but definitely not 345856 Bytes.Steps to reproduce.
idf.py
with optionsize-files
with 16 KBCONFIG_ESP32S3_INSTRUCTION_CACHE_SIZE
for target ESP32-S3idf.py
with optionsize-files
with 32 KBCONFIG_ESP32S3_INSTRUCTION_CACHE_SIZE
for target ESP32-S3...
Build or installation Logs.
No response
More Information.
No response
The text was updated successfully, but these errors were encountered: