Chapter 4. API Guides
Cache disabled but cached memory region accessed
In some situations, ESP-IDF will temporarily disable access to external SPI Flash and SPI RAM via caches. For
example, this happens when spi_flash APIs are used to read/write/erase/mmap regions of SPI Flash. In these situa-
tions, tasks are suspended, and interrupt handlers not registered with ESP_INTR_FLAG_IRAM are disabled. Make
sure that any interrupt handlers registered with this flag have all the code and data in IRAM/DRAM. Refer to the SPI
flash API documentation for more details.
Memory protection fault
ESP32-S2 Permission Control feature is used in ESP-IDF to prevent the following types of memory access:
• writing to instruction RAM after the program is loaded
• executing code from data RAM (areas used for heap and static .data and .bss)
Such operations are not necessary for most programs. Prohibiting such operations typically makes software vul-
nerabilities harder to exploit. Applications which rely on dynamic loading or self-modifying code may disable this
protection using CONFIG_ESP_SYSTEM_MEMPROT_FEATURE Kconfig option.
When the fault occurs, the panic handler reports the address of the fault and the type of memory access that caused
it.
4.12.6 Other Fatal Errors
Brownout
ESP32-S2 has a built-in brownout detector, which is enabled by default. The brownout detector can trigger a
system reset if the supply voltage goes below a safe level. The brownout detector can be configured using CON-
FIG_ESP32S2_BROWNOUT_DET and CONFIG_ESP32S2_BROWNOUT_DET_LVL_SEL options.
When the brownout detector triggers, the following message is printed:
Brownout detector was triggered
The chip is reset after the message is printed.
Note that if the supply voltage is dropping at a fast rate, only part of the message may be seen on the console.
Corrupt Heap
ESP-IDF’s heap implementation contains a number of run-time checks of the heap structure. Additional checks (
“Heap Poisoning”) can be enabled in menuconfig. If one of the checks fails, a message similar to the following will
be printed:
CORRUPT HEAP: Bad tail at 0x3ffe270a. Expected 0xbaad5678 got 0xbaac5678
assertion "head != NULL" failed: file "/Users/user/esp/esp-idf/components/heap/
,→multi_heap_poisoning.c", line 201, function: multi_heap_free
abort() was called at PC 0x400dca43 on core 0
Consult Heap Memory Debugging documentation for further information.
Stack Smashing
Stack smashing protection (based on GCC -fstack-protector* flags) can be enabled in ESP-IDF using CON-
FIG_COMPILER_STACK_CHECK_MODE option. If stack smashing is detected, message similar to the following
will be printed:
Espressif Systems 1340
Submit Document Feedback
Release v4.4