Quality RTOS & Embedded Software

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


Loading

minimal stack usage of tasks with PIC32

Posted 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 PIC32

Posted 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.


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


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

Latest News

NXP tweet showing LPC5500 (ARMv8-M Cortex-M33) running FreeRTOS.

Meet Richard Barry and learn about running FreeRTOS on RISC-V at FOSDEM 2019

Version 10.1.1 of the FreeRTOS kernel is available for immediate download. MIT licensed.

View a recording of the "OTA Update Security and Reliability" webinar, presented by TI and AWS.


Careers

FreeRTOS and other embedded software careers at AWS.



FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Espressif ESP32

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Renesas

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

Xilinx Microblaze and Zynq partner