Introduction of five embedded operating systems based on STM platform and satisfying real-time control requirements

Based on the STM platform and meeting the real-time control requirements of the operating system, there are the following 5 types to choose from for transplantation. They are μClinux, μC / OS-II, eCos, FreeRTOS and rt-thread. The characteristics and deficiencies of these five embedded operating systems are introduced below. By comparison, readers can choose the appropriate platform according to their application requirements.

Introduction of five embedded operating systems based on STM platform and satisfying real-time control requirements

TOP1: μClinux

μClinux is an excellent embedded Linux version, its full name is micro-control Linux, which literally refers to micro-control Linux. Compared with standard Linux, the core of μClinux is very small, but it still inherits the main features of the Linux operating system, including good stability and portability, powerful network functions, excellent file system support, and a rich standard API And TCP / IP network protocol. Because there is no MMU memory management unit, so its multi-task implementation requires certain skills.

μClinux inherits the standard Linux multi-task implementation in structure, divided into real-time processes and ordinary processes, using first-come-first-served and time slice rotation scheduling, only to improve the characteristics of low-end embedded CPUs, and does not support kernel preemption , General real-time.

In terms of memory management, μClinux is designed for processors without MMUs. The processor's virtual memory management technology cannot be used, and only real memory management strategies can be used. The system uses the paging memory allocation method to paging the actual memory at startup. The system's access to memory is direct, the operating system has no protection for the memory space, and multiple processes can share a running space, so even an unprivileged process calling an invalid pointer will trigger an address error and may cause the program Crash or even system crash.

The interrupt management of μClinux operating system divides the interrupt processing into two parts: top half processing and bottom half processing. In the top half of the process, the interrupt operation must be turned off, and only necessary, very few, and fast processing is performed, and the other processes are handed over to the bottom half of the process; the bottom half of the process performs those complex and time-consuming processes, and accepts interrupts. Because there is a lot of interrupt processing in the system, it will cause a delay in the system interrupt processing.

μClinux supports the file system well. Because μClinux inherits the perfect file system performance of Linux, it supports file systems such as ROMFS, NFS, ext2, MS-DOS, and JFFS. However, the ROMFS file system is generally used, and this file system occupies less space than the general file system (such as ext2). However, the ROMFS file system does not support dynamic erasure and storage, and the data that the system needs to dynamically save must be processed by the method of virtual RAM disk / JFFS.

In support of hardware, since μClinux inherits most of the performance of Linux, at least 512KB of RAM space and 1MB of ROM / Flash space are required.

In terms of transplantation of μClinux, μClinux is an improvement of Linux for embedded systems, and its structure is relatively complicated. To transplant μClinux, the target processor needs external ROM and RAM with sufficient capacity in addition to the modification of the code related to the processor.

The biggest feature of μClinux is that it is designed for no MMU processor, which is suitable for stm32f103 without MMU function, but transplanting this system requires at least 512KB of RAM space, 1MB of ROM / FLASH space, and stmf103 has 256K FLASH External memory, which increases the cost of hardware design. μClinux has a complicated structure, relatively difficult to transplant, a large kernel, and poor real-time performance. If the embedded product developed focuses on file systems and network applications, μClinux is a good choice.

TOP2: μC / OS-II

μC / OS-II is developed on the basis of μC / OS. It is a compact, preemptive multitask real-time kernel written in C language. μC / OS-II can manage 64 tasks, and provide functions such as task scheduling and management, memory management, synchronization and communication between tasks, time management and interrupt service. It has high execution efficiency, small footprint, excellent real-time performance and scalability Strong and other characteristics.

For real-time satisfaction, because the μC / OS-II kernel is designed and implemented for the requirements of real-time systems, it only supports preemptive scheduling based on fixed priority; the scheduling method is simple and can meet the higher real-time requirements.

In terms of memory management, μC / OS-II manages consecutive large blocks of memory as partitions. Each partition contains an integer number of memory blocks of the same size, but the size of the memory can be different between different partitions. When users dynamically allocate memory, they only need to select an appropriate partition to allocate memory by block, and put the block back to the previous partition when it is released, thus eliminating the problem of fragmentation caused by multiple dynamic allocation and release of memory .

