FreeRTOS cannot allocate enough RAM for all tasks

Hello, I am currently facing a problem with FreeRTOS. I am using multiple tasks, queue, semaphores and at some point when the code got bigger and bigger, FreeRTOS could allocate enough RAM for all tasks and i ended up in the endless while loop after the schedule was started. I figured out, that when i lower done some of the stack used for creating the tasks it works again. I am using currently a ATSAM4SD32B from Atmel with 160kB of RAM, so this should not be a problem at all. Does anyone know where to start searching for the problem, or what solves the problem? Thanks in advance

FreeRTOS cannot allocate enough RAM for all tasks

FreeRTOS Version V7.3.0 MCU: ATSAM4SD32B IDE: Atmel Studio 7

FreeRTOS cannot allocate enough RAM for all tasks

The heap allocation schemes are described on the following link: http://www.freertos.org/a00111.html If you are returning from the vTaskStartScheduler() function then there was not enough heap available for either or both of the Idle and timer service tasks to be created. The uxTaskGetSystemState() API function, and various different kernel aware plug-ins, allow you to view the maximum amount of stack ever actually used by a task, and so reduce the amount allocated to the task if a large part of the stack never gets used. http://www.freertos.org/uxTaskGetSystemState.html FreeRTOS V9 (not yet released) has a way of obtaining this information on a task by task basis too – as well as a way of creating tasks without using the heap. You can also tune the size of your heap by viewing how much heap has ever actually been used using the xPortGetMinimumEverFreeHeapSize() function. Hope this helps. Regards.

FreeRTOS cannot allocate enough RAM for all tasks

Thanks for your answer. What does “there was not enough heap available” exactly mean. I am using the heap_4.c and allocated more than enough heap (xPortGetFreeHeapSize() is returning around 10000). The uxTaskGetSystemState, xPortGetMinimumEverFreeHeapSize are nice functions, I will try them out. However, the RAM of the MCU is so big that i should not have any problems regarding heap or stack, or am I wrong here? Thanks in advance.

FreeRTOS cannot allocate enough RAM for all tasks

If you have 10000 bytes available, then there was enough heap available, but I’m not aware of any other reason why vTaskStartScheduler() would return. It must be something port specific, perhaps the RTOS’s SVC handler (which is used to start the scheduler) has not been installed?

FreeRTOS cannot allocate enough RAM for all tasks

The scheduler also works fine, it I adjust the Stacks for each of the tasks. But it looks like that there is some maxmimum limit which could be used for that. Do you know if the MPU of my ARM Cortext M4 could have any influence in this memory problem?

FreeRTOS cannot allocate enough RAM for all tasks

How do i install this SVC handler correctly?

FreeRTOS cannot allocate enough RAM for all tasks

Do you know if the MPU of my ARM Cortext M4 could have any influence in this memory problem?
If you are using the standard FreeRTOS port, as opposed to the separate MPU port, then the MPU is not touched by FreeRTOS, and would only have any influence if your startup code, driver code, or application code was turning it on.
How do I install the RTOS SVC Handler? Updated to V8.2.3 i am receiving now an SVCall Exception.
See item 1 in the numbered list on the following page: http://www.freertos.org/FAQHelp.html Regards.