Loading color scheme

What for a FreeRTOS is used?

FreeRTOS is a free and open-source real-time operating system (RTOS) that runs on most of the modern microcontrollers, including STM32. In 2017, Amazon took control of the FreeRTOS project and now offers regular maintenance and support.

An operating system (OS) is software that manages other software and hardware resources in a computer system. You may be familiar with the most popular universal operating systems such as Windows, macOS, Linux, iOS, and Android. Universal OS is often designed to focus on the user experience.

For example, let's say we are developing applications on the phone's operating system, such as Android or iOS.Users may want to stream movies, so we can split the streaming experience into two tasks: downloading video blocks from the Internet (Task 1) and showing each block to the user (task 2). These jobs may be part of the same program, in which case they may be implemented as concurrently running threads.

If our processor has only 1 available kernel, then our streaming application may need to quickly jump between Job 1 and Job 2 to give the user the impression of downloading and viewing at the same time.

Common (not real-time) operating system

General purpose OS

Note that I have listed the third job here: basic OS software. The operating system is responsible for determining which jobs need to be performed to give users a seamless experience. This exchange of jobs is called Context switching, which creates some processing overhead since the OS needs to hold things like registers, memory, and Program counters so that it can return to a previously running thread without losing any information.

Work may be a bit late, packets may be lost, or frames may be lost, thus making the video catch up. Since the focus is on the user experience in the generic OS, it is likely that these nuances in job execution will not be noticed by the user, or that the user may not care (too much).

The focus has changed in most microcontroller applications. Often, it is important to adhere to strict time limits. Consider motor controllers or automatic braking systems in electric vehicles. In these cases, if the time interval is shortened by a few milliseconds, it may endanger human life. Therefore, RTOS is the best choice for managing multiple jobs running simultaneously.

In the second example, the vehicle's electronic control unit (ECU) may be responsible for controlling and auxiliary braking. Job 2: monitor the driver's input and help put the brakes on and turn on the taillights. However, suppose our ECU receives a notification that the car sensor has detected an impending collision. As a result, Job 1 will seize Job 2 to control the brake. Of course, all this assumes that it is equipped with an automatic brake assist vehicle.

Real-time operating system example

Real-time operating system example

Remember, this is a very simple example. Hardware interrupts can also be used to preempt running tasks. RTOS allows you to create software jobs instead of relying on and prioritizing hardware interrupts.In addition, most RTOS act as an abstraction layer, allowing you to write code that can be easily ported to other microcontrollers.

Get all interesting articles to your inbox
Please wait