FreeRTOS Support Archive
The FreeRTOS support forum is used to obtain active support directly from Real
Time Engineers Ltd. In return for using our top quality software and services for
free, we request you play fair and do your bit to help others too! Sign up
to receive notifications of new support topics then help where you can.
This is a read only archive of threads posted to the FreeRTOS support forum.
The archive is updated every week, so will not always contain the very latest posts.
Use these archive pages to search previous posts. Use the Live FreeRTOS Forum
link to reply to a post, or start a new support thread.
[FreeRTOS Home] [Live FreeRTOS Forum] [FAQ] [Archive Top] [April 2011 Threads] minimal stack usage of tasks with PIC32Posted by Nils Schulte on April 13, 2011 Hi,
I currently need to estimate whether I will have enough available RAM for my project when using freeRTOS with PIC32.
One important point is memory usage of tasks. Am I right that will need at least following amount of RAM for each task? 760byte (config_Minimal_Stack_Size=190 words) + 64 byte for task-organization + more stack for any local/non-static data
As I will need to realize a "large" project requiring at least 20 tasks and 20 queues I am concerned that I might run out of RAM soon. So can you give me a hint how I can lower the memory usage? I read about the function attribute "naked" for task functions - about how much would it help to lower config_Minimal_Stack_Size? Or is there some related freeRTOS configuration switch that might help to further reduce the memory usage?
Regards, Nils
RE: minimal stack usage of tasks with PIC32Posted by Richard on April 13, 2011 The MIPS core uses a lot of stack. FreeRTOS minimises the stack requirements by provided a separate stack for any interrupts (which may be nested many deep) - thus removing the requirement for each task stack to allocate enough stack for interrupts too.
The figures you state sound about right, but it depends on what the tasks are doing. If the tasks are calling standard C library functions (especially things like printf()), then they will need more. You can minimise that again by providing cut down versions of such library functions (FreeRTOS contains a file to replace the printf()/sprintf() functions, but with limited functionality).
If you are using FreeRTOS V7.0.0 then you have the option to include a lot of functionality in timer callback functions. If a task has "run to completion" type functionality, you can have it in a timer rather than a task, and save yourself lots of stack space.
There is always the option of using co-routines too, which are ultra light weight threads, but they have limited functionality and are a bit legacy now (going back to when 8-bit was used more).
Regards.
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.
|