Quality RTOS & Embedded Software

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


adding task dynamically

Posted by iorek on September 2, 2010
We want develop a product with FreeRtos that can add or remove task to system, in order to add or remove functionality.
For example our hardware have a temperature sensor by an ADC but there functionality is optional for some clients, then we want to remove the task that do this work and add other task that sense other signals with i2c. But without change all the firmware and maybe the next month add again the temperature sensor task without remove i2c task. I hope I was clear with my idea. :D

There is a way to have a "dynamic task manager" with FreeRTOS?. Any experience is welcome.

RE: adding task dynamically

Posted by Richard Damon on September 3, 2010
Free RTOS out of the box can add a task dynamically to the Kernel, the issue will be more an issue of how to add/remove the code from your overall program. This really isn't a FreeRTOS type of issue, but a development tool issue. If you will have all the code in the machine at once, but only some tasks are activated at any given time this is easy, if you need to be able to change which modules are actually in memory, than your tool will need some form of dynamic or incremental linking ability.

RE: adding task dynamically

Posted by iorek on September 9, 2010
Well really we do not want to have a big code with many tasks, some of them active and others inactive. We want a kernel code with few tasks. This code has ONE firmware version and this firmware will not change. This firmware has to load other optional tasks like modules from a memory or filesystem??? We are not sure which is the best option.

This optionals tasks could change from one board to another and we want to remove or add them but without changing our kernel.

RE: adding task dynamically

Posted by Richard Damon on September 9, 2010
This then is a tools issue, not a FreeRTOS issue, you need to make sure your tools support this form of dynamic linking of the add-on modules and your hardware needs to have some way to acquire and store these modules.

Note that the dynamic linking will also most likely need to be relocatable too, or you are going to have to divide you memory into sections, and each section can only load from a distinct set of modules (though some modules could be built for multiple sections if needed).

If your tools do not support dynamic linking (and that is sort of a rare feature in a lot of the embedded world), you are going to need to look at other options.

If the tools do support the needed dynamic linking, then adding in the FreeRTOS part of having the new module register tasks (and maybe queue, semaphores, and mutexes) isn't that hard to do.

It sounds like you haven't completed the design work to be able to do the linking yet (which isn't a kernel function, but a tool issue),

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

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

Latest News

FreeRTOS v10.2.0 is available for immediate download. MIT licensed, and including RISC-V and ARMv8-M (Cortex-M33) demos.

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

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


FreeRTOS and other embedded software careers at AWS.

FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Cadence Tensilica Cortes

Espressif ESP32

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

Xilinx Microblaze and Zynq partner