Hello,
The FreeRTOS heap is used by FreeRTOS for the *task* stack allocation and for the allocation of any RTOS objects (semaphores, queues, etc).
In FreeRTOS you can use different heap allocation schemes (configFRTOS_MEMORY_SCHEME). Unless you use scheme 3 which is using normal malloc()/free() from the C/C++ library, FreeRTOS uses its own heap mangement.
So for FreeRTOS, all its objects including the task stacks are in that heap. And FreeRTOS makes that heap management thread safe.
Now there is the 'normal' heap: the one used by the C/C++ libary malloc() and free() calls. So this a separate thing, and might not be thread safe. So if your application does calls to malloc(), that library heap is used. This is the heap lwip is using (from what I remember).
The heap size of FreeRTOS is defined like this:
| #define configTOTAL_HEAP_SIZE | ((size_t)(20000)) /* size of heap in bytes */ |
Now about the heap and stack size you can configure in the Processor Expert component:
The stack size is what is allocated as stack 'out of reset': so if your application starts (reset or power-on-reset), that stack is used. E.g. up to calling main(). But at the time you start FreeRTOS, the RTOS will switch to the stack(s) used by the tasks, which are in the FreeRTOS heap.
The heap size you configure in Processor Expert is the heap size for malloc().
Both the heap size and stack size you define here will be configured in the linker file, e.g. as:
| __heap_size = 0x1000; | /* required amount of heap */ |
| __stack_size = 0x0200; | /* required amount of stack */ |
I hope this helps,
Erich