Page 1 of 1

ESP32 WROVER reboots on heap_caps_calloc(MALLOC_CAP_IRAM_8BIT)

Posted: Wed Apr 12, 2023 10:12 am
by simonjo
Hi,

My application requires IRAM memory, but when I use heap_caps_calloc(1, 784, MALLOC_CAP_IRAM_8BIT) it returns 0.

This is on a WROVER.

When using heap_caps_calloc(1, 784, MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT) I get a valid return pointer.


Why the differences, what am I missing?

Re: ESP32 WROVER reboots on heap_caps_calloc(MALLOC_CAP_IRAM_8BIT)

Posted: Wed Apr 12, 2023 2:31 pm
by MicroController
From the TRM: "The CPU can read and write data through the instruction bus, but only in a word aligned manner; non-word-aligned access will cause a CPU exception."

Hence, CAP_IRAM + 8BIT is not valid/possible on the ESP32.

See also https://esp32.com/viewtopic.php?t=23891#p94825

Re: ESP32 WROVER reboots on heap_caps_calloc(MALLOC_CAP_IRAM_8BIT)

Posted: Thu Apr 13, 2023 4:58 am
by ESP_Mahavir
Hello,

It is possible to allocate memory from ESP32 IRAM region in FreeRTOS unicore mode with certain performance penalty. Please refer to https://docs.espressif.com/projects/esp ... ble-memory.