The difference between uC/OS and uClinux operating system

Embedded system is based on embedded computer, user-oriented, product-oriented, application-oriented, software and hardware can be cut, suitable for computer systems with strict requirements on functions, reliability, volume, cost, power consumption and other comprehensive performance.

Embedded real-time operating systems generally provide multi-tasking task scheduling, time management, inter-task communication and synchronization, and memory management MMU (Memory Manager Unit) and other important services, making embedded applications easy to design and extend.

The UC/OS and uClinux operating systems use two free embedded operating systems with excellent performance, open source and widely used. After comparing uC/OS and uClinux, analyze and summarize several important issues in embedded operating system applications. Summarize the selection basis of the operating system in embedded system development.

1. Introduction to uC/OS and uClinux operating system
The difference between uC/OS and uClinux operating system

The uC/OS and uClinux operating systems are two free and open source embedded operating systems that are currently widely used. UC/OS is suitable for small control systems, featuring high execution efficiency, small footprint, excellent real-time performance and high scalability. The smallest kernel can be compiled to 2KB. UClinux inherits the excellent features of standard Linux. An operating system designed for the characteristics of embedded processors has embedded network protocols and supports multiple file systems. Developers can take advantage of standard Linux prior knowledge. Its compiled object file can be controlled on the order of hundreds of kilobytes.

UC/OS is a free, open source, compact, real-time operating system with a deprived real-time kernel. Its core provides tasks scheduling and management, time management, synchronization and communication between tasks, memory management and interrupt services.

UClinux is an excellent embedded Linux version. uClinux is an abbreviation for Micro-Conrol-Linux. Compared with standard Linux, it integrates the main advantages of the stability of the standard Linux operating system, powerful network functions and excellent file system. But because there is no MMU (memory management unit), its multitasking implementation requires some skill.

2, uC / OS and uClinux operating system main performance comparison
The difference between uC/OS and uClinux operating system

The embedded operating system is the control center of the embedded system software and hardware resources. It organizes multiple users to share various resources of the embedded system in a reasonable and effective way. The user refers to all the software on top of the system program. The so-called reasonable and effective method refers to how the operating system coordinates and makes full use of hardware resources to achieve multi-tasking. Complex operating systems support file systems, making it easy to organize files and to standardize operations.

Another feature of the embedded operating system is that the system is not directly available for different platforms, and generally needs to be operated by a migration operating system for a dedicated platform.

Process scheduling, file system support, and system migration are the most common problems in the practical application of embedded operating systems. The following is an analysis and comparison of uC/OS and uClinux from these several perspectives.

1) Process scheduling

Task scheduling is mainly to coordinate the task for the use of computer system resources (such as memory, I / O devices, CPU). Process scheduling, also known as CPU scheduling, is the fundamental task of analyzing CPUs for processes in a ready state according to certain principles. Since the memory and I/O devices in the embedded system are generally attributed to a process at the same time as the CPU, the concept of task scheduling and process scheduling is similar, and many occasions do not distinguish.

Process scheduling can be divided into two basic modes: “deprivation scheduling” and “non-deprivation scheduling”. The so-called "non-deprivation scheduling" means that once a process is scheduled to execute, the process continues until the process ends, or the CPU is reassigned to other processes because it abandons the CPU to enter the wait state. The so-called "deprivation scheduling" means that once a higher priority process occurs in the ready state, or the running process has been used up to the specified time slice, the current process is immediately deprived (put it back to the ready state). , assign the CPU to other processes.

As a real-time operating system, uC/OS uses a deprived real-time multitasking kernel. The deprived real-time kernel runs the highest priority task at all times. Up to 64 tasks can be supported in uC/OS, corresponding to priority levels 0 to 63, where 0 is the highest priority. The content of the scheduling work can be divided into two parts: the search for the highest priority task and the task switching.

Its highest priority task table is implemented. Each task in UC/OS has a separate stack space and has a data structure called Task Control Block (TCB), where the first member variable is the saved task stack pointer. The task scheduling module first records the TCB address of the current highest-level ready task with the variable OSTCBHighRdy, and then calls the OS_TASK_SW() function to perform task switching.

UClinux's process scheduling follows the tradition of Linux. The system suspends the process at regular intervals, and generates fast and periodic clock-time interrupts. The scheduling function (timer handler) determines when the process has its time slice and then performs related process switching. This is achieved by the parent process calling the fork function to generate the child process.

After the UClinux system fork call is completed, either the child process is replaced by the parent process (the parent process is already hibernating) until the child process calls exit to exit; or the exec is called to execute a new process, and the executable file is loaded, even if this The process is just a copy of the parent process, and this process is inevitable. When the child process executes exit or exec, the child process wakes up the parent process using wakeup, causing the parent process to continue executing.

Since uClinux does not have MMU management memory, its access to memory is direct, and the addresses accessed in all programs are actual physical addresses. The operating system has no protection for memory space, and each process actually shares a running space. This requires data protection when implementing multiple processes, and also causes the space used by the user program to occupy the system kernel space. These problems need to be paid attention to when programming, otherwise it will easily lead to system crash.

It can be known from the above analysis that the uC/OS kernel is designed and implemented for real-time system requirements, which is relatively simple and can meet high real-time requirements. However, uClinux inherits the standard Linux multi-tasking implementation only. Improved for embedded processor features. To achieve real-time effects, the system needs to be run under the control of the real-time kernel. RT-Linux is a real-time kernel that can do this.

2) File system

The so-called file system is the organization that is responsible for accessing and managing file information. It can also be said to be responsible for the establishment, cancellation, organization, reading, writing, modification, copying and management of files (such as catalogues, storage media, etc.). The software part of the implementation management.