μC / OS-II interrupt processing is relatively simple. Only one interrupt service subroutine ISR can be linked to an interrupt vector, and the user code must be completed in the ISR (interrupt service routine). The more things ISR needs to do, the longer the interrupt latency. The maximum nesting depth that the kernel can support is 255.

In terms of file system support, since μC / OS-II is for small and medium-sized embedded systems, even if it contains all functions, the kernel is less than 10 KB after compilation, so the system itself does not provide support for the file system. However, μC / OS-II has good expansion performance, and you can add the contents of the file system if you want.

In terms of hardware support, μC / OS-II can support most of the currently popular CPUs. ΜC / OS-II has a very small kernel due to its own core, and the minimum code size after clipping can be 2KB. For 4 KB, the transplantation of μC / OS-II is relatively simple, and only need to modify the code related to the processor.

μC / OS-II is an embedded operating system kernel with simple structure, complete functions and strong real-time performance. It is very suitable for CPUs without MMU function. It requires very little kernel code space and data storage space, has good real-time performance, good scalability, and is open source. There are many materials and examples on the Internet, so it is very suitable for porting to stm32f103 this CPU.

TOP3: eCos

eCos (embedded Configurable operating system), that is, embedded configurable operating system. It is an open source configurable, portable, real-time operating system for deeply embedded applications. The biggest feature is the flexible configuration and the modular design. The core part is composed of the components of Xiaotong, including the kernel, C language library and the bottom running package. Each component can provide a large number of configuration options (the real-time kernel can also be used as an optional configuration). It can be easily configured using the configuration tool provided by eCos, and through different configurations, eCos can meet different embedded application requirements.

On the negative side of real-time, due to the rich scheduling methods of eCos, two priority-based schedulers (ie, bitmap scheduler and multi-level queue scheduler) are provided, allowing users to choose one of the schedulers during configuration. Therefore, it performs well in real time.

In memory management, eCos does not segment or page memory allocation, but uses a dynamic memory allocation mechanism based on memory pools. Two memory management methods are implemented through two memory pools: one is a variable-length memory pool; the other is a fixed-length memory pool, similar to the management scheme of VxWorks.

In interrupt management, eCos uses a hierarchical interrupt processing mechanism to divide interrupt processing into traditional ISR (interrupt service routine) and lag interrupt service routine DSR (deferred service routine). Similar to the processing mechanism of μClinux, this mechanism can run DSR when interrupts are allowed, so it allows high-priority interrupts and processing when processing lower-priority interrupts. In order to greatly shorten the interruption delay, ISR should be able to run quickly. If the amount of service caused by the interruption is small, the ISR can handle the interruption alone; if the interruption service is complex, the ISR only shields the interrupt source, and then it is handled by the DSR (Deferred Service Program).

The configurability of the eCos operating system is very powerful, users can join the required file system by themselves. The eCos operating system also supports most of the currently popular embedded CPUs. The eCos operating system can be ported between different architectures such as 16-bit, 32-bit, and 64-bit. Since eCos itself has a small core, the code after clipping can be at least 10 KB, and the minimum data RAM space required is 10 KB.

In terms of system transplantation, the portability of eCos operating system is very good, which is easier than μC / OS-II and μClinux.

The biggest feature of eCos is its flexible configuration, and it supports the transplantation of CPU without MMU. It is open source and has good portability. It is also suitable for transplanting to the CPU of stm32 platform. But the application of eCOS is not too extensive, not as common as μC / OS-II, and the data is not as much as μC / OS-II. eCos is suitable for some commercial or industrial grade cost-sensitive embedded systems, such as some applications in the field of consumer electronics.

TOP4: FreeRTOS

Because RTOS needs to occupy certain system resources (especially RAM resources), only a small number of real-time operating systems such as μC / OS-II, embOS, salvo, FreeRTOS, etc. can run on small RAM microcontrollers. Compared with C / OS-II, embOS and other commercial operating systems, FreeRTOS operating system is a completely free operating system, with the characteristics of open source code, portability, cutability, flexible scheduling strategy, and can be easily transplanted to various single-chip microcomputers. , The latest version is version 6.0.

