One of the buildings of embedded Linux development: Into the world of embedded linux
content:
First, embedded system two, embedded Linux three, key technology four, small knots five, reference resources about the author
In the Linux area:
Tutorial Tools & Product Codes and Component Project Articles
Xiao Wenpeng (xiaowp@263.net) Master's degree in Computer Department, Beijing University of Science and Technology September 2003
With the development of information technology and the popularity of digital products, the embedded system of computer technology, chip technology and software technology is a hot spot, communication, computer, consumer electronics (3C) combined with computer technology, chip technology and software technology. The trend is gradually forming, and all networks and omnipotent calculations are brought into a new information society.
First, the embedded system embedded system is based on the application, based on computer technology, and hardware and software is a special computer system for strict requirements for function, reliability, cost, volume, power consumption. . The most typical feature of the embedded system is closely related to people's daily life. Any common person may have various types of electronic products, small to MP3, PDA and other micro-digital devices, large to information appliances. Smart Electric, Vehicle GIS, various new embedded devices have far more than general purpose computers. This is also no wonder that the famous future learner Nigero Pon Di is advised to visit China in January 1999. After 4 to 5 years, the embedded smart tool will become the greatest invention of computer industries after the PC and Internet. 1.1 History and Status Although the embedded system is really popular in recent years, but in fact embedded concept has already existed, from the emergence of single-chip microcomputer in the 1970s, various embedded micro-treatment The wide application of microcontrollers, and the embedded system has also had a history of nearly 30 years. Throughout the development of embedded systems, it has experienced the following four stages:
The initial application of the operating system phase embedded system is based on the microcontroller, mostly in the form of a programmable controller, has functions such as monitoring, servo, equipment indication, usually applied to various industrial control and aircraft, missiles and other weapons and equipment Generally, there is no support for operating systems, and can only be directly controlled by assembly language, and the memory is cleared after running. Although these devices have prelimated embedded application characteristics, but just use 8-bit CPU chips to perform some single-threaded programs, it is strictly not to talk about the concept of "system". The main features of this stage of embedded systems are: the system structure and function are relatively single, low processing efficiency, small storage capacity, and there is almost no user interface. Since this embedded system is simple and low, it has been widely used in the field of industrial control, but it is impossible to meet the needs of information appliances such as implementation efficiency and high storage capacity. During the 1980s, with the improvement of the microelectronics level, IC manufacturers began integrating the microprocessors, I / O interfaces, serial interfaces and RAM, ROMs, etc. needed in embedded applications. In a VLSI, a microcontroller that produces an I / O design is manufactured and a rookie in the field of union in the field of embedded systems. At the same time, the programmer of the embedded system has also begun to develop embedded applications based on some simple "operating system", which greatly reduces the development cycle and improves development efficiency. The main feature of this stage of embedded systems is: A large number of highly reliable, low-power embedded CPUs (such as Power PC, etc.), and various simple embedded operating systems begin to appear and develop rapidly. At this time, the embedded operating system is still relatively simple, but has initially has a certain compatibility and scalability, the kernel is ingenious and high, mainly used to control the system load and the operation of the monitoring application. In the 1990s, in the 1990s, under the traction of huge demand for distribution control, flexible manufacturing, digital communication and information appliances, the embedded system further rapidly developed, while the DSP products for real-time signal processing algorithms are high speed, high Accuracy, low power direction development. With the improvement of hardware real-time requirements, the software size of embedded systems is constantly expanding, and the real-time multitasking operating system (RTOS) is gradually formed, and begins to become the mainstream of the embedded system. The main feature of this phase of the embedded system is that the real-time performance of the operating system has been greatly improved, and it has been able to run on a variety of different types of microprocessors, highly modular and scalability. The embedded operating system at this time has functions such as file and directory management, device management, multitasking, network, graphical user interface (GUI), and provides a lot of application interface (API), making the application of application software Be easier. The internet phase 21st century will undoubtedly be a network of a network, and the voices of embedded systems to various network environments are naturally higher. At present, most embedded systems are still outside the Internet. With the further development of the Internet, and the combination of Internet technology and information home appliances, industrial control technology, the combination of embedded equipment and Internet is the true truly embedded technology. future. The information age and the number of digital ages have brought huge opportunities for the development of embedded systems, and also put forward new challenges for embedded system manufacturers. At present, the combination of embedded technology and Internet technology is driving the rapid development of embedded technology, and the research and application of embedded systems has produced a new significant change:
The new microprocessor is an endless, the design of the embedded operating system itself is more convenient to transplant, and more microprocessors can be supported in a short time. The development of embedded systems has become a system engineering. Developers must not only provide embedded hardware and software systems themselves, but also provide powerful hardware development tools and software support packages. New technologies used in generic computers, new ideas began to gradually transplant into embedded systems, such as embedded databases, mobile agents, real-time CORBA, etc., embedded software platforms are further improved. Various types of embedded Linux operating systems have developed rapidly. Due to the characteristics of source code open, small core small, high implementation efficiency, network structure is complete, and it is suitable for embedded systems such as information appliances. Currently, it has formed an energy and Windows CE, The embedded operating system such as Palm OS performs a strong competitive situation. Netization, informationization requirements With the increase in the maturity and bandwidth of Internet technology, the function of single equipment such as phones, mobile phones, refrigerators, microwaves, etc., the structure is more complicated, and the network internet is inevitable. trend. Streamline system kernels, optimize key algorithms, reduce power consumption and hardware and software costs. Provide more friendly multimedia human machine interaction interface. 1.2 Architecture According to the International Electrical and Electronic Engineer Association (IEEE), embedded systems are "control, monitoring, or secondary equipment, machines running" (Devices useed to control, monitor, or associist the operation of equipment, Machinery or Plants). In general, the architecture of the entire embedded system can be divided into four parts: embedded processors, embedded peripherals, embedded operating systems, embedded applications, as shown in Figure 1. Figure 1 Composition of embedded systems
The core of embedded processor embedded systems is a variety of embedded processors. The biggest difference between embedded processors and general processors is that most embedded CPUs work in a system specifically designed for specific user groups. It integrates many of the Tasks that are completed in the Universal CPU to the interior of the board to the interior of the chip, thereby facilitating the embedded system to be miniaturized while designing, while also high efficiency and reliability. The architecture of the embedded processor has undergone the transition from the CISC (complex instruction set) to the RISC (streamlined instruction set) and Compact Risc, from 4 digits, 8 bits, 16, 32 points to 64-bit. Currently used embedded processors can be divided into low-end embedded micro-controllers (MCU), MMPED Micro Processor Unit, EMPU, embedded DSP in computer communication Embedded Digital Signal Processor, EMBEDDED Digital Signal Processor, EMBEDDED Digital Signal Processor, EMBEDDED Digital Signal Processor, EMBEDDED Digital Signal Processor, EMBEDDED Digital Signal Processor, EMBEDDED Digital Signal Processor, EMBEDDED Digital Signal Processor, EMBEDDED Digital Signal Processor, EMBEDDED Digital Signal Processor, EDSP) and Height Integrated Embedded Sphin System (SOSTEM ON CHIP, SOC). At present, almost every semiconductor manufacturer produces embedded processors, and more and more companies have begun to have autonomous processor design departments. It has more than 1,000 kinds of embedded processors, and popular architectures in incomplete statistics. There are more than 30 series, including ARM, PowerPC, MC 68000, MIPS, etc. The most widely used. Embedded peripherals In embedding system hardware systems, in addition to the central control unit (MCU, DSP, EMPU, SOC), other components for completing storage, communication, commissioning, display, etc., in fact, act as embedded Peripheral equipment. Currently used embedded peripherals can be divided into three categories for storage devices, communication devices, and display devices. The storage device is mainly used for storage of various types of data, commonly used static volatile memory (RAM, SRAM), dynamic memory (DRAM) and non-volatile memory (ROM, EPROM, EEPROM, FLASH), where Flash With its ability to have a large number of erasable times, the storage speed is fast, the storage capacity is large, the price is cheap, etc. is widely used in the embedded field. Most communication devices that currently exist can be applied directly in an embedded system, including RS-232 interface (serial communication interface), SPI (serial peripheral interface), IRDA (infrared interface), I2C (fieldbus) , USB (General Serial Bus Interface), Ethernet (Ethernet Interface), etc. Due to the particularity of embedded applications, a peripheral display device such as a cathode ray tube (CRT), a liquid crystal display (LCD), and Touch Panel is usually used. In order to make the development of the embedded system more convenient and fast, the embedded operating system needs to be responsible for managing software modules such as memory allocation, interrupt processing, task scheduling, etc. This is the embedded operating system. The embedded operating system is a system software used to support embedded applications. It is an extremely important part of the embedded system, which typically includes the underlying driver, system kernel, device driver interface, communication protocol, graphical user interface (GUI) associated with hardware )Wait. The embedded operating system has the basic features of the general operating system.
However, compared with the general-purpose operating system, the embedded operating system has a more distinctive feature in terms of system real-time, hardware dependence, software curability, and application specificity. The embedded operating system can be divided into two categories according to application applications: a type of non-real-time system for consumer electronics, including personal digital assistant (PDA), mobile phone, set-top box (STB), etc .; It is a real-time operating system for control, communication, medical and other fields, such as Windriver's VxWorks, QNX system software company's QNX, etc. Real Time System is a system capable of completing system functions within a designated or determination time, and can respond promptly in synchronous or asynchronous times. In real-time systems, the correctness of the operation is not only on the correct level of logic design, but also related to these operations, that is, real-time systems requires very strict requirements for logic and timing, if logic and timing control have deviations It will produce serious consequences. Real-time systems mainly measure the real-time performance of the system, the response time (SURVIVAL TIME) and throughput by three performance indicators, the survival time, and throughput:
The response time is the real-time system from identifying an external event to a response time; the living time is the effective wait time of the data, and the data is only valid for this time; throughput is in a given time system The total number of events is processed, and throughput is usually small than the average response time. Real-time systems can be divided into three kinds of weak real-time systems, general real-time systems, and strong real-time systems depending on the response time. Weak real-time system in design is to make the faster the tasks run, but there is no strict limit to complete, and the weak real system is more concerned about the correctness of the program operation results. And other aspects such as system security, relatively relatively relatively relatively relatively relatively relatively relatively relatively relatively relative to task execution time, and the general response time can be several seconds or longer. Generally, real-time systems is a trade-off system and strong system, and its response time can be widely used in the consumer electronics device on the order of seconds. Strong system requires that each task must not only guarantee the correctness of the execution process and the results, but also guarantee that the task is completed within a limited time, the response time is usually required to be in milliseconds or even microseconds, which involves medical care, safety. , The military hardware and software system is critical. Time limit is an important concept in the real-time system, refers to the requirements for the task's deadline, depending on the system performance, real-time system can be divided into soft real-time system and Soft Real-Time-System. Hard Real-Time-System. When it is true, it is limited to the system response time, but if the system response time does not meet the requirements, it will not cause a fatal error or crash; hard real time refers to the strict limit for system response time, If the system response time does not meet the requirements, it will cause a fatal error or crash of the system. If a task has not been completed at the time of time, it can still be tolerated for a soft real-time system, and only the system performance is reduced, but it is impossible to accept the hard real-time system, because the consequences of this are not available. Prediction, may even be disastrous. In real-time systems currently used, there is usually a soft hard two real-time real-time simultaneous existence, some of which have no time limit requirements, and some time limit requirements for events are soft, and the time limit requirements for those events that have critical impact on the system. It is hard real-time. Embedded application software embedded application is a computer software for a fixed hardware platform for a particular application, based on a fixed hardware platform, which can have time and accurate requirements due to user tasks, so some embedded applications Support for a specific embedded operating system is required. Embedded applications and ordinary applications have certain differences, not only requires its accuracy, security, and stability, etc., but also optimizes as much as possible to reduce the consumption of system resources. Reduce hardware costs. 1.3 Key Problems Embedded Systems are products that combine advanced computer technology, semiconductor technology, and electronic technology to specific applications of specific industries. It is inevitably a technological integrated, intensive, highly dispersion, and innovative knowledge integrated system, embedded The development of the system is full of competition, opportunities and innovation, and needs to solve the following key issues:
The application area of the kernel's exquisite embedded system is generally a small electronic device. The system resources are relatively limited, so the requirements for the kernel are quite high, and more than the traditional operating system is much smaller, such as the OSE distributed embedded in Enea launched. System, only 5KB throughout the kernel. Applying embedded systems is usually facing users, facing the product, facing specific applications. Most of the CPU in the embedded system works in an environment customized to a specific user group, has the characteristics of high consumption, small size, and integration. It must be highlighted when performing software and hardware design, removing redundancy, for the user's specific demand The system provides reasonable configuration to achieve the ideal performance. System software and application software in the system streamlined embedded system often have no obvious differences, and does not require it to be too complicated. In this way, it is conducive to control system cost, and on the other hand, it is also conducive to ensuring system security. Performance optimized embedded systems usually require a certain real-time guarantee, in order to improve execution speed and system performance, software in the embedded system is generally cured in the memory chip or the internal storage device of the processor, not stored in a disk. Equal external carrier. Since there is a certain extent of a certain extent due to the calculation speed and storage capacity of the embedded system, most of the systems must have high real-time guarantees, so there is a high demand for software quality (especially reliability). Professional development of embedded systems does not have autonomous development capabilities, and users cannot directly develop secondary development. When the system is complete, users must use a complete development tool and environment if you need to modify the functionality of some of the programs. Dedicated development tools and environments in embedded systems are typically hardware and software devices based on generic computers, as well as various logic analyzers, mixed signal oscilloscopes, and the like. Second, embedded Linux Linux has been introduced in 1991 to now, in just a few years, it has developed one of the powerful and design of the operating system, which can not only compete with a variety of traditional commercial operating system. Rapid development has also been obtained in the field of embedded operating systems. The embedded Linux (Embedded Linux) refers to a dedicated Linux operating system that can be cured in a memory chip or a single-chip microcontroller having only a few k or a few M-bytes of the standard Linux. . 2.1 Advantageous Embedded Linux development and research is a hot spot in the field of operating system. In the development of successful embedded systems, it is useful to use Linux. The reason why Linux can make such brilliant results in the embedded system market, and it is unfunction with its own excellent characteristics.
A wide range of hardware support Linux can support multiple architectures such as X86, ARM, MIPS, ALPHA, POWERPC, and have been successfully portable to dozens of hardware platforms, which can be run on all popular CPUs. Linux has an abnormal driver resource that supports various mainstream hardware devices and the latest hardware technology, and can even run on a processor without the storage management unit (MMU), which further facilitates the application of Linux in the embedded system. The efficient and stability of the kernel's high-efficiency and stable Linux kernel has been verified in various fields. Linux core design is very delicate, divided into process scheduling, memory management, inter-process communication, virtual file system and network interface five parts, unique The module mechanism can insert some modules into the kernel in real time in real time in real time, depending on the needs of the user. These features make the Linux system kernel can be crured very compact, which is very suitable for the needs of embedded systems. Open source, software enriching Linux is an open source free operating system, which provides users with maximum degree of freedom, because the embedded system is very different, often need to modify and optimize for specific applications, thus getting the source code It is important. Linux's software resources are very rich, and each general program can be found on Linux, and the quantity is increasing. Developing embedded applications on Linux generally does not need to start from scratch, but can choose a similar free software as a prototype, which is developed secondary. The key to developing embedded systems for excellent development tools requires a complete development and commissioning tool. Traditional embedded development debugging tools are in-circuit emulator, ICE, which provides a complete simulation environment to the target program by replacing the microprocessor of the target board, providing a complete simulation environment, making developers understand very clearly The program is easy to monitor and debug programs on the working state of the target board. The price of the online emulator is very expensive, and it is only suitable for performing very bottom debugging. If the embedded Linux is used, once the hardware software can support the normal serial port function, even if the online emulator can be developed and debugged. Work, thereby saving a small development fee. Embedded Linux provides developers with a complete tool chain, which uses GNU's GCC to make a compiler, do debug tools with GDB, KGDB, XGDB, which can easily implement all from operating systems to application software. Level debugging. Perfect Network Communication and File Management Mechanism Linux is inseparable from the Internet to the Internet, support all standard Internet network protocols, and easy to port into embedded systems. In addition, Linux also supports file systems such as EXT2, FAT16, FAT32, ROMFS, which have made a good foundation for developing embedded system applications. 2.2 Challenge At present, the R & D boom of embedded Linux systems is booming and accounting for a large market share. In addition to some traditional Linux companies (such as Redhat, Montavista, etc.) is being engaged in embedded Linux development and applications. IBM Famous companies such as Intel, Motorola have also begun research in embedded Linux. Although the prospects are bright, the research results of embedded Linux are still a gap in the real demands of the market, to develop a real mature embedded Linux system, and we need to make efforts from the following aspects.
Increasing system real-time Linux Although it has been successfully applied to PDA, mobile phones, car TV, set-top box, network microwave, etc., but in medical, aviation, transportation, industrial control, etc. is very strict. The occasion cannot be directly applied. The reason is that the existing Linux is a universal operating system, although it also uses many technologies to speed up the system's operation and response speed, and comply with the POSIX 1003.1B standard, but from essentially An embedded real-time operating system. Linux's kernel scheduling policies are basically used in the Unix system, and there will be many defects directly to embedded real-time environments. If the interrupt is turned off when the kernel thread is running, there is time-time uncertainty, and Lack of high-precision timers, etc. Because of this, Linux uses Linux as the underlying operating system, and the real-time transformation is carried out, thereby constructing an embedded system with real-time processing capability is a growing solution. Improve the core structure Linux kernel uses a monolithic, the entire core is a separate, very large program, which although it is possible to directly communicate directly, effectively shorten the switching time between tasks, improve the system The response speed, but is not compliant with the poor storage capacity of embedded systems and limited resources. The embedded system often uses another architecture called microkernel, ie, the kernel itself provides only some of the most basic operating system functions, such as task scheduling, memory management, interrupt processing, etc., and similar to the file system. And additional features such as network protocols are run in the user space and can be taken according to actual needs. Although Microkernel's execution efficiency is less than Monolithic, it greatly reduces the volume of the kernel, easy to maintain and transplant, and can meet the requirements of embedded systems. It can be considered to transform the Linux kernel part into Microkernel, so that LINUX is required to meet the size of the embedded system while having high performance. Improve the integrated development platform to introduce the embedded Linux system integrated development platform, which is the inherent requirement of the embedded Linux further development and application. Traditional embedded systems are for specific applications, software and hardware must be closely fit, but with the continuous expansion of embedded system, the emergence of embedded operating systems has become one. It is inevitable, because only this can promote the development of the embedded system towards hierarchical and modularity. Obviously, the embedded integrated development platform also meets the above development trends, an excellent embedded integrated development environment provides comparison of simulation functions, can achieve synchronous development of embedded applications and embedded hardware, and get rid of "embedded" The development of application software depends on the development of embedded hardware and the development of embedded hardware is an adverse situation. A complete embedded integrated development platform typically includes compilers, connector, debugger, tracker, optimizer, and integrated user interface. Currently Linux is in research on a specific system custom platform based on graphical interfaces, commercial embedded with Windows CE. Compared with a large gap compared to the operating system, the overall integrated development environment needs to be improved and improved. Third, the key technology embedded system is a system specialized in accordance with specific uses, which only completed the functionality to be completed, so its development process and development environment have significant differences compared to traditional software development. 3.1 Development Processes In the application development of embedded systems, the development process of the entire system is shown in Figure 2: Figure 2 Development process embedded system of embedded systems has developed to today, and the hardware platform corresponding to various microprocessors is generally It is a general purpose, fixed, mature, which greatly reduces the opportunity to introduce an error by the hardware system.
In addition, since the embedded operating system blocks the complexity of the underlying hardware, the developer can complete most of the work through the API function provided by the operating system, and therefore greatly simplifies the development process and improves the stability of the system. The developer of the embedded system has now been freed from repeated hardware platform designs, so that primary energy can be placed on a specific requirement. The embedded system is usually a resource-limited system, so writing software is more difficult to write software on the hardware platform of the embedded system, and sometimes it is even impossible. At present, the generally used solution is to write a program on a general purpose computer, then generate the binary code format that can be run on the target platform by cross-compiling, and then downloads to the specific location on the target platform. Support for Cross Development Environment Environment is a significant feature of embedded application development, and cross-development environments refer to compilation, link, and debug embedded applications, it is with the environment where the embedded application is run. Unlike, the host / target machine mode is usually used, as shown in Figure 3. Figure 3 Cross-development environment host (Host) is a general purpose computer (such as a PC or workstation) that communicates with the target by serial port or Ethernet interface. The hardware and software resources of the host are relatively abundant, not only including powerful operating systems such as Windows and Linux, but also have a variety of excellent development tools (such as Windriver's Tornado, Microsoft Embedded Visual C , etc.) Improve the development speed and efficiency of embedded applications. The target machine is typically used during embedded application development, which is used to distinguish between the host machine that communicates with the embedded system. It can be the actual operating environment of the embedded application, or it can be an emulation system that can replace the actual operating environment. But hardware and software resources are usually limited. Cross-development environments of embedded systems typically include cross-compiler, cross debuggers, and system emulators, where cross-compilers are used to generate code that can run on the target on the host, while cross debuggers and system emulator are used for Complete the debugging of embedded software between the host and the target machine. When using the host / target mode development embedded application, first use the high-enriched resource and good development environment development and simulation debugged target, and then compile the generated target code through the serial port or by the network. Transfer and load it on the target, and use the cross debugger with the support of the monitor or operating system to analyze and debug, and finally the host is run separately in a particular environment. The establishment of cross-development environments is the first step in embedded software development, and currently common cross-development environments are mainly open and commercial. A typical representative of the open cross-development environment is a GNU tool chain, which is now able to support multiple processors such as X86, ARM, MIPS, POWERPC. Commercial cross-development environments include Metrowerks CodeWarrior, ARM Software Developments Toolkit, SDS Cross Compiler, Windriver Tornado, Microsoft Embedded Visual C , etc. 3.2 Cross-compilation and link After completing the encoding of the embedded software, you need to compile and link to generate an executable code. Since the development process is mostly based on the general-purpose computer using Intel X86 Series CPU, the processor of the target environment The chip is mostly the microprocessors such as ARM, MIPS, POWERPC, Dragonball, which require cross-compilation and links in the created cross-development environment. Cross compilers and crosslinks are capable of running on the host and can generate compilers and linkers that can be run directly on the target.
For example, in a GCC cross-developing environment based on ARM architecture, ARM-Linux-GCC is a cross-compiler, and ARM-Linux-LD is a cross-link. Normally, it is not an embedded microprocessor for each architecture that corresponds to a cross-compiler and a cross-linking, such as a GCC cross-development environment for the M68K architecture, corresponding to a variety of different Compiler and linker. If you are using a COFF format, you need to use M68K-COFF-GCC and M68K-COFF-LD when compiling the Linux kernel, and you need to use M68K-COFF-PIC-GCC and M68K when compiling applications. COFF-PIC-LD. The embedded system typically requires a smaller function library during the link, so that the executable code generated can be made as small as possible, so the actual use of specially processed functions are generally used. For embedded Linux systems, the functions are getting stronger, and the increasing volume of C language functions Glibc and math libraries Libm have been difficult to meet the actual needs, so they need to adopt them to UCLIBC, UCLIBM, and Newlib et al. Currently embedded integrated development environments support cross-compilation and cross links, such as Windriver Tornado and GNU toolchain, writing a good embedded software, often generate two types of executable after cross-compilation and cross-link: used for Debug executable and executable for curing. 3.3 Cross-debug embedded software After compiling and linking to the debugging phase, debugging is an essential part of the software development process, and the cross-debugging in the process of embedded software development is different from the general software development process. . In universal software development, the debugger and debugging programs are often running on the same computer, and the debugger is a running process that controls the debugged process by the debug interface provided by the operating system. In the embedded software development, the debugging is used in cross-debugging between the host and the target, and the debugger is still running over the versatile general operating system, but the process of debugging is based on the operation. In the embedded operating system of a particular hardware platform, the debugger and the debug process communicate via a serial port or network, the debugger can control, access the debugged process, read the current state of the debugged process, and can change the operation of the debugged process status. Cross Debug is often referred to as remote debugging. It is a way to allow debugger to control the operation mode of the debugging process on a target machine in some way, and have a memory unit, register, and Debugging methods of various debugging functions such as variable values in the process of debugging processes. In general, the structure of the remote debugging process is shown in Figure 4. Figure 4 The cross-debugging of the embedded system of the remote debugging structure has a variety of ways, which can be detained into different levels, but generally have some typical features:
The debugger and the debug process run on a different machine, the debugger runs on the PC or workstation (the host), while the process being debugged is running on a variety of professional debug boards (target machine). The debugger establishes contact with the debug process through a certain communication method, such as serial port, parallel port, network, dbm, jtag or dedicated communication. In the target machine, some form of debug agency is generally responsible for cooperating with the debugger to complete the debugging of the process running on the target. This debugger may be a hardware device (such as DBI 2000) that supports debugging, or may be some special debugging software (such as GDBServer). The target machine may be a form of system emulator, through the simulation software of the target machine on the host, the entire debugging process can be run on a computer. Although there is only one computer in this time, there is still a difference between the host and the target machine. There are many kinds of debugging methods during embedded software development, and should be selected according to actual development requirements and conditions. In terms of debugging methods, cross-debugging of embedded systems can be divided into hardware debugging and software debugging. The former uses the simulation adjustment to assist the debugging process, and the latter uses the software debugger to complete the debugging process.
Hardware debugging relative to software debugging, using hardware debuggers can get more powerful debugging features and better debugging performance. The basic principle of the hardware debugger is through the implementation of the simulation hardware, allowing developers to know the current execution of the system at any time when commissioning. The most commonly used hardware debugger in the development of embedded system is Rom Monitor, ROM Emulator, In-Circuit Emulator and In-Circuit Debugger. Cross debugging is required to run the debugger on the host, run the ROM Monitor (ROM Monitor) and the debugger on the target, and the host builds a communication connection through the debugger with the ROM monitor on the target machine. Communication in compliance with the remote debugging agreement. The ROM monitor can be a executable program running on the target ROM, or a special hardware debugging device, which is responsible for monitoring the operation of the debugging program on the target machine, capable of completing the application with the debugger of the host. Program debugging. When using this debug mode, the debugged program first downloads to the target by the ROM monitor, and then complete debugging under the monitor of the ROM monitor. Most of the ROM monitor currently used can complete the setup breakpoint, single step execution , Check the registers, modify all debugging features such as memory space. The ROM emulator needs to be used when cross-debugging with the ROM Emulator mode, which is usually inserted into the ROM slot on the target, which is specifically used to simulate the ROM chip on the target. When using this debug mode, the debugger is first downloaded to the ROM emulator, which is equivalent to downloading to the ROM chip downloading to the target, and then debugging the target program in the ROM emulator. ROM Emulator debugging mode By using a ROM emulator, although it is necessary to re-use the time-consuming operation in the target machine ROM after each modification, the ROM emulator is more expensive, and the function is relatively Compare single one, therefore only adapt to certain specific occasions. When cross-debugging in the in-circuit emulator (ICE) mode, you need to use an online emulator, which is a specially designed hardware that is simulated on the CPU on the target machine, which can fully simulate the behavior of the processor chip and provide a very rich debugging. In the process of debugging using online emulators, it can be performed in order, or in reverse execution, you can also view all required data in real time, thereby bringing a lot of convenience to the debugging process. A significant feature of embedded system applications is to directly relevant hardware in the real world, there are various transformations and prior unknown changes, thereby carrying out various uncertain factors to the microprocessor's instructions, this uncertainty Under current circumstances, only the online emulator is likely to find that although the price of online emulators is very expensive, it is still very widely used. The online debugger needs to be used when cross-debugging in the in-circuit debugger (ICD) mode. Since the price of ICE is very expensive, each CPU requires a corresponding ICE, making the development cost very high, a better solution is to let the CPU implement the debug function directly in it, and passed on the development board The debugging port of the extracted, send a debug command, and receive debugging information, and complete the debugging process. Currently, Motorola's development board is used is a DBM debugging port, while ARM is used by the JTAG debugging port, using the appropriate software tool to connect to these debug ports, you can get a similar debugging with ICE effect. Software debugging software commissioning is usually performed at different levels, sometimes you may need to debug the kernel of the embedded operating system, and sometimes it is only necessary to debug embedded applications. During the entire development of the embedded system, software commissioning at different levels requires different debugging methods.
The kernel debugging of the embedded operating system is relatively difficult because it is not convenient to add a debugger program in the kernel, and can only pass remote debugging methods, "debug piles" built by serial port and operating system (Debug Stub " ) Communication and complete the debugging process together. The debug pile can be seen as a debug server, which obtains some necessary debugging information through the operating system and is responsible for handling the debug command sent by the host. Specifically to the embedded Linux system kernel, you can set a debug pile in the Linux kernel during commissioning, used as a communication server between the debugging process and the host, and then you can pass the serial port and debug pile of the debugger in the host. Communication and control the operation of the Linux kernel on the target machine through the debugger. The commissioning of embedded applications can use local debugging and remote debugging methods, which are relatively simple relative to the operation of the operating system. If you use local debugging, you must first put the desired debugger into the target system, and then you can run the debugger directly on the target to debug the application; if you use a remote debugger, you need to port a debug server. In the target system, the application's debugging is completed with the debugger on the host. In the development of the embedded Linux system, the debug server used on the target machine is usually GDBServer, and the debugger used on the host is GDB, and both mutually complement the debugging process. 3.4 System Test Embedded Systems The hardware of the embedded system generally uses a special test instrument for testing, while the software requires the support of relevant test technologies and test tools, and uses a specific test strategy. Testing technology refers to a special way for software testing, and a particular method capable of more efficiently uses these pathways. In embedded software testing, it is often necessary to compromise between target-based testing and host-based testing, and based on target-based testing requires more time and funds, while the host's test is more expensive. Small, but after all, it is carried out in the simulation environment, so it is difficult to fully reflect the actual situation of the software. The tests in both environments can find different software defects, the key is to reasonably pay for the test content of the target machine environment and the host environment. Test tool refers to tools that can be used to assist tests. The test tools are mainly used to support testers' testing work. It cannot be used directly to test, test tools are generally general tools, and testers should be based on actual conditions. Conduct appropriate adjustments. The test tools are often used in embedded software tests mainly include memory analysis tools, performance analysis tools, overlay analysis tools, defect tracking tools, etc.
Memory Analysis Tools The memory resources of embedded systems are usually limited, and the memory analysis tool can be used to handle defects generated when performing dynamic memory allocation. When the dynamically allocated memory is incorrectly referenced, the generated error is often difficult to reproduce, and the failure can be difficult to track, and such defects can be detected well using the memory analysis tool. The currently used memory analysis tools have two software and hardware. Software-based memory analysis tools may have a big impact on the execution performance of the code, which affects the system's real-time; hardware-based memory analysis tools are expensive, and only Can be used in a specific environment. Performance Analysis Tools The performance of embedded systems is usually a very critical factor. Developers generally need to optimize certain critical code of the system to improve performance, and the first problem is naturally determined which code needs to optimize. Performance Analysis Tools can provide relevant data for developers, explaining how execution time is consumed, when is it consumed, and the time used for each process. These data can help determine which process consume too much execution time, so that you can optimize the software to get better time performance. In addition, performance analysis tools can also guide developers to discover errors existing in system calls and defects on the program structure. Overlay analysis tool When you perform a white box test, you can use the code overlay analysis tool to track which code is performed. The analysis process generally completes through the pile, and the pile can be embedded in the test environment, or it can be executable code. Add software to the software or the combination of both. The developers can determine which code is executed by summarizing the analysis results. Which code is omitted. Currently used coverage analysis tools generally provide information about functional coverage, branch coverage, conditional coverage. Fourth, the embedded system today's embedded system has gradually got rid of the small and simple model of the past, and has begun to enter the high complexity and powerful stage, attracting many programming staff and hardware developers. Line. This article discusses basic knowledge, development process, development tools, commissioning tools, test tools, etc. of embedded Linux systems, and points out of the development of embedded systems and the general general computer software development, which are all things that should be noted. In the future, the basics that must be available in the development of embedded Linux systems. 5. Reference resources http://www.embeddedTechnology.com is a core website of embedded system technology, including many of the latest embedded fields, and a large number of embedded products, development tools, and product providers. http://www.ddjembedded.com is the official website of the embedded system magazine "Dr. Dobb's Embedded Systems" containing a large number of articles related to embedded systems. Karim YAGHMOUR, BUILDING Embedded Linux Systems, USA: O'Reilly, 2003 Wei Zhong, Cai Yong, Lei Hongwan, Embedded Development Detailed, Beijing: Electronic Industry Press, 2003 Li Shanping, Liu Wenfeng, Wang Huanlong, etc., Linux Embedded System, Beijing: Tsinghua University Press, 2003 Explorer Studio, Embedded System Development Bible, Beijing: China Railway Publishing House, 2003
About author
This article author Xiao Wenpeng is a master's degree from the computer department of Beijing Institute of Technology, mainly engaged in the research of operating systems and distributed computing environments, love Linux and Python. You can contact him through xiaowp@263.net.