uC/OS is for small and medium-sized embedded systems. If all functions (semaphores, message mailboxes, message queues, and related functions) are included, the compiled uC/OS kernel is only 6 to 10 KB, so the system itself does not have support for the file system. However, uC/OS has good scalability and can add the contents of the file system if necessary.

uClinux inherits the perfect file system performance of Linux. It uses the romfs file system. This file system requires less space than a typical ext2 file system. Space savings come from two aspects: First, the kernel supports the romfs file system requires less code than the ext2 file system. Second, the romfs file system is relatively simple, requiring less storage space when building a file system superblock. . The Romfs file system does not support dynamic erasing and saving. The system needs to use the virtual ram disk for data that needs to be dynamically saved (the ram disk will use the ext2 file system).

uClinux also inherits the advantages of the Linux network operating system, which can easily support the network file system and embed the TCP/IP protocol. This provides convenience for uClinux to develop network access devices.

Support for file systems by two operating systems shows that uClinux is a good choice for complex embedded systems that require more file processing; uC/OS is mainly suitable for some control systems.

3) Migration of the operating system

The purpose of the embedded operating system migration is to enable the operating system to run on a microprocessor or microcontroller. Both UC/OS and uClinux are open source operating systems, and their structured design facilitates the separation of processor-related parts, so it is possible to be ported to new processors. The following describes the transplantation of the two systems separately.

(1) transplantation of uC/OS

To port uC/OS, the target processor must meet the following requirements:

a, the processor's C compiler can generate reentrant code, and can open and close interrupts in C language;

b, the processor supports interrupts, and can generate timing interrupts;

c, the processor supports enough RAM (several KB) as a task stack in a multi-tasking environment;

d. The processor has instructions to read and store the stack pointer and other CPU registers onto the stack or memory.

After understanding the technical details of the processor and C compiler, the uC/OS porting only needs to modify the processor-related code. Specifically, the following contents are as follows:

a, OS_CPU.H need to set a constant to identify the stack growth direction;

b. Several macros for switching interrupts and task switching need to be declared in OS_CPU.H;

c, OS_CPU.H needs to redefine a series of data types for the word length of the specific processor;

d, OS_CPU_A.ASM needs to rewrite the functions of 4 assembly languages;

e, OS_CPU_C.C needs to write 6 simple functions in C language;

f. Modify the main header file INCLUDE.H and add the above three files and other header files.

(2) transplantation of uClinux

In fact, uClinux is an improvement of Linux for embedded systems, and its structure is more complicated; compared to uC/OS, the migration of uClinux is much more complicated. In general, to transplant uClinux, the target processor needs to have sufficient capacity (several hundred KB or more) of external ROM and RAM in addition to the conditions that the above uC/OS should satisfy.

The migration of uClinux can be roughly divided into three levels.

a, the structural level of transplantation. If the structure of the processor to be ported is different from any supported processor structure, you need to modify the file of the relevant processor structure in the linux/arch directory. Although most of the uClinux kernel code is independent of the processor and its architecture, the lowest level of code is specific to each system. This is mainly manifested in their interrupt handling context, kernel mapping maintenance, task context and initialization process are unique. These routines are located in the lunux/arch/ directory. Due to the wide variety of architectures supported by Linux, for a new type of system, its low-level routines can be written in analogy to similar system routines.

b. Platform level migration. If the processor to be ported is a processor of a supported system of uClinux, you need to create the corresponding directory and write the corresponding code in the relevant architecture directory. For example, the MC68EZ328 is based on the M68k core without MMU. At this time, the migration needs to be created under the linux/arch/m68knommu/platform/MC68EZ328 directory, and the tracking program (the function of realizing the user program to the kernel function interface), the interrupt control scheduler, and the vector initialization program are written.

c, the extreme level of transplantation. If the processor used is already supported by uClinux, only the board level migration is required. Board level migration needs to be in linux/arch/? Create a directory of the corresponding board in platform/, and then create the corresponding startup code crt0_rom.s or crt0_ram.s and the key description document rom.ld ​​or ram.ld. Board-level migration also includes driver writing and environment variable settings.

to sum up

By comparing uC/OS and uClinux, it can be seen that the two operating systems have their own advantages and disadvantages in application. uC/OS takes up less space, performs more efficiently, has better real-time performance, and is relatively simple to port for new processors. UClinux takes up relatively large space, real-time performance is general, and the transplantation for new processors is relatively complicated. However, uClinux has the ability to support multiple file systems, embedded TCP/IP protocol, and can draw on Linux's rich resources. For some complex applications, uClinux has considerable advantages. For example, CISCO's 2500/3000/4000 router is based on the uClinux operating system. In short, the choice of operating system is determined by the needs of the embedded system. Simply put, a small control system can take advantage of the small and real-time nature of uC/OS; uClinux is a good choice if you are developing a more complex system such as PDAs and Internet connection terminals.

Stylus Pen For IPad

Product catagories of stylus pen for ipad, which is just for iPad Versions 2018 & 2019 and above.

It can work on following:

iPad 6th 2018: A1893/A1954
iPad 7th 2019: A2197/A2198/A2200
iPad 8th 2020: A2270/A2428/A2429/A2430
iPad air 3rd: A2152/A2153/A2154/A2123
iPad Air 4th: A2072/A2316/A2324/2325
iPad mini 5th: A2124/A2125/A2126/A2133
iPad Pro 1st/2nd 11: A1980/A2013/A1934/A1979/A2228/A2068/A2230/A2231
iPad Pro 3rd/4th 12.9: A2069/A2229/A2233/A2232/A1876/A2014/A1895/A1983



Stylus Pen For Ipad,Stylus Pen,Stylus Pen For Drawing,Touch Pencil

Shenzhen Ruidian Technology CO., Ltd , https://www.wisonens.com

This entry was posted in on