Relationship between Linux embedded systems and hardware platforms
Source: Internet
Author: User
Article title: Relationship between Linux embedded systems and hardware platforms. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
I. Linux Embedded System An operating system is a software running on a computer. its main task is to manage system resources on the computer and provide users with interfaces to use the computer and its external devices. It aims to manage all hardware resources and provide an appropriate operating environment for application software. Due to inherent hardware limitations, embedded systems often have very few hardware resources, for example, a CPU with less time pulse, less memory, and a DiskOnChip or DiskOnModule with a small capacity instead of a disk. In the battery system, it also needs to save battery consumption and prolong battery use time.
Linux is completely feasible as an embedded operating system, because it provides the basic kernel for completing the embedded function and all the user interfaces you need. It can process embedded tasks and user interfaces. Linux is regarded as a continuous unity. it supports all file systems and network services from a microkernel with memory management, task switching, time service and its splitting to a complete server. As an embedded system, Linux is a new member with many advantages. it is portable, stable, powerful, and easy to develop for many CPU and hardware platforms.
Application program
API
X-server Java virtual machine
Device driver
Linux Kernel
Boot load
Embedded Linux requires the following basic elements:
1. pilot tool
2. Linux microkernel: memory management and program management
3. initialize the process
If you want it to become a complete operating system and keep it small, you must add:
1. hardware driver
2. hardware interface program
3. Application Group
When talking about the operating system, we must talk about its development environment. Linux is a GNU-based C compiler. as part of the GNU tool chain, it works with the gdb source debugger. It provides all the software tools for developing embedded Linux systems. The following describes how to use a typical development tool:
1. write or implant the boot code
2. print the string encoding to the serial port
3. Port the gdb target code to the serial port, which can be used to communicate with another Linux host system running the gdb program.
4. use gdb to enable the hardware and software initialization code to work during Linux kernel startup.
5. the Linux kernel is started. the serial port becomes the Linux control port and can be used for subsequent development.
6. if you run the complete Linux kernel on your target hardware, you can debug your application process.
For more details, see website http://www.emlinux.com
II. hardware platform When selecting the best hardware, developers often make hardware selection complex and difficult due to the lack of complete or accurate information. The hardware cost is often a key issue. when considering the cost, you need to be sure that you are considering the entire cost of the product, not just the CPU cost; once a good CPU is added with bus logic and delay circuit, it can work with peripherals, and the hardware system may become a very expensive product. If you are looking for an embedded software system, you should first determine the hardware platform, that is, determine the type of the microprocessor CPU.
Currently, the most popular hardware platforms include Intel's Strong Arm series, Motorola's DragonBall series, NEC's VR series, Hitachi's SH3 and SH4 series. However, it is best to determine the application functions and required speed of the system before selection, and set the external device and interface standards. In this way, you can accurately locate the required hardware solution and obtain the most cost-effective system. The following uses Intel's Strongarm as an example to describe the hardware platform:
III. relationship between Linux embedded systems and hardware For beginners, the kernel and task can be separated. The standard Linux kernel usually reside in the memory, and every application is migrated from the disk to the memory for execution. When the program ends, the memory occupied by it is released and the program is downloaded. In an embedded system, there may be no disks. There are two ways to eliminate disk dependencies, depending on system complexity and hardware design. In a simple system, after the system is started, the kernel and all applications are in the memory. This is the operating mode of most traditional embedded systems, which can also be supported by Linux. With Linux, there is a second possibility. Because Linux has the ability to "load" and "Uninstall" programs, an embedded system can use it to save memory. Imagine a typical system that includes about 8 MB to 16 MB Flash Memory and 8 MB Memory. Flash Memory can be used as a file system. The Flash Memory driver is used to connect Flash Memory to the file system. Flash Disk can also be used as an alternative. you can use tool software to simulate Flash Memory as a Disk or part. One example is that Intel provides Flash Memory management software IPSM-Intel Persistent Storage Manager. For more information, see http://developer.intel.com/design/builder/flbldr/swb/swb.htm.
All programs are stored in Flash files as files, and the memory can be loaded as needed. This dynamic and "load as needed" capability is an important feature that supports a series of other functions:
1. it releases the initialization code after the system boot. Linux also has many utilities running outside the kernel. These programs run once during initialization and will not run any more. In addition, these utilities can run in sequence one by one in a way they share one another. In this way, the same memory space can be used repeatedly to "call" every program, just like the system boot. This can indeed save memory, especially those network stacks that will not be changed once After configuration. If the functions of the Linux module can be included in the kernel, both drivers and applications can be loaded. It can check the hardware environment and install corresponding software for the hardware. This eliminates the complexity of using a program to take up a lot of Flash Memory to handle multiple types of hardware.
2. software upgrades are more modular. You can upgrade the application and load the driver on Flash when the system is running.
3. configuration information and running time parameters can be stored as data files in Flash.
Virtual memory
Another feature of standard Linux is the capability of virtual memory. This magical feature allows application programmers to write code with no consequence, no matter how large the program is. This powerful function is not required in embedded systems. In fact, because it will lead to uncontrollable time factors, you may not want it in real-time systems. This software must be designed to fit the physical memory on the hardware platform, just like other embedded systems. Note that for CPU reasons, it is wise to save the virtual memory code in Linux, because it is very troublesome to clear it; and there is another reason-it supports shared text, in this way, many programs can share a software.
The virtual memory transfer-in function can be disabled, as long as the swap space is set to zero. If the program you write is larger than the actual memory, the system will use up swap space as your run; this program will not run, or malloc will fail. On many CPUs, the memory management provided by the virtual memory can separate different programs to prevent them from being written to the space of other addresses. This is usually not possible in an embedded system because it only supports a simple and flat address space. This feature of Linux is helpful for its development. It reduces the possibility of system crashes caused by random programming. Many embedded systems consciously use the "global" data that can be shared between programs for efficiency reasons. This can also be supported through the Linux shared memory function, which only shares the specified memory.
File system
Many embedded systems do not have disks or file systems. Linux can run without them. In fact, many commercial embedded systems provide file systems as an option. Linux provides the MS-DOS-Compatible file system and multiple other options. Other options are provided because they are more powerful and fault tolerant. Linux also provides inspection and maintenance functions, which are often not provided by commercial vendors. This is especially important for Flash systems because it is updated through the network. If the system loses its capacity during the upgrade process, it will be useless. Maintenance functions can usually solve such problems.
File systems can be placed on traditional disk drives, Flash Memory, or other such media. In addition, a small ramdisk is enough for saving files temporarily. Flash Memories is split into blocks. These blocks may include a boot block containing the initial software that runs when the CPU starts. This may include the Linux boot code. The remaining Flash files can be used as file systems. The Linux kernel can be copied from Flash to RAM through boot code, or another option is available. the kernel can be stored in an independent part of Flash and executed directly from there. Another interesting option for some systems is to include a cheap CD-ROM. This is cheaper than Flash Memory and supports simple upgrades by switching CD-ROM. With this, Linux just needs to boot from the CD-ROM, like getting all the programs from the CD-ROM just like from the hard disk.
Finally, Linux supports Network File system (NFS) for networked embedded systems ). This opens the door for realizing many value-added functions of the networked system. First, it allows applications to be loaded over the network. This is the basis for controlling software modifications, because software in every embedded system can be loaded on a common server. It can also be used to input or output a large amount of data, configuration, and status information during running. This is a very powerful function for user monitoring and control. For example, an embedded system can create a small RAM disk, which contains content that is synchronized with the current status information. Other systems can simply set this RAM disk as a network-based remote disk and access status files in the air. This allows the Web server on another machine to access status information through a simple CGI Script. Other application packages running on other computers can easily access data.
Boot -- where is LILO and BIOS?
When a microprocessor is started for the first time, it starts to execute commands on the preset address. There are usually some read-only memory, including initialization or boot code. Similar to BIOS on a PC. It executes some low-level CPU initialization and other hardware configuration files. The BIOS continues to identify which disk has an operating system, copies the operating system to RAM, and redirects to it. In fact, this is very complicated, but it is also very important for our goals. Linux running on a PC relies on the pc bios to provide these configurations and OS loading functions.
This BIOS is often not used in an embedded system. In this way, you must provide the same startup code. Fortunately, an embedded system does not need the flexibility of the BIOS boot program on a PC, because it usually only needs to handle one hardware configuration. This code is simpler and boring. It is just a command list that inserts fixed numbers into hardware registers. However, this is the key code, because these values must be consistent with your hardware and in a specific order. So in most cases, a minimum
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.