Allocating memory (heap, stack) for freeRTOS


I have a question about configuring the allocation of heap and stack that is available to freeRTOS. I am not referring to the stack size that is specified when you create a task, but the overall memory that is available to the application.

What is the recommended method please?

Is it a case of using whatever usual method you would use for this, e.g. through the IDE or linker scripts? Or are there settings within freeRTOS that are used for this. What about freeRTOSconfig.h and the different heap configuration files? (heap1.c etc…)


The memory map is usually specified by linker script(s) (sometimes generated by an IDE).
Some definitions there are usually directly used by the runtime environment as the main stack (reused as ISR stack for Cortex-M ports) and maybe a heap section.
The latter depends on the actual heap implementation used.
I‘d propose to check the comprehensive FreeRTOS docs.
I think you’ll find the information you need e.g. Static Vs Dynamic Memory Allocation and Memory Management.