Corey and Karl start off their first episode of “The Great Debates!”
Corey takes the position that RTOSes for the most part don’t belong in single core embeeded systems.
Karl takes the position that the advantages of using an RTOS ,even in single core microcontrollers, far exceed their disadvantages.
Bare metal coding allows you to fully optimize the embedded system. You can write code that allows the microcontroller to be as efficient as possible in performing a specific task. RTOSes and Operating systems increase latency and reduce efficiency.
Modern RTOSes can be extremely efficient. For instance the context switching of ChibiOS using a 168Mhz STM32F4 is 0.40µS.
Although that number is not zero, therefore I must agree that any kind of overhead is overhead…
Point for Corey.
RTOSes allow you to better handle changing design requirements and future upgrades.
Rebuttal: If you have used that platform before and wrote good code. You can also reuse your own code in the new project.
Rebuttal-Rebuttal: You usually end up using atleast one other persons code anyway. Maybe it is a vendor’s ethernet or USB stack. When not using an RTOS, resource conflicts can arise when you try to add in one of those stacks later on.
Point for Karl.
RTOSes utilize interrupts for the most efficient program flow. This decreases prototype to final version coding.
I’m lazy when creating protoype code, I typically implement a polling routine first. Then once the prototype system is proven to work, I rewrite the code to utilize interrupts.
When I prototype with an RTOS, I only write the code once because the handling of interrupts is mostly done for me.
Point for Karl, just because I’m lazy.
RTOSes are not available for all platforms. Writing code from the ground up ensures that it will work properly on that platform.
Rebuttal: Porting an RTOS to a new platform might be quicker, and easier than writing bare metal code for a new platform.
Rebuttal-Rebuttal: Maybe, its faster but neither one of us really knows.
Point to nobody. Not enoguh evidence to support either argument.
License restrictions of RTOSes limit your ability to use their code in commercial projects.
Rebuttal: None, the RTOS’ licenses can be a hinder. Most Free RTOSes are not allowed to be used in commercial projects.
RTOSes that are allowed in commercial projects can be quite expensive.
List of RTOSes and their licenses, from wikipedia: List of RTOSes
Point for Corey.
And the winner is???
Neither Karl or Corey.
Like almost evrything else in Engineering the answer is: “It depends.”
What do you think?