- Introduction to μC/OS-II
μC/OS-II is a real-time operating system with open source code, compact structure and deprivable real-time kernel. The predecessor of LC/OS-11 is μC/OS, which originated from the serial articles published in the May and June issues of Embedded System Programming magazine by American embedded system expert Labrosse in 1992 . The source code for /OS is published on the magazine’s bulletin board system (BBS).
μC/OS and μC/OS-II are specially designed for embedded computer applications, and most of the codes are written in C language. The hardware-related parts of the CPU are written in assembly language, and the assembly language part of about 200 lines in total is compressed to a minimum for easy porting to any other CPU. As long as users have standard ANSI C cross compilers, assemblers, connectors and other software tools, they can embed μC/OS-II into the developed products. μC/OS-II has high execution efficiency, small footprint, real-time With excellent performance and strong scalability, the minimum kernel can be compiled to 2KB, and μC/OS-II has been transplanted to almost all well-known CPUs.
The μC/OS-II kernel mainly includes core module, task management module, clock management module of software timer, inter-task synchronization and communication module, memory management module and transplant related modules. The core of the system is the core module (OS-CORE.C), including operating system initialization, task scheduling, interrupt management, clock beat processing, event processing and other parts. The core module contains the basic functions to maintain the operation of the system. The functions in it can only be called by the operating system functions and cannot be used by user programs.
In μC/OS-II, the task management module (OS TASK.C) includes task establishment, suspension, recovery, deletion, etc., and is closely related to the operation of the task. The clock tick (timetick) is the smallest clock unit in μC/OS-II, and the clock management module (OS_TIME.C) mainly includes functions related to task delay. The event processing module includes semaphores, mailboxes, mutexes, message queues and event flags, which are mainly used for synchronization and communication between tasks. μC/OS-II uses static partitioning to manage dynamic memory, which lacks flexibility. The μC/OS-II architecture is shown in Figure 1.
- μC/OS-II system features
An embedded operating system is a special computer system that is embedded in an object to control it for the purpose of realizing object intelligence. It integrates software and hardware, is responsible for the allocation and scheduling of system resources, and has the basic characteristics of a general-purpose operating system. Compared with the conventional computer system, the embedded operating system μC/OS-II has the following characteristics.
(1) High miniaturization. Because embedded operating systems can usually use fewer resources, embedded operating systems cannot take up too many resources. Embedded operating systems must be miniaturized as much as possible to save resources on the premise of satisfying functions.
(2) Special purpose is strong. Because the hardware and software used in the embedded operating system are usually designed for a specific function, the embedded system usually has high special-purpose.
(3) Good real-time performance. Because embedded systems are widely used in industry and even national defense, embedded systems must have strong real-time performance. In order to make the system have the ability to respond quickly, the embedded operating system must be designed as a deprived kernel.
(4) Good tailoring. Because the embedded operating system is highly specialized, the hardware and software configuration of each use case is not the same. This requires the embedded system to have good tailoring, so as to achieve the most reasonable configuration under the conditions of application according to different applications, so as to achieve a balance between generality and speciality.
(5) Good portability. Because the application scope of the embedded operating system is very wide, in order to adapt to different hardware platforms, the embedded operating system must have very good portability, so that it can be stably transplanted to different platforms with the least modification to the file.
(6) High reliability. Because embedded operating systems are usually used in industrial control and other occasions, and even in industries that are closely related to the safety of people’s lives and properties, such as military and transportation, embedded operating systems must have extremely high reliability and even have the necessary fault tolerance. mechanism to further improve the reliability of the system.
(7) Low power consumption. Since an embedded operating system is usually used in small systems that use batteries, it must have low power consumption in order to better extend the operating time of the system.
Read more: New energy vehicle performance indicators