adding task dynamically

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.  😀 There is a way to have a “dynamic task manager” with FreeRTOS?. Any experience is welcome.

adding task dynamically

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.

adding task dynamically

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.

adding task dynamically

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),