Design and Application of Embedded Linux System

  

I. INTRODUCTION

Embedded Systems (Embedded Systems) integrates operating systems and functional software into computer hardware systems according to application requirements. A computer system that integrates software and hardware. Embedded systems emerged in the late 1960s and were originally used to control electromechanical telephone switches. They are now widely used in industrial manufacturing, process control, communications, instrumentation, instrumentation, automotive, marine, aerospace, aerospace, military equipment, and consumer. There are many fields such as products. The number of embedded systems far exceeds the number of general-purpose computer systems: the core CPU of computer systems, and the annual output in the world is about 2 billion. More than 80% of them are used in various special embedded systems. System.

In general, any dedicated hardware and software system with a microprocessor can be called an embedded system. Compared with the general computing platform, embedded systems often have the characteristics of single function, small size, low power consumption, high reliability, good tailoring, high integration of software and hardware, and relatively low computing power. For many years, there were no operating systems in embedded devices. There are two main reasons: First, devices such as washing machines, microwave ovens, and refrigerators only need a simple control program to manage a limited number of buttons and indicators. The system is necessary; secondly, it often has limited hardware resources and is not sufficient to support an operating system.

However, with the development of hardware, embedded systems have become more and more complex, and many functions have been gradually added to the original control program, and many of these functions can be provided by the operating system. As a result, embedded operating systems emerged in the late 1970s, which greatly simplified application design and effectively guaranteed software quality and shortened development cycles. A simple ES generally does not use an operating system and only contains some control processes. However, as the embedded operating system grows in complexity, simple process control cannot meet the requirements of the system. This is why the operating system must be considered. system software. Therefore, the embedded operating system came into being.

With the wide application of EOS, the industry has launched some EOS products with relatively successful applications. In summary, EOS should have the following characteristics: small, real-time, loadable, solidified code, weak interactivity, strong stability and a unified interface. The most widely used EOS products include: Vxwork, QNX, PalmOS, WindowsCE, pSOS, and Hopen OS (developed by domestic Kaisi Group). Among them, Vxwork is the most widely used and has the highest market share. Its outstanding feature is its strong real-time performance (using priority preemption and rotation scheduling mechanisms). In addition, its reliability and tailorability are also quite good. QNX is a highly scalable system with a core plus real-time POSIX environment and a full window system of less than a megabyte. In contrast, Microsoft WinCE has a large core and unsatisfactory real-time performance, but it is gaining a bigger market due to the Windows user-friendly user interface and APIs familiar to programmers, and bundled with applications such as IE and Office. Share. Compared with these commercial operating systems, Linux has received more and more attention.

Second, embedded Linux overview

Linux is a mature and stable network operating system. Implanting Linux into embedded devices has numerous advantages. First of all, the source code of Linux is open, and anyone can get and modify it to develop its own products. Second, the Lirmx is customizable, with a system core of at least 134kB. A core program with a Chinese system and a graphical user interface can also be less than 1MB and is equally stable. In addition, it is compatible with most Unix systems, and application development and porting is fairly easy. At the same time, because of its good portability, Linux has been successfully run on hundreds of hardware platforms.

However, Linux is not designed for real-time applications, so if you want to run Linux on an embedded system with high real-time requirements, you must add real-time software modules. The kernel space in which these modules run is part of the operating system's implementation of process scheduling, interrupt handling, and program execution, so erroneous code can corrupt the operating system and affect the reliability and stability of the entire system. The many advantages of Linux still make it widely used in the embedded field, and there are a large number of embedded Linux systems. Representatives include: uClinux, ETLinux, ThinLinux, LOAF, etc. ETLinux is commonly used in small industrial computers, especially PC/104 modules. ThinLinux is targeted at dedicated camera servers, X-10 controllers, MP3 players and other similar embedded applications. LOAF is an acronym for Linux On A Floppy, which runs on the 386 platform.

Third, Linux as an embedded operating system advantage

Linux as an embedded operating system has the following advantages:

