• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer

Microcontroller Tips

Microcontroller engineering resources, new microcontroller products and electronics engineering news

  • Products
    • 8-bit
    • 16-bit
    • 32-bit
    • 64-bit
  • Applications
    • Automotive
    • Connectivity
    • Consumer Electronics
    • Industrial
    • Medical
    • Security
  • EE Forums
    • EDABoard.com
    • Electro-Tech-Online.com
  • Videos
    • TI Microcontroller Videos
  • EE Resources
    • DesignFast
    • eBooks / Tech Tips
    • FAQs
    • LEAP Awards
    • Podcasts
    • Webinars
    • White Papers
  • EE Learning Center
    • Design Guides
      • WiFi & the IOT Design Guide
      • Microcontrollers Design Guide
      • State of the Art Inductors Design Guide

Three RTOS basics: What, when and how

January 8, 2020 By Majeed Ahmad

While real-time operating system (RTOS) software is becoming a key feature in the out-of-box support for embedded systems built around MCUs, the overall concept of RTOS is still muddy for many design engineers.

So, here is the when and why RTOS solutions are needed in embedded designs. But, before that, what is RTOS anyway, especially when compared to bare metal solutions?

What

An RTOS is an operating system designed to manage hardware resources of an embedded system; it creates multiple threads of software execution and a scheduler for managing these threads. Another way to put it is a scheduling kernel that creates a multi-tasking and deterministic run-time environment.

Figure 1: A comparison between non-RTOS and RTOS executions. Image: Texas Instruments

The presence of a scheduler and the capability of assigning precise and reproducible time slots for the running tasks distinguishes RTOS solutions from embedded designs based on “bare metal” programming. That brings us to when embedded developers should make a switch from the bare-metal system to RTOS.

When

An RTOS is commonly used when there are more interrupt sources, more functions, and more communication interfaces. In short, it’s the application complexity that mostly decides the use of RTOS tailored for MCUs.

Another way to determine whether an RTOS is needed is to watch out one of the following design requirements: 1) TCP/IP or other complex networking stacks, 2) a complex GUI, or 3) a file system. Here, it’s worth mentioning that a design encompassing all three requirements will merit the use of a full-fledged operating system.

Figure 2: The block diagram of an embedded system design incorporating an RTOS. Image: GitHub

What an RTOS does here is suspend a task while giving higher priority to tasks with real-time requirements. Here, RTOS software, a collection of initialization routines, drivers, and utility functions, provides inter-thread synchronization mechanisms and software timer services.

How

Once an embedded developer decides to use an RTOS solution, the first thing to see is the amount of RAM and flash available in a microcontroller. An RTOS solution may require 6 KB to 10 KB of flash, so as a rule of thumb, the MCU should have around 32 KB of flash memory to ensure that there is ample space for the application code.

Likewise, 4 KB to 8 KB of RAM is advisable for supporting RTOS operations, given that each task has its own control block and stack. Many 32-bit MCUs set 2 KB of RAM per task or stack by default.

RTOS in the IoT era

The Internet of Things (IoT) bandwagon is accelerating the use of third-party software stacks, especially the TCP/IP and USB stacks that few developers want to write. And these third-party stacks and tools are often compatible with various RTOS solutions.

Moreover, popular RTOS solutions like Azure RTOS, Amazon FreeRTOS, and Segger’s embOS are being qualified for MCUs from large suppliers. This out-of-box integration is crucial in managing software complexity and lowering the barriers to entry for smaller embedded design outfits.

However, the use of RTOS also increases the overall system complexity and may introduce new types of bugs. So, developers must have adequate knowledge of how to implement RTOS-based programs effectively.

 

You may also like:

  • MCU-based hardware virtualization
    The fundamentals of MCU-based hardware virtualization

  • IoT MCUs will support Microsoft Azure RTOS
  • Segger Software libraries
    Software libraries support RA family of MCUs

  • Real-time vs. a standard operating system & How to choose…
  • Amazon FreeRTOS
    32-bit microcontroller family now supports Amazon FreeRTOS

Filed Under: Embedded, FAQ, Featured, RTOS Tagged With: FAQ

Primary Sidebar

DesignFast

Design Fast Logo
Component Selection Made Simple.

Try it Today
design fast globle

EE Training Center Classrooms

EE Classrooms

CURRENT DIGITAL ISSUE

A frequency you can count on There are few constants in life, but what few there are might include death, taxes, and a U.S. grid frequency that doesn’t vary by more than ±0.5 Hz. However, the certainty of the grid frequency is coming into question, thanks to the rising percentage of renewable energy sources that…

Digital Edition Back Issues

Subscribe to our Newsletter

Subscribe to weekly industry news, new product innovations and more.

Subscribe today

RSS Current EDABoard.com discussions

  • Advice for my disabled son please
  • Very low voltage/power Schmitt trigger?
  • 3D IC Design: Is it possible to stack CPU and FPGA?
  • dc to dc converter sparks when inserting fuse
  • 7 segment display connections

RSS Current Electro-Tech-Online.com Discussions

  • Pet Microchip scan
  • Disabled son needs advice please
  • Modify a digital clamp ammeter ?
  • Confirming whether this circuit will work
  • How does a blinky/flashing ball work?

Footer

Microcontroller Tips

EE World Online Network

  • DesignFast
  • EE World Online
  • EDA Board Forums
  • Electro Tech Online Forums
  • Connector Tips
  • Analog IC Tips
  • Power Electronic Tips
  • Sensor Tips
  • Test and Measurement Tips
  • Wire and Cable Tips
  • 5G Technology World

Microcontroller Tips

  • Subscribe to our newsletter
  • Advertise with us
  • Contact us
  • About us
Follow us on Twitter Add us on Facebook Follow us on YouTube  Follow us on Instagram

Copyright © 2022 · WTWH Media LLC and its licensors. All rights reserved.
The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media.

Privacy Policy