diff options
author | Michael O'Cleirigh <michael.ocleirigh@gmail.com> | 2022-01-28 00:35:53 -0500 |
---|---|---|
committer | Damien George <damien@micropython.org> | 2022-02-02 15:24:02 +1100 |
commit | eae2e3516ca4067ca8cfeb51ac8a6505cb6324b7 (patch) | |
tree | 39f606decbbe2ad599b558bb863a120b60ea43d2 | |
parent | 1f04a9a1fcd4172f7c721e05a4515c9c8bb0e8c9 (diff) | |
download | micropython-eae2e3516ca4067ca8cfeb51ac8a6505cb6324b7.tar.gz micropython-eae2e3516ca4067ca8cfeb51ac8a6505cb6324b7.zip |
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.
-rw-r--r-- | ports/esp32/main.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/ports/esp32/main.c b/ports/esp32/main.c index e25e6fdd1c..6c5edbb356 100644 --- a/ports/esp32/main.c +++ b/ports/esp32/main.c @@ -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()) { |