UC OS-III, The Real-Time Kernel, Or A High Performance, Scalable, ROMable, Preemptive, Multitasking
uC/OS-III: A High Performance, Scalable, ROMable, Preemptive, Multitasking Real-Time Kernel
If you are looking for a reliable, efficient, and flexible real-time kernel for your embedded system, you might want to consider uC/OS-III. This is a highly portable, ROMable, scalable, preemptive, real-time, deterministic, multitasking kernel for microprocessors, microcontrollers and DSPs. It is designed for ease of use on a huge number of CPU architectures and platforms. It also offers a rich set of features and services that can help you develop robust and responsive applications.
uC OS-III, The Real-Time Kernel, or a High Performance, Scalable, ROMable, Preemptive, Multitasking
In this article, we will introduce you to uC/OS-III and explain what it is, how it works, how to use it, and how it compares to other real-time kernels. We will also show you some examples of use cases and applications that can benefit from using uC/OS-III.
What is uC/OS-III?
uC/OS-III is a full-featured embedded operating system originally developed by Micriµm. It is the third generation of the popular µC/OS family of real-time kernels that have been widely used in the medical, aerospace, industrial, automotive, IoT, and consumer markets. uC/OS-III inherits the proven design principles and coding standards of its predecessors while adding new features and enhancements to meet the evolving needs of embedded developers.
Features and benefits of uC/OS-III
Some of the main features and benefits of uC/OS-III are:
Preemptive multitasking real-time kernel: uC/OS-III supports an unlimited number of tasks with different priorities that can be preempted by higher priority tasks at any time. This ensures that the most urgent tasks are always executed first and that the system can respond quickly to external events.
Optional round robin scheduling: uC/OS-III can also use a round robin scheduling algorithm for tasks with the same priority level. This ensures that each task gets a fair share of CPU time and prevents starvation.
Highly portable: uC/OS-III can run on a wide range of CPU architectures and platforms with minimal changes to the source code. It supports both 8-bit and 32-bit processors as well as floating-point units (FPU) and memory protection units (MPU). It also supports various compilers, debuggers, simulators, IDEs, and RTOS-aware tools.
ROMable: uC/OS-III can be stored in read-only memory (ROM) such as flash or EEPROM. This reduces the RAM footprint and increases the security of the system.
Scalable: uC/OS-III can be configured to include only the features and services that are needed for a specific application. This reduces the code size and optimizes the performance of the system.
Resource-efficient: uC/OS-III has a low memory footprint and a fast execution speed. It requires only 6K to 24K bytes of code space and 1K+ bytes of data space depending on the configuration and the CPU architecture. It also has a very low interrupt disable time that minimizes the latency and jitter of the system.
Extensive performance measurement metrics: uC/OS-III provides various statistics and information that can help developers monitor and optimize the performance of the system. These include CPU usage, task stack usage, task execution time, task context switches, interrupt occurrences, kernel object usage, and more.
Certifiable for safety-critical applications: uC/OS-III has been certified for use in safety-critical applications that require compliance with standards such as IEC 61508, DO-178B/C, ISO 26262, and EN 50128. It has also been verified by formal methods and static analysis tools to ensure its correctness and reliability.
How uC/OS-III works
uC/OS-III is based on the concept of tasks, which are independent units of execution that perform specific functions in the system. Tasks can communicate and synchronize with each other using various kernel objects and services provided by uC/OS-III.
Tasks and priorities
A task is a function that runs in an infinite loop and performs a specific function in the system. A task can be created, deleted, started, stopped, suspended, resumed, or changed in priority by the application or by another task. A task can also terminate itself by calling a special function.
Each task has a unique priority level that determines its importance in the system. The priority level can range from 0 (highest) to 255 (lowest) depending on the configuration. The priority level can also be changed dynamically at run time.
Scheduling and context switching
The scheduling algorithm of uC/OS-III determines which task should run next on the CPU. The scheduling algorithm is based on two principles:
Preemption: A higher priority task can preempt a lower priority task at any time. This ensures that the most urgent tasks are always executed first and that the system can respond quickly to external events.
Round robin: Tasks with the same priority level can share the CPU time using a round robin algorithm. This ensures that each task gets a fair share of CPU time and prevents starvation.
The context switching mechanism of uC/OS-III saves and restores the state of a task when it is switched in or out of the CPU. The state of a task includes its registers, stack pointer, program counter, and other information. The context switching mechanism is highly optimized for each CPU architecture to achieve the fastest possible execution speed.
Kernel objects and services
Kernel objects are data structures that are used by tasks to communicate and synchronize with each other. Kernel objects can be created, deleted, accessed, or modified by tasks using various kernel services provided by uC/OS-III. Some of the most common kernel objects and services are:
Semaphores: Semaphores are used to signal events or resources between tasks. A semaphore can have a binary or a counting value. A task can wait for a semaphore to become available or post a semaphore to make it available.
Mutexes: Mutexes are used to protect shared resources or critical sections between tasks. A mutex can only be owned by one task at a time. A task can acquire or release a mutex using a priority inheritance mechanism to prevent priority inversion.
Event flags: Event flags are used to signal one or more events between tasks. An event flag group can have up to 64 individual flags that can be set or cleared by tasks. A task can wait for one or more flags to be set or cleared using various options.
Message queues: Message queues are used to send messages between tasks. A message queue can store a fixed number of messages of a fixed size. A task can send or receive messages from a message queue using various options.
Memory partitions: Memory partitions are used to allocate memory blocks dynamically between tasks. A memory partition can have a fixed number of blocks of a fixed size. A task can allocate or free memory blocks from a memory partition using various options.
functions periodically or one-shot. A software timer can be created, deleted, started, stopped, or changed in period by tasks. A software timer can also execute a callback function when it expires.
Message pools: Message pools are used to create and manage messages that can be sent between tasks using message queues. A message pool can have a fixed number of messages of a variable size. A task can create or delete messages from a message pool using various options.
How to use uC/OS-III
Using uC/OS-III is relatively easy and straightforward. You just need to follow these steps:
Supported architectures and platforms
The first step is to choose the CPU architecture and platform that you want to use for your embedded system. uC/OS-III supports a wide range of architectures and platforms, such as ARM, AVR, PIC, MSP430, x86, PowerPC, Renesas, and more. You can find the list of supported architectures and platforms on the official website of uC/OS-III: https://www.osrtos.com/rtos/uc-os-iii/
You also need to choose the compiler, debugger, simulator, IDE, and RTOS-aware tools that you want to use for your development environment. uC/OS-III supports various tools from different vendors, such as IAR, Keil, GCC, Visual Studio, Eclipse, Tracealyzer, SystemView, and more. You can find the list of supported tools on the official website of uC/OS-III: https://www.osrtos.com/rtos/uc-os-iii/
Configuration and customization options
The second step is to configure and customize uC/OS-III according to your application requirements and preferences. You can do this by editing two header files: os_cfg.h and os_cfg_app.h. These files contain various configuration constants and macros that control the behavior and features of uC/OS-III.
Some of the configuration options that you can modify are:
OS_CFG_TMR_EN: This option enables or disables the timer services of uC/OS-III.
OS_CFG_TICK_RATE_HZ: This option specifies the frequency of the clock tick in Hertz (Hz).
OS_CFG_PRIO_MAX: This option specifies the maximum number of task priorities supported by uC/OS-III.
OS_CFG_STAT_TASK_EN: This option enables or disables the statistics task of uC/OS-III.
OS_CFG_TRACE_EN: This option enables or disables the trace services of uC/OS-III.
And many more...
You can find the description and default values of each configuration option in the source code and documentation of uC/OS-III.
Development tools and resources
The third step is to use the development tools and resources provided by uC/OS-III to help you create and debug your application.
Source code and documentation
uC/OS-III comes with complete, clean, consistent source code that you can inspect and modify as needed. The source code is organized into directories and files according to their functionality and purpose. You can find the source code on GitHub: https://github.com/SiliconLabs/uC-OS3
uC/OS-III also comes with in-depth documentation that explains the design principles, implementation details, API reference, porting guide, release notes, errata, and more. You can find the documentation on Confluence: https://micrium.atlassian.net/wiki/spaces/osiiidoc/pages/131072/Home
Example projects and tutorials
uC/OS-III provides several example projects and tutorials that demonstrate how to use uC/OS-III on different architectures and platforms. These examples cover various topics such as task creation and management, kernel object usage, memory allocation, timer services, trace services, etc. You can find the example projects and tutorials on the official website of uC/OS-III: https://www.osrtos.com/rtos/uc-os-iii/
Technical support and licensing
uC/OS-III offers technical support and licensing options for developers who need assistance or want to use uC/OS-III in their commercial products. You can contact the official custodian of uC/OS-III, Weston Embedded Solutions, for more information and details. You can find their contact information on their website: https://weston-embedded.com/
How uC/OS-III compares to other real-time kernels
uC/OS-III is not the only real-time kernel available for embedded systems. There are many other real-time kernels that have different features, advantages, limitations, and use cases. Some of the most popular and well-known real-time kernels are FreeRTOS, RTX, Zephyr, QNX, VxWorks, and Linux.
Advantages of uC/OS-III over other kernels
Some of the advantages of uC/OS-III over other kernels are:
High quality and reliability: uC/OS-III has been developed with rigorous coding standards and best practices. It has also been certified for use in safety-critical applications and verified by formal methods and static analysis tools. It has a proven track record of being used in thousands of products worldwide across a broad range of industries.
Rich feature set and services: uC/OS-III offers a rich set of features and services that can help developers create robust and responsive applications. It supports preemptive multitasking, round robin scheduling, various kernel objects, software timers, message pools, memory partitions, performance measurement metrics, trace services, and more.
High portability and scalability: uC/OS-III can run on a wide range of CPU architectures and platforms with minimal changes to the source code. It also supports various compilers, debuggers, simulators, IDEs, and RTOS-aware tools. It can be configured to include only the features and services that are needed for a specific application. It can also be stored in ROM to reduce the RAM footprint and increase the security of the system.
Easy to use and learn: uC/OS-III is designed for ease of use on a huge number of CPU architectures and platforms. It has a simple and consistent API that is easy to understand and use. It also comes with complete, clean, consistent source code and in-depth documentation that explain the design principles, implementation details, API reference, porting guide, release notes, errata, and more. It also provides several example projects and tutorials that demonstrate how to use uC/OS-III on different architectures and platforms.
Free for non-commercial use: uC/OS-III is free for non-commercial use under the Apache License 2.0. This means that you can use uC/OS-III for your personal or educational projects without paying any fees or royalties. You can also modify and distribute uC/OS-III as long as you comply with the terms of the license.
Limitations and challenges of uC/OS-III
Some of the limitations and challenges of uC/OS-III are:
Lack of native support for multicore systems: uC/OS-III does not support multicore systems natively. This means that you cannot run multiple instances of uC/OS-III on different cores or share kernel objects between cores. You need to use external mechanisms such as inter-process communication (IPC) or shared memory to communicate between cores.
Lack of native support for dynamic loading and unloading of modules: uC/OS-III does not support dynamic loading and unloading of modules natively. This means that you cannot load or unload modules at run time without restarting the system. You need to use external mechanisms such as bootloaders or application loaders to load or unload modules.
Lack of native support for networking protocols: uC/OS-III does not support networking protocols natively. This means that you cannot use TCP/IP, USB, Modbus, or other protocols with uC/OS-III directly. You need to use external libraries or stacks such as µC/TCP-IP or µC/USB to implement networking protocols.
or other file systems with uC/OS-III directly. You need to use external libraries or stacks such as µC/FS to implement file systems.
Use cases and applications of uC/OS-III
uC/OS-III can be used for a variety of use cases and applications that require real-time performance, reliability, efficiency, and flexibility. Some of the use cases and applications that can benefit from using uC/OS-III are:
Safety-critical applications: uC/OS-III can be used for applications that require compliance with safety standards such as IEC 61508, DO-178B/C, ISO 26262, and EN 50128. These applications include medical devices, aerospace systems, industrial control systems, automotive systems, and railway systems.
IoT applications: uC/OS-III can be used for applications that involve Internet of Things (IoT) devices such as sensors, actuators, gateways, and edge devices. These applications require low power consumption, high security, and connectivity with various protocols.
Consumer applications: uC/OS-III can be used for applications that involve consumer products such as smart watches, fitness trackers, smart home devices, wearable devices, and gaming consoles. These applications require high responsiveness, user interface, and multimedia capabilities.
And many more...
Conclusion
In this article, we have introduced you to uC/OS-III and explained what it is, how it works, how to use it, and how it compares to other real-time kernels. We have also shown you some examples of use cases and applications that can benefit from using uC/OS-III.
We hope that this article has given you a clear overview of uC/OS-III and its features and benefits. If you are interested in learning more about uC/OS-III or want to try it out for yourself, you can visit the official website of uC/OS-III: https://www.osrtos.com/rtos/uc-os-iii/
You can also contact the official custodian of uC/OS-III, Weston Embedded Solutions, for more information and details. You can find their contact information on their website: https://weston-embedded.com/
Thank you for reading this article and we hope you have enjoyed it.
FAQs
Here are some frequently asked questions (FAQs) about uC/OS-III:
What is the difference between uC/OS-II and uC/OS-III?
uC/OS-II and uC/OS-III are both real-time kernels developed by Micriµm. However, they have some differences in their features and design. Some of the main differences are:
uC/OS-II supports only one task per priority level while uC/OS-III supports an unlimited number of tasks per priority level.
uC/OS-II uses a linked list to manage ready tasks while uC/OS-III uses a bitmap to manage ready tasks.
uC/OS-II uses a single tick list to manage delayed tasks while uC/OS-III uses multiple tick lists to manage delayed tasks.
uC/OS-II does not support software timers while uC/OS-III supports software timers.
uC/OS-II does not support message pools while uC/OS-III supports message pools.
uC/OS-II does not support trace services while uC/OS-III supports trace services.
And many more...
What is the difference between Micrium OS and Cesium RTOS?
Micrium OS and Cesium RTOS are both derived from uC/OS-III. However, they have some differences in their features and licensing. Some of the main differences are:
Micrium OS is developed by Silicon Labs while Cesium RTOS is developed by Weston Embedded Solutions.
Micrium OS is free for non-commercial use under the Apache License 2.0 while Cesium RTOS is a commercial product that requires a license fee.
Micrium OS supports only Silicon Labs silicon while Cesium RTOS supports more than 50 CPU architectures and platforms.
Micrium OS includes additional components such as TCP/IP, USB, Modbus, and File System while Cesium RTOS does not include these components.
And many more...
How can I get started with uC/OS-III?
You can get started with uC/OS-III by following these steps:
Choose the CPU architecture and platform that you want to use for your embedded system.
Choose the compiler, debugger, simulator, IDE, and RTOS-aware tools that you want to use for your development environment.
Configure and customize uC/OS-III according to your application requirements and preferences by editing os_cfg.h and os_cfg_app.h.
Use the development tools and resources provided by uC/OS-III to help you create and debug your application.
Visit the official website of uC/OS-II