1, can be applied to a variety of hardware platform. Linux has been ported to a variety of hardware platforms, which is attractive for funding and time-limited research and development projects. Prototypes can be ported to specific hardware after development on a standard platform, speeding up the software and hardware development process. Linux uses a unified framework to manage the hardware, and changes from one hardware platform to another are independent of the upper application. Linux can be configured at will, without any license or merchant partnership, the source code is free. This makes Linux use as an operating system without any disputes about copyright. There is no doubt that this will save a lot of development costs. The built-in network support itself, and the current embedded system requires more and more network support. The high degree of modularity of Linux makes it easy to add components.

2, Linux is a Unix-like, kernel-based, full memory access control, supporting a large number of hardware (including most existing chips such as X86, Alpha, ARM and Motorola) A general-purpose operating system. The source code of the program is fully public and can be modified by anyone and distributed under the GNU General Public License. This way, developers can customize the operating system to suit their specific needs.

3, Linux with sophisticated development tools familiar to Unix users, almost all Unix system applications have been ported to Linux. Linux also provides powerful networking features and a variety of selectable window managers (X Windows). Its powerful language compiler GCC, C++, etc. can also be easily obtained, not only mature but also easy to use.

Fourth, the establishment of embedded Linux

The complete embedded Linux solution should include the embedded Linux operating system kernel, operating environment, graphical interface and application software. Due to the special requirements of embedded devices, the kernel, environment, GUI, etc. in the embedded Linux solution are very different from the standard Linux. The main challenge is how to implement high-quality tasks in a small FLASH, ROM and memory. Scheduling, graphical display, network communication and other functions.

1. Streamline the kernel

The Linux kernel has its own architecture, in which process management, memory management and file system are the three basic subsystems. Figure 1 shows its frame in a nutshell. User processes can access kernel resources directly through system calls or function libraries. Because the Linux kernel has such a structure, it is necessary to pay attention to the coordination between the various subsystems when modifying the kernel.

The embedded Linux kernel is typically tailored from the standard Linux kernel. Users can configure the system according to their needs, eliminating unnecessary service functions, file systems and device drivers. After cutting and compressing, the system kernel is generally only about 300k, which is very suitable for embedded devices. Unlike standard Linux, embedded Linux must be booted from FLASH or ROM. The standard Linux boot code implements system initialization and booting the kernel from floppy and hard disk O extents. Embedded Linux is generally stored in FLASH or ROM, and standard LILO cannot be booted. In systems that support direct booting from FLASH devices, such as Huaheng's uClinux, the bootloader mainly completes the initialization of the hardware system and the decompression and shifting of the operating system. In systems that do not support booting directly from FLASH, FLASH devices can only be used as non-boot disks. At this point, you can first load a small operating system from the hard disk or floppy disk, such as embedded DOS, and then execute the "Loadlin" loader to boot embedded Linux from FLASH.

Modifications to standard Linux are primarily changes to the virtual memory and scheduler sections. Because the standard Linux system uses virtual memory management to run multiple processes at the same time, but the CPU time slice that each running process can allocate is limited, and the resource usage efficiency is low. In this way, for embedded systems with high real-time requirements, real-time tasks often require CPUs to have high burst processing power, that is, in some cases, extremely high processing efficiency is required, so the virtual memory management mechanism of the kernel needs to be shielded. For embedded systems without hard disk devices, virtual memory management is not necessary. Embedded applications with strong real-time requirements can be implemented by modifying the task scheduling module, mainly by adding many switching points to the kernel and device drivers. At this point, the system detects if there are unhandled emergency interrupts, and then deprives the kernel of its operation and processes the interrupts in a timely manner. A better way to implement real-time services is to add a real-time kernel to the standard Linux kernel. The standard Linux kernel runs as a task on the real-time kernel, and strong real-time tasks run directly on the real-time kernel, such as RT-Linux. Wait.

The file system is essential for the embedded Linux operating system. However, standard Linux supports a large number of file systems, so in addition to retaining one of the normal operating needs of the system, all others can be deleted, and can be removed using the original setting options. The general embedded device file system mainly uses RamDisk technology and network file system technology. RamDisk can reside in Flash and be loaded into memory at runtime.

Copyright © Windows knowledge All Rights Reserved