As a lightweight operating system, the functions provided by FreeRTOS include: task management, time management, semaphore, message queue, memory management, recording functions, etc., which can basically meet the needs of smaller systems. The FreeRTOS kernel supports priority scheduling algorithm, each task can be given a certain priority according to the different degree of importance, the CPU always allows the highest priority task in the ready state to run first. The FreeRT0S kernel also supports a rotation scheduling algorithm. The system allows different tasks to use the same priority. In the absence of higher priority tasks, tasks of the same priority share the CPU time.

The kernel of FreeRTOS can be set as a deprivable kernel or an inalienable kernel according to user needs. When FreeRTOS is set as a deprivable kernel, high-priority tasks in the ready state can deprive the CPU of low-priority tasks, which can ensure that the system meets the real-time requirements; when FreeRTOS is set as an inalienable kernel High-priority tasks in the ready state can only be run after the currently running task actively releases the CPU usage rights, which can improve the CPU's operating efficiency.

FreeRTOS transplantation: FreeRTOS operating system can be easily transplanted to different processors to work, and now provides transplantation of ARM, MSP430, AVR, PIC, C8051F and other processors. The porting of FrceRTOS on different processors is similar to μC / OS-II, so this article will not detail the porting of FreeRTOS. In addition, the TCP / IP protocol stack μIP has been ported to FreeRTOS, the specific code can be found on the FreeRTOS website

Compared with the common μC / OS-II operating system, FreeRTOS operating system has both advantages and disadvantages. The shortcomings are reflected in the service functions of the system. For example, FreeRTOS only provides the implementation of message queues and semaphores, and it is not possible to send messages to the message queue in a later in first out order; The kernel requires a third-party GUI (graphical user interface), TCP / IP protocol stack, FS (file system), etc. to achieve a more complex system, unlike μC / OS-II which can be used with μC / GUI, μC / Seamless combination of FS, μC / TCP-IP, etc.

TOP5: rt-thread

RT-Thread is an open source real-time operating system (license GPLv2) mainly developed by the Chinese open source community. The real-time threaded operating system is not just a single real-time operating system kernel, it is also a complete application system, including various components related to real-time and embedded systems: TCP / IP protocol stack, file system, libc interface, graphical user interface Wait.

Developed by the Chinese themselves, the stable version is 1.2.1, hopefully after reading the source code. Streamlined and reliable, it comes with an on-chip debugging tool called finish, which is very practical. Various semaphores, mutex locks, mailboxes, events and other thread coordination functions are available.

It should be noted that the design idea of ​​rt-thread version 2.0 is completely different from that of 1.2, and Linux will be included. Yes, instead of embedding rt-thread in Linux, embedding Linux in rt-thread!

The rt-thread documentation is available on the official website. However, it is really only for reference. It is obviously compiled by the developer's post-development notes. At present, only by looking at the code to understand the detailed usage, it is difficult to restore the truth from the documents and forums. The advantage of rt-thread is that its version is still relatively small. Even if there is a lack of documentation, you can read the source code.

Tablet PC Pad


A tablet computer is an electronic device that integrates mobile commerce, mobile communication and mobile entertainment, with a touch recognition LCD screen, handwriting recognition and wireless network communication functions. At present, the tablet computer has become the most popular electronic product.

1.In appearance, the tablet computer looks like a large-screen mobile phone, or more like a separate LCD screen.

2.In terms of hardware configuration, a tablet computer has all the hardware devices of a traditional computer, and has its own unique operating system, compatible with a variety of applications, and has a complete set of computer functions.

3.Tablet PC is a kind of miniaturized computer. Compared with traditional desktop computers, tablet computers are mobile and flexible. Compared with notebook computers, tablet computers are more compact and more portable.

4.Tablet PC is a digital notebook with digital ink function. In daily use, you can use the tablet computer like an ordinary notebook, take notes anytime and anywhere, and leave your own notes in electronic texts and documents.


Tablet Pc Pad,Mobile Tablet,Scratch Pad Tablet Pc,Tablet Pc,Tablets & Presentation Equipment,Educational Tablet

Jingjiang Gisen Technology Co.,Ltd , https://www.jsgisentec.com

This entry was posted in on