esp32/main: Automatically size SPIRAM heap when allocated using malloc.
This change allows the same heap allocation rules to be used when using malloc regardless if the board has SPRAM or normal RAM. Integrating with the esp32-camera for example requires that ESP32 SPRAM be allocatable using the esp-idf capabilities aware allocation functions. In the case of esp32-camera it's for the framebuffer. Detect when CONFIG_SPIRAM_USE_MALLOC is in use and use the standard automatic configuration of leaving 1/2 of the SPRAM available to other FreeRTOS tasks.
This commit is contained in:
parent
1f04a9a1fc
commit
eae2e3516c
|
@ -100,7 +100,10 @@ void mp_task(void *pvParameter) {
|
|||
size_t mp_task_heap_size;
|
||||
void *mp_task_heap = NULL;
|
||||
|
||||
#if CONFIG_ESP32_SPIRAM_SUPPORT
|
||||
#if CONFIG_SPIRAM_USE_MALLOC
|
||||
// SPIRAM is issued using MALLOC, fallback to normal allocation rules
|
||||
mp_task_heap = NULL;
|
||||
#elif CONFIG_ESP32_SPIRAM_SUPPORT
|
||||
// Try to use the entire external SPIRAM directly for the heap
|
||||
mp_task_heap = (void *)SOC_EXTRAM_DATA_LOW;
|
||||
switch (esp_spiram_get_chip_size()) {
|
||||
|
|
Loading…
Reference in New Issue