Embedded system and how to develop its own embedded system
- Provided by joelr.williams
Most Linux systems are running on the PC platform, but Linux is also very stable as an embedded system. This article depicts an overview of an embedded system and showing how embedded system products use Linux. The embedded system is still the same as the history of the computer or embedded system. In the field of communication, the late 1960s, the computer is used for electronic telephone switches called the "Storage Program Control" system. The term "computer" is not unfair, and the storage program refers to the program and routine information. Store control logic instead of curing it in hardware, it is indeed breakthrough. Today, we think it should be the case. At that time, the computer is customized for every application, according to today's standard, they are not normal, integrated by strange special instructions and I / O devices in a computer. The microprocessor changes this by providing a small, low cost, CPU engine that constructs large system modules. It proposes a fixed hardware architecture that is peripheral through a bus and a general programming model called programming. The software also proposed with hardware. Initially, write and test software only have a simple programming development tool. Software that actually runs each project is usually from a modification of draft. Programmatically use assembly language or macro language because compilers often have defects and lack of complete debugging tools. The software build module and the standardization library are only the concept of being popular in the 1970s. The commercial operating system of the embedded system appears in the late 1970s, many is written in assembly language and can only be used for a specific microprocessor. When the microprocessor is eliminated, its operating system is unless new. Override, otherwise it is eliminated. Today, many of these early systems have become a vague memory; who else does MTOS? When the C language occurs, the efficiency, stability and portability of the operating system have improved a lot. This is manifested immediately, which protects software investment when the microprocessor is eliminated. This is a good news for the market. The operating system written in C language is increasingly common today. In general, reusable software has dominated and better. In the early 1980s, my favorite operating system is a Wendon operating system, and approximately $ 150 can get a C source code library. It is a package that you can build your own operating system by selecting components, justice on the menu. For example, you can work scheduling and memory management schemes on the library list. Many commercial operating systems for embedded systems are in the 1980s. This boom continues until now, today, there are many feasible commercial operating systems to choose from. Some big appearances, such as VxWorks, PSOS, NECULEUS, and Windows CE. Many embedded systems do not have operating systems at all, only loop control. It is sufficient for some simple devices, but as the system is getting more complex, the operating system is necessary or the software becomes incredible. Unfortunately, some complex and terrible embedded systems are only then complex because designers do not need to operate the system. Gradually, more embedded systems need to join all kinds of networks and therefore require network functions. Even the hotel's door handle is also embedded in the microprocessor and the network. For embedded systems that are merely encoding control cycles, increasing network functions will result in an increase in system complexity to require operating systems. In addition to the commercial operating system, there are a large number of private operating systems. Most of them come from the draft, such as the iOS of Cisco; and it is born from other operating systems. For example, many operating systems are derived from the same version of the Berkeley UNIX system because it has a complete network function. Others are based on the main operating system, such as Ka9Q from Phil Karn. Linux is a new member with many advantages as an embedded system. It is portable, stable, powerful, easy to develop. The toolkit breakthrough ICE barrier to develop embedded systems is available for useful toolkits.
Like any job, a good tool makes it easier. Different stages of development require different tools. Traditionally, the development of embedded system tools is the internal circuit emulator (ICE), which is a relatively expensive component for implanting the circuit between the microprocessor and the bus, allowing the user to monitor and control micro The processor all the signals of all signals. This is a bit hard because it is an allogenesis, which may cause unstable. However, it provides a clear situation of bus work, which has no speculation that many of the working conditions of hardware software. In the past, some work relied on ICE as the main debugging tool for the entire development process. However, once the initialization software supports good words to serial ports, most debug can do without ICE and other methods. Newer embedded systems utilize very clear microprocessor design. Sometimes, the initial code of the corresponding work has already had a quick set of serial ports. This means that there is no ICE people to easily work. The ICE will reduce the cost of development. Once the serial port starts, it supports a variety of professional development tools. Linux is a GNU-based C compiler, as part of the GNU tool chain, works with the GDB source debugger. It provides all software tools for developing embedded Linux systems. This is typically typical for developing debugging tools for embedded Linux systems on new hardware. 1. Write or implanted the guide code 2. Print the code to the serial port, such as "Hello World" (in fact I prefer "Watson, Come Hre I Need you", the first word commonly used on the phone.) 3. Implant the GDB target code into the work serial port, which can be dialogue with another Linux host system running the GDB program. As long as you tell GDB to debug programs through the serial port. It is dialogue via the serial port with the GDB target code code of the test machine, you can perform C source code debug, you can also use this feature to load more code into the RAM or FLASH MEMORY. 4. Use GDB to make the hardware and software initialization code work in Linux kernel. 5. Once the Linux kernel is started, the serial port becomes a Linux control port and can be used for subsequent development. With KGDB, the kernel debug version of GDB, this step is often not required, if you join the network, such as 10Baset, the next step you may want to start it. 6. If you have a complete Linux kernel on your target hardware, you can debug your application process. With other GDBs or graphics covering GDB, such as XGDB. What is a real-time system? Embedded systems are often misused into real-time systems, although most systems generally do not require real-time functions. Real-time is a relative word, and the purified themers often define real-time for a predetermined manner in a very short time such as microseconds, in such a short interval, in such a short interval in a dedicated DSP chip Or ASIC is implemented. There will be such a requirement only when designing a low-level hardware FIFO, dispersion / aggregation DMA engine and custom hardware. Many designers have a clear understanding of real-time due to clear understanding of true requirements. For most systems, the approximate real-time response of one to five microseconds is sufficient. The same soft demand is also acceptable. If Windows 98 has collapsed, it must be processed within 4 milliseconds (± 98%), or in 20 milliseconds (± 0). This soft requirement is easier to meet, including environmental conversion time, interrupt wait time, task priority, and sorting. Environmental conversion time is a hot topic of the operating system. In short, most CPUs have been dealt with very good, and the speed of the CPU is now a lot, this problem is not important. Strict real-time requirements are typically processed by interrupt routines or other kernel environment driver functionality to ensure stable performance, waiting time, once requested to require service to a large extent on interrupt priority and other temporary mask interrupts software.
Interrupts must be processed and managed to ensure that time requirements can meet, like many other operating systems. In the IntelX86 processor, this work is easily processed by Linux real-time extension. This is an interrupt processing schedule that runs Linux in an entries. The key interrupt response does not have to be notified Linux. Therefore, many controls for critical clocks can be obtained. An interface is provided between real-time control level and time limiting loose basic Linux level, which provides a real-time framework similar to other embedded operating systems. Therefore, real-time key code is separated, and "design" is satisfied. The result of the code processing is in a more general method, perhaps only in the application task level. Embedded systems define a view that if an application does not have a user interface, it must be embedded because the user cannot interact directly with it. Of course this is simply. A elevator controlled computer is considered embedded: Press button Select floor indicator to display the stop of the elevator. For network-based embedded systems, this limit is even more blurred if the system contains monitoring and controlled web browsers. Better definitions pay attention to the concentration of the system and the main purpose. Because Linux provides basic kernels that complete the embedded feature and all user interfaces you need, it is multi-faceted. It can handle embedded tasks and user interfaces. Willing Linux as a continuous unity, from a spontaneous memory management, task switching, and time service and other split, micro-core to complete servers, support all file systems and network services. A small embedded Linux system only needs the following three basic elements: boot tool Linux microennuclear, consisting of memory management, process management, and transaction processing, initialization process If you want to do something, you can continue to be small, you have to add : Hardware drivers provide one or more applications for the desired feature. In addition, the function may require these file systems (perhaps in the ROM or RAM) TCP / IP network stack storage semi-transition data and exchanged disks. The hardware platform chooses the best hardware is a complex job, full of politics, prejudice, tradition, lack of complete or accurate information. Cost is often key issues. When considering cost, it is sure that you are considering the entire cost of the product, not only CPU. Sometimes, once the cheap CPU works with the bus logic and the time of time, it can turn into an expensive dog's product. If you are looking for software, the first is that the hardware already has a product. If you are a system designer, you decide whether you decide whether to develop a real-time budget and hardware work. How fast CPUs are needed to complete a job in reality, then zoom in. Weird, the speed of CPU is actually in realities, don't forget that the app will make full use of Cache. Imagine bus speeds how fast, if there are other buss such as PCI bus, including coming in. The slow bus or the bus generated by the DMA blocking will reduce the speed of the CPU. The CPU with integrated devices is good because only the very few devices must be commissioned, and the drivers that support universal CPUs are often easily obtained. In my project, the chip and peripheral join often problems or does not satisfy the compatibility we need. Because the peripheral is integrated, don't think this will be cheap. Put 10 pounds of Linux plug in a bag that can only be loaded with 5 pounds. One common understanding for Linux is that it is simply magical. This may not be large, the Linux on the typical PC has more functions for PC users. For beginners, you can separate kernels and tasks, and standard Linux kernels typically reside in memory, each application is run from disk to memory. After the program is over, the memory it occupies is released, and the program is downloaded. In an embedded system, there may be no disks. There are two ways to eliminate the dependence on the disk, which looks at the complexity of the system and the hardware design. In a simple system, when the system is started, the kernel and all applications are in memory. This is the most traditional embedded system working mode, which can also be supported by Linux.
With Linux, there is a second possibility. Because Linux already has the ability to "load" and "uninstall" programs, an embedded system can use it to save memory. Imagine a typical system that includes approximately 8MB to 16MB of Flash Memory and 8MB memory. Flash Memory can be used as a file system. The Flash Memory driver is used to connect the Flash Memory and the file system. Alternatively, Flash Disk can be used. This Flash component uses software simulation disks. One of the examples is the m-systems of Diskonchip, which can reach 160MB. (Http://www.m-systems.com). All programs are stored in the Flash file in a file, and memory can be loaded. This dynamic, the ability to "load" is an important feature that supports other series of functions: it enables the initialization code to be released after the system is booted. Linux also has a lot of public operations that run outside. These typically programs are running once in initialization, and they will no longer run. Moreover, these utilities can use them in a way, one will run in sequence. In this way, the same memory space can be repeatedly used in "calling" each program, just like the system boot. This can indeed save memory, especially those that are not changed after configuring, if the function of the Linux loadable module includes, drivers and applications can be loaded. It can check the hardware environment and install the corresponding software for hardware. This eliminates the use of a program to occupy many flash memory to handle the complexity of multiple hardware. The software upgrade is more modular. You can upgrade the application and loadable drivers in the Flash when running. Configuration information and runtime parameters can be stored as data files on Flash. Another approval of non-virtual memory standard Linux is the ability to virtual memory. It is this magical feature to make the application programmer to write code and do not care, regardless of how much procedure is. The program overflows the disk switching area. In an embedded system without a disk, you usually can't do this. This powerful feature is not required in the embedded system. In fact, you may not want it in a real-time critical system because it will bring a time factor that cannot be controlled. This software must be designed to be more sophisticated to fit physical memory on the market, just like other embedded systems. Note that due to the CPU, it is wise to save virtual memory code in Linux because it is clear. And another reason is that it supports sharing text so that many programs can share a software. Without this, every program has its own library, just like Printf. The intrinsic memory of the virtual memory can be turned off, as long as the size of the switching space is set to zero. Then, if you write the program is larger than the actual memory, the system will be handled as your run; this program will not run, or Malloc will fail. On many CPUs, the memory management provided by virtual memory can separate different programs to prevent them from writing to other addresses. This is usually impossible on embedded systems because it only supports a simple, flat address space. This function of Linux helps it develop. It reduces the likelihood that the written program causes system crash. Many embedded systems are based on efficiency because of a "global" data that can be shared between programs. This can also be supported by Linux sharing memory, sharing is just the specified memory section. File system Many embedded systems have no disk or file system. Linux does not need them to run. As mentioned earlier, the application task can be written together with the kernel and load it as an image when booted. For a simple system, this is enough. However, it lacks the flexibility mentioned above. In fact, many commercial embedded systems provide file systems as an option.
Many or dedicated file systems or MS-DOS-COMPATIBLE file systems. Linux provides a MS-DOS-Compatible file system while there are many other options. The reason for providing other options is because they are more powerful and fault tolerant. Linux also has functions of inspections and maintenance, commercial suppliers often do not provide this. This is especially important for the Flash system because it is updated over the network. If the system lost its ability during the upgrade process, it is useless. Maintenance features can usually solve such problems. The file system can be placed on a conventional disk drive, Flash Memory or other such media. Moreover, it is sufficient to temporarily save files, a small RAM disk is sufficient. Flash Memories are split into blocks. These blocks may include a boot block that contains the initial software that operates when the CPU is started. This may include Linux boot code. The remaining Flash can be used as a file system. Linux's kernel can be copied from flash to the RAM by boot code, or there is a selection, the kernel can be stored in a separate portion of Flash and directly from there. In addition, there is an interesting choice for some systems, that is, one cheap CD-ROM is included. This is cheaper than Flash Memory, and the simple upgrade is supported by switching CD-ROM. With this, Linux is only booted from the CD-ROM, and all the programs are obtained from the CD-ROM as just from the hard disk. Finally, for the network of embedded systems, Linux supports NFS (Network file system). This opens the door to realize many of the value-added functions of the networked system. First, it allows the application to be loaded over the network. This is the basis for controlling software modifications because software of each embedded system can be loaded on a normal server. It can also be used to enter or output a large amount of data, configuration, and status information when running. This is a very powerful function for user supervision and control. For example, an embedded system can create a small RAM disk, which contains content synchronized with the current status information in the file. Other systems can simply set this RAM disk to a network-based remote disk, and access status files in air. This allows the Web server on another machine to access status information through simple CGI Script. Other applications running on other computers can easily access data. For more complex monitoring, application packages such as MATLAB (http://www.mathworks.com/products/matlab/), can be used to run graphics display in the operator's PC or workstation. Guide LILO and BIOS Where is a microprocessor first started, it starts executing instructions on a preset address. Usually there are some read-only memory, including initialization or boot code. On the PC, this is a BIOS. It performs some low-level CPU initialization and other hardware configurations. BIOS continues to identify which disk has an operating system in which the operating system is copied to the RAM and turn it. In fact, this is very complicated, but it is also very important for our goals. Linux running on the PC relies on the BIOS of the PC to provide these configurations and OS load capabilities. There is often no such BIOS in an embedded system. This way you have to provide the same startup code. Fortunately, the embedded system does not require the flexibility as the PC BIOS boot program, as it usually only needs to process a hardware configuration. This code is simpler and boring. It is just a list of instructions, plugs the fixed number to the hardware register. However, this is a critical code because these values are to be consistent with your hardware and to be done in a specific order. So in most cases, a minimal power-on self-test module can check the normal operation of memory, let LED flash and drive other hardware to start and run the main Linux OS. These startup code is completely based on hardware decisions.
Fortunately, many systems have a menu hardware design for core microprocessors and memory. Typically, the chip manufacturer has a sample motherboard that can be used as a design reference or less or less. Usually these menu design startup code is available, it can be easily modified according to your needs. In a few cases, the startup code needs to be rewritten. To test these code, you can use a circuit built-in simulator containing 'analog memory', which can replace the target memory. You put the code on the simulator and debug it through the simulator. If this is not, you can skip this step, but this will have a longer debug cycle. This code is ultimately running on a relatively stable memory, usually Flash or EPROM chip. You need to use some ways to place the code on the chip. How to do it, you must be based on the "target" hardware and tools. A popular method is to insert Flash or EPROM chip into the EPROM or FLASH burner. This will "burn" (save) into the chip. Then, insert the chip into the socket of your target board, turn on the power. This method requires a socket on the board, but some devices are unable to match the socket. Another method is through a JTAG interface. Some chips have a JTAG interface to program a chip. This is the most convenient way. The chip can be welded to the motherboard, a small cable from the JTAG connector, usually a PC card, links to the JTAG interface. Below is some of the usual programs required to run the JTAG interface. This device can also be used in small amounts. Thermuality is more reliable than the commitment of politicians. When running on a PC hardware, Linux is very reliable and stable, especially compared to some of the currently popular operating systems. What is the embedded core itself? For most microprocessors, Linux is very good. The Linux kernel ported to the new microprocessor family runs as stable as the microprocessor. It is often ported to one or more specific motherboards. These panels include specific peripherals and CPUs. Fortunately, many codes are with processors, so the transplant is concentrated. Most of them are in the field of memory management and interrupt controls. Once successfully transplanted, they are very stable. As we discussed earlier, the guidance strategy is widely depends on hardware requirements, and you must have some custom work. The device driver is more confusing: some stable is somewhat unstable. And choose very limited; once you leave the universal PC platform, you need to write it yourself. Fortunately, there are many drivers around you, you may find a modification similar to your needs. This driver interface is defined. Many types of drivers are very similar, so it is usually not difficult to transplant the disk, network, or a series of port drivers from one device to another. I have found that many drivers are well written, it is easy to understand, but you still have to prepare a book about the kernel structure in hand. In my experience, Linux is at least as stable as the famous commercial operating system I have. In summary, these operating systems and Linux problems are misunderstandings of microseconds in the working process without the difficulty of code or basic design errors. Any operating system has a lot of arguments that do not have to be repeated here. The advantage of Linux is that the source code is open, the annotation is clear and the document is complete. This way, you can control and process any problems that appear. With basic kernels and drivers, there are other problems. If there is a hard disk, the reliability of the file system is a problem. We have useful disks for the Linux system for more than two years of experience. These systems have almost never closed. The power supply may be interrupted at any time. It feels very good, use the standard (EXT2) file system. Standard Linux initialization script runs the FSCK program, which is very effective in checking and clearing unstable inodes. Running the default running update program to run every 5 or 10 seconds is more sensible.