Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem TCP & FAT




Loading

FreeRTOS cannot allocate enough RAM for all tasks

Posted by petegorba on February 9, 2016

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

Posted by petegorba on February 9, 2016

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


FreeRTOS cannot allocate enough RAM for all tasks

Posted by rtel on February 9, 2016

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

Posted by petegorba on February 10, 2016

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

Posted by rtel on February 10, 2016

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

Posted by petegorba on February 11, 2016

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

Posted by petegorba on February 11, 2016

How do i install this SVC handler correctly?


FreeRTOS cannot allocate enough RAM for all tasks

Posted by rtel on February 11, 2016

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.


[ Back to the top ]    [ About FreeRTOS ]    [ Sitemap ]    [ ]




Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

FreeRTOS kernel V10 is available for immediate download. Now MIT licensed.


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

OpenRTOS and SafeRTOS