When programming microcontrollers, we know there are two basic operations: bare metal and operating systems. Bare metal refers to a large loop that executes repeatedly. Today, we will discuss several commonly used operating systems.A Real-time Operating System (RTOS) is designed to run tasks in a sorted manner, manage system resources, and provide a consistent foundation for application development.Compared to general operating systems, the biggest feature of RTOS is its “real-time” capability. If a task needs to be executed, the RTOS will execute it immediately without long delays. This feature ensures timely execution of tasks.Today, I will introduce 14 mainstream RTOS, which are<span>μClinux</span>, <span>μC/OS-II</span>, <span>eCos</span>, <span>FreeRTOS</span>, <span>mbed OS</span>, <span>RTX</span>, <span>Vxworks</span>, <span>QNX</span>, <span>NuttX</span>; domestic embedded operating systems include the Dujiangyan Operating System (<span>djyos</span>), <span>Alios Things</span>, <span>Huawei LiteOS</span>, <span>RT-Thread</span>, and <span>SylixOS</span>.The characteristics of these 14 embedded operating systems are as follows:
1. μClinux
μClinux is an excellent version of embedded Linux, its full name is micro-control Linux, which literally means micro-control Linux.
Compared to standard Linux, μClinux has a very small kernel, but it still inherits the main features of the Linux operating system, including good stability and portability, strong networking capabilities, excellent file system support, a rich set of APIs, and TCP/IP networking protocols. Due to the lack of an MMU (Memory Management Unit), its multitasking implementation requires certain techniques.
Structurally, μClinux inherits the multitasking implementation method of standard Linux, dividing tasks into real-time processes and normal processes, adopting first-come-first-served and time-slicing scheduling, respectively, and is modified specifically for mid- to low-range embedded CPU characteristics without supporting kernel preemption, resulting in average real-time performance.
In summary, the greatest feature of μClinux is its design for processors without MMU, which is suitable for the stm32f103 that lacks MMU functionality. However, porting this system requires at least 512KB of RAM space and 1MB of ROM/FLASH space, while the stm32f103 has 256K of FLASH, necessitating external memory, which increases hardware design costs.
μClinux has a complex structure, is relatively difficult to port, has a larger kernel, and its real-time performance is somewhat lacking. If the embedded product being developed emphasizes file systems and networking applications, μClinux is a good choice.
Microcontroller programming often involves downloading programs and online debugging using JTAG and SWD, with commonly used devices being J-LINK and ST-LINK, both of which are copyrighted and expensive. DAP-LINK is an open-source programming tool suitable for Cortex-M series microcontrollers, with no copyright constraints. I implemented this open-source project, and it can be obtained for a low cost of 27 yuan + 4 yuan shipping.
2. μC/OS-II
μC/OS-II is developed based on μC/OS and is a compact, preemptive multitasking real-time kernel written in C. μC/OS-II can manage 64 tasks and provides task scheduling and management, memory management, inter-task synchronization and communication, time management, and interrupt service functions, characterized by high execution efficiency, small space occupancy, excellent real-time performance, and strong scalability.
In terms of file system support, μC/OS-II is aimed at medium and small embedded systems, and even with full functionality, the compiled kernel is less than 10KB, so the system itself does not provide file system support. However, μC/OS-II has good extensibility, and file system content can be added if needed.
Regarding hardware support, μC/OS-II can support most popular CPUs. The μC/OS-II kernel is quite small, and the minimum trimmed code can be as small as 2KB, requiring a minimum data RAM space of 4KB. Porting μC/OS-II is relatively simple, requiring only modifications to processor-related code.
In summary, μC/OS-II is a simple structure, fully functional, and highly real-time embedded operating system kernel, very suitable for CPUs without MMU functionality. It requires very little kernel code space and data storage space, has good real-time performance, good scalability, and is open-source, with plenty of online resources and examples, making it very suitable for porting to the stm32f103 CPU.
3. eCos
<span>eCos (embedded Configurable operating system)</span> is an embedded configurable operating system. It is a source code open, configurable, portable real-time operating system aimed at deeply embedded applications, characterized by flexible configuration, adopting a modular design, with a core composed of small components, including the kernel, C library, and underlying runtime package.Each component can provide a large number of configuration options (the real-time kernel can also be an optional configuration), and using the configuration tools provided by eCos, it can be easily configured to meet different embedded application requirements.eCos operating system has strong configurability, and users can add the required file system. eCos also supports most popular embedded CPUs and can be ported between different architectures such as 16-bit, 32-bit, and 64-bit.Since eCos has a very small kernel, the minimum trimmed code can be as small as 10KB, requiring a minimum data RAM space of 10KB. Additionally, in terms of system portability, eCos has good portability, easier than μC/OS-II and μClinux.In summary, eCos’s greatest feature is its flexible configuration and support for porting to MMU-less CPUs, being open-source and having good portability, making it suitable for porting to the stm32 platform CPUs. However, eCos is not yet widely used and does not have as many resources as μC/OS-II. eCos is suitable for commercial or industrial embedded systems that are sensitive to cost, such as applications in consumer electronics.
4. FreeRTOS
Since RTOS requires certain system resources (especially RAM), only a few real-time operating systems like μC/OS-II, embOS, salvo, and FreeRTOS can run on small RAM microcontrollers.Compared to commercial operating systems like μC/OS-II and embOS, FreeRTOS is a completely free operating system with open source code, portable, customizable, and flexible scheduling strategies, making it easy to port to various microcontrollers. Its latest version is 6.0.As a lightweight operating system, FreeRTOS provides functions including task management, time management, semaphores, message queues, memory management, and logging functions, which can basically meet the needs of smaller systems.FreeRTOS kernel supports priority scheduling algorithms, allowing each task to be assigned a certain priority based on its importance, with the CPU always allowing the highest priority task in a ready state to run first.FreeRTOS kernel also supports round-robin scheduling algorithms, allowing different tasks to use the same priority, sharing CPU usage time when no higher priority tasks are ready.Compared to the common μC/OS-II operating system, FreeRTOS has both advantages and disadvantages.Its shortcomings are reflected in the system service functions; for example, FreeRTOS only provides implementations of message queues and semaphores, and cannot send messages to message queues in a last-in-first-out order. Additionally, FreeRTOS is only an operating system kernel and requires external third-party GUIs, TCP/IP stacks, FS (file systems), etc., to implement a more complex system, unlike μC/OS-II which can seamlessly integrate with μC/GUI, μC/FS, μC/TCP-IP, etc.
5. mbed OS
Open-source embedded operating system, ARM provides mbed OS free for all manufacturers, offering a relatively systematic and comprehensive smart hardware development environment.Main functions: provides a generic operating system foundation for developing IoT devices to solve the fragmentation problem in embedded design. Supports all important connectivity and device management open standards for future-oriented designs. Enables secure and upgradeable edge devices to support new processing capabilities and functions. Solves complex power consumption issues through automatic power management.Main features: fast development speed, powerful functionality, high security, designed for mass production, can be developed offline or edited online.
6. RTX
This is an embedded real-time operating system from ARM, written in standard C structure and compiled using the RealView compiler. It is not just a real-time kernel but also has rich middleware components, is free, and its code is open.Main functions: starts and stops tasks (processes), and also supports process communication, such as task synchronization, management of shared resources (peripherals or memory), and message passing between tasks. Developers can use basic functions to start the real-time runner, initiate and terminate tasks, and pass control between tasks (round-robin scheduling). Developers can assign priorities to tasks.Main features: supports time-slicing, preemptive and cooperative scheduling. Unlimited number of tasks, each task can have up to 254 priorities. Unlimited number of semaphores, mutexes, message mailboxes, and soft timers. Supports multithreading and thread-safe operations. Using the MDK dialog-based configuration wizard, MDK configuration can be easily completed.
7. VxWorks
VxWorks is an embedded real-time operating system (RTOS) designed and developed by WindRiver in the USA since 1983, featuring hard real-time, determinism, and stability, as well as scalability and security required by aerospace, defense, industrial, medical, automotive, consumer electronics, networking, and other industries.Main functions: supports predictable task synchronization mechanisms, supports communication between multiple tasks, optimized memory management, and the operating system’s (interrupt latency, task switching, driver latency, etc.) behavior is known and predictable. Provides real-time clock services + interrupt management services.Main features: has a high-performance operating system kernel Wind (good real-time performance, customizable) friendly development and debugging environment, good compatibility, and supports various development and runtime environments.
8. QNX
Born in 1980, QNX is a commercial POSIX-compliant Unix-like embedded real-time operating system.Main functions: supports scheduling and executing multiple tasks simultaneously on the same computer; it also allows multiple users to share a computer, and these users can submit tasks to the system through multiple terminals and interact with QNX.
Main features: the core only provides four services: process scheduling, inter-process communication, low-level network communication, and interrupt handling, with its processes running in independent address spaces. All other OS services are implemented as cooperating user processes, making the QNX core very small (QNX4.x is about 12Kb) and extremely fast.
9. NuttX
NuttX is a real-time embedded operating system (Embedded RTOS), with its first version released by Gregory Nutt in 2007 under a permissive BSD license.Main functions: can be constructed as an open, flat embedded RTOS, or built separately as a microkernel with system call interfaces. Easily extensible to new processor architectures, SoC architectures, or board-level architectures. Real-time, deterministic, supports priority inheritance. BSD socket interface. Extended priority management. Optional tasks (processes) with address environments.Main features: flexible configuration, adopting a modular design, with the core composed of small components, including the kernel, C library, and underlying runtime package. Each component can provide a large number of configuration options (the real-time kernel can also be an optional configuration), and using eCos configuration tools can easily configure eCos to meet different embedded application requirements.
10. Dujiangyan Operating System (djyos)
(Note: The official website of the Dujiangyan Operating System indicates that the STM32 F4 and F7 have not been debugged.)Dujiangyan Operating System, abbreviated as djyos, is named after a great water conservancy project: Dujiangyan.Unlike traditional operating systems, djyos is scheduled based on events rather than threads. This scheduling algorithm allows programmers to break free from the mindset of programming according to the computer’s execution process, and instead write applications in a way that aligns with human cognitive processes, similar to introducing VC into embedded programming.The scheduling algorithm of djyos allows programmers to break free from the constraints of threads and processes. djyos has no APIs related to threads, allowing programmers without any knowledge of threads to successfully write applications under djyos.
The djyos operating system schedules based on events, allowing programmers to program according to human cognitive habits rather than computer habits.
11. Alios Things
According to the well-known media embedded operating system RTOS introduction, AliOS Things is a scalable IoT operating system under the AliOS family, aimed at the IoT field. AliOS Things aims to build an integrated IoT infrastructure, featuring extreme performance, simple development, cloud integration, rich components, and security, supporting terminal devices to connect to Alibaba Cloud Link, and can be widely applied in fields such as smart homes, smart cities, and new mobility.Comment: Backed by Alibaba’s resources, AliOS Things is a powerful player entering the IoT market, collaborating with chip and module manufacturers, but this is also its biggest disadvantage!
12. Huawei LiteOS
The embedded operating system RTOS introduction, Huawei LiteOS is a lightweight IoT operating system built by Huawei for the IoT field, featuring lightweight low power consumption, fast startup, interoperability, and security, providing developers with a complete software platform, effectively lowering development thresholds and shortening development cycles.
Comment: A Huawei system, but its level of openness is relatively low, mainly used for Huawei’s own products, protected by a large tree.
13. RT-Thread
The embedded operating system RTOS introduction, RT-Thread is a technology platform that integrates a real-time operating system (RTOS) kernel, middleware components, and a developer community, developed by Mr. Xiong Puxiang and the open-source community. RT-Thread is also a complete, rich component, highly scalable, easy to develop, ultra-low power consumption, and highly secure IoT operating system.RT-Thread has all the key components required for an IoT OS platform, such as GUI, network protocol stack, secure transmission, low-power components, etc. After 11 years of development, RT-Thread has the largest embedded open-source community in China and is widely used in industries such as energy, automotive, medical, and consumer electronics, with a cumulative installation of over 20 million units, becoming the most mature and stable open-source RTOS developed independently by Chinese people.Comment: Most likely to become the top 1 in China, with advantages in rich components and a neutral position! It has seized the opportunity and gained support from many chip manufacturers, and is also popular among developers. Its disadvantage is that its tutorial documentation is still weaker than that of FreeRTOS and similar systems.
14. SylixOS
The embedded operating system RTOS introduction, SylixOS is an open-source, cross-platform large real-time operating system (RTOS), born in 2006. After more than a decade of continuous development, SylixOS has become one of the most comprehensive domestic operating systems. It has numerous product and project application cases, covering industries such as aerospace, military defense, rail transportation, smart grid, and industrial automation. SylixOS fully complies with POSIX standards, making it very convenient for the open-source community to port rich free software.Comment: This company is also quite interesting; it started in 2006 and has been in the military industry, recently gaining attention. Its strength should not be underestimated!Of course, RTOS is not limited to the above; everyone is welcome to leave comments and add more!Author: Potato ScholarSource: A Bite of LinuxWarm Reminder:
Due to recent changes in WeChat’s public platform push rules, many readers have reported not seeing updated articles in time. According to the latest rules, it is recommended to click on “Recommended Reading, Share, Collect” more often to become a regular reader.
Recommended Reading:
What levels of hardware development have you reached?
Another executive of the big fund has been investigated, involving multiple listed companies!
Confirmed! The US NSA’s cyber attack on Xi’an University of Technology’s ulterior motive has been exposed.
Please click 【View】 to give the author a thumbs up