Increasing the heap when working with AmazonFreeRTOS

Ascarron
Posts: 2
Joined: Mon Aug 05, 2019 12:02 am

Increasing the heap when working with AmazonFreeRTOS

Postby Ascarron » Mon Aug 05, 2019 12:09 am

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?

chegewara
Posts: 2362
Joined: Wed Jun 14, 2017 9:00 pm

Re: Increasing the heap when working with AmazonFreeRTOS

Postby chegewara » Sat Aug 10, 2019 11:52 pm

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);

Ascarron
Posts: 2
Joined: Mon Aug 05, 2019 12:02 am

Re: Increasing the heap when working with AmazonFreeRTOS

Postby Ascarron » Sun Aug 18, 2019 9:50 pm

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?

ESP_Sprite
Posts: 9709
Joined: Thu Nov 26, 2015 4:08 am

Re: Increasing the heap when working with AmazonFreeRTOS

Postby ESP_Sprite » Mon Aug 19, 2019 2:48 am

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.

Who is online

Users browsing this forum: No registered users and 14 guests