I create an almost empty ESP-IDF C project for ESP32-S3. I added the following components:
idf_component_register(SRCS ${SOURCES}
INCLUDE_DIRS .
REQUIRES
esp_driver_gpio
esp_driver_uart
esp_timer
esp_event
esp_wifi
nvs_flash
driver
fatfs
FT800-FT813-5.x)
and I just wrote few lines of code. After compiling I see the IRAM memory is already full:
Memory Type Usage Summary
┏━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━┳━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┓
┃ Memory Type/Section ┃ Used [bytes] ┃ Used [%] ┃ Remain [bytes] ┃ Total [bytes] ┃
┡━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━╇━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━┩
│ Flash Code │ 149695 │ 1.78 │ 8238881 │ 8388576 │
│ .text │ 149695 │ 1.78 │ │ │
│ DIRAM │ 74112 │ 21.43 │ 271744 │ 345856 │
│ .text │ 55651 │ 16.09 │ │ │
│ .data │ 11296 │ 3.27 │ │ │
│ .bss │ 7008 │ 2.03 │ │ │
│ Flash Data │ 67180 │ 0.2 │ 33487220 │ 33554400 │
│ .rodata │ 66924 │ 0.2 │ │ │
│ .appdesc │ 256 │ 0.0 │ │ │
│ IRAM │ 16383 │ 99.99 │ 1 │ 16384 │
│ .text │ 15356 │ 93.73 │ │ │
│ .vectors │ 1027 │ 6.27 │ │ │
│ RTC FAST │ 40 │ 0.49 │ 8152 │ 8192 │
│ .rtc_reserved │ 24 │ 0.29 │ │ │
└─────────────────────┴──────────────┴──────────┴────────────────┴───────────────┘
Total image size: 300205 bytes (.bin may be padded larger)
I'm reading here what IRAM is and here how to minimize its usage. From the project configuration I removed all the IRAM options (I left enabled the master SPI only).
As far as I know, ESP32 have the CONFIG_ESP_SYSTEM_ESP32_SRAM1_REGION_AS_IRAM
parameter to change the IRAM size, but ESP32-S3 has not.
What are the consequences of having the IRAM full with almost no code written? Are there other ways to reduce its usage (or increase its size)?
Different from the ESP32, the ESP32-S3 does not have dedicated 'instruction RAM' (IRAM). All RAM can be used for instructions/code if desired. That's why for the S3 the 'size' of the 'IRAM' shown is just the amount of RAM allocated for all the "IRAM" code in your application, and this will always be 'full'/'almost full'.