Lecture 14: Introduction To RTOS
ENGR 029
Spring 2024
Delano
Contents
Motivation
Real-Time �Operating �Systems
© 2019 Arm Limited
Operating System Overview
Video driver
Audio driver
Memory driver
Mouse driver
OS kernel
OS shell
User application
Operating System
Functions of an Operating System
Managing the processor
Managing memory
Managing devices
Managing file systems
System security
Fault tolerance and error detection
Multitasking and job accounting
Task coordination
Types of Operating System
Real-Time Operating System Overview
Real-time (definition): Real-time guarantees the completion of a process within a defined time interval.
Real-time does not make any statement about the total time duration or the processing speed.
RTOS Design Philosophies
RTOS Task Scheduling
The raspberry PI, a common prototyping system, does not come with a native RTOS, which can limit its utility for embedded applications.
Highlights of Arm Keil RTX RTOS
Deterministic RTOS designed for Arm Cortex-M-based devices
Multitasking with flexible scheduling: round-robin, pre-emptive, and collaborative
High-speed real-time operation with low interrupt latency
Small footprint for resource-constrained systems
Royalty-free, deterministic RTOS with source code
Unlimited number of tasks each with 254 priority levels
Support for multithreading and thread-safe operation
Inter-task communication manages the sharing of data, memory, and hardware resources among multiple tasks
Unlimited number of mailboxes, semaphores, mutex, and timers (hardware-permitting)
Defined stack usage - each task is allocated a defined stack space, enabling predictable memory usage
Threads
Thread Example
/*
* Copyright (c) 2020 Arm Limited and affiliates.
* SPDX-License-Identifier: Apache-2.0
*/
#include "mbed.h"
DigitalOut led1(LED1);
DigitalOut led2(LED2);
Thread thread;
void led2_thread()
{
while (true) {
led2 = !led2;
ThisThread::sleep_for(1000);
}
}
int main()
{
thread.start(led2_thread);
while (true) {
led1 = !led1;
ThisThread::sleep_for(500);
}
}
Contents
How can we use these new features?
Example is full OS unless it says baremetal. Lab 0 was based on the blinky-baremetal project.
See here for full comparison of bare metal and full profiles
Some RTOS features are “safe” to use in bare metal
Mutex
Semaphore
Considerations for using Threads, Mutex and Semaphore
Switching to full metal profile
To use the RTOS you can:
Further Reading