Page 1 of 1

Increasing the heap when working with AmazonFreeRTOS

Posted: Mon Aug 05, 2019 12:09 am
by Ascarron
I am trying to use the ESP-WHO framework with the AmazonFreeRTOS. But I run out of heap space when storing the image. It throws the error:
matrix3du item alloc failed
Guru Meditation Error: Core 0 panic'ed (LoadProhibited). Exception was unhandled.
I tested it by lowering the resolution to QQVGA but it still crashes when doing the face detection.
I have enabled the SPI RAM (Component Config > ESP32 Specific > Support for External SPI RAM). Even though for heap initialization in FreeRTOSConfig.h is set to:

Code: Select all

#define configTOTAL_HEAP_SIZE	( ( size_t ) (256 * 1024) )
when I call xPortGetFreeHeapSize() the output is only 65536
What changes are necessary for the correct heap allocation?

Re: Increasing the heap when working with AmazonFreeRTOS

Posted: Sat Aug 10, 2019 11:52 pm
by chegewara
If you have properly setup SPIRAM usage in menuconfig then malloc should work, but you can always use this to allocate memory in SPIRAM:

Code: Select all

heap_caps_malloc(SPI_BUFFER_LEN, MALLOC_CAP_SPIRAM);

Re: Increasing the heap when working with AmazonFreeRTOS

Posted: Sun Aug 18, 2019 9:50 pm
by Ascarron
The SPIRAM is setup sucessfully and the matrix is being allocated to the external RAM.
But my applicattion requires more heap space to run the tasks. How do I increase the heap size when using freertos?
I tried to use the FreeRTOSConfig.h to change the size but it had no effect. Nor did changing the esp32.ld file.
Could you please let me know of the correct way to increase heap size?

Re: Increasing the heap when working with AmazonFreeRTOS

Posted: Mon Aug 19, 2019 2:48 am
by ESP_Sprite
You don't; heap essentially is all the free amount of memory you have left, you can't expand it. Just make sure you're not using up heap space elsewhere, or are doing silly stuff like filling the entire internal memory when you still have PSRAM left where you can move stuff to.