To create an embedded Linux hardware and software development environment

zhaozj2021-02-12  142

From (http://www.dailzh.net)

Linux and UClinux In August 1991, a student in Finland had the following words in the Comp.os.minix newsgroup:

Hello all all people using minix - I am doing a free operating system for 386 (486) at (just to hobbily, not like GNU, very professional.

This student is Linus Torvalds, and what he said is the Linux we know today.

Since Linux's source code is published on the Internet, you can get free of charge, which has attracted a large number of drivers and applications from the UNIX hipster from all over the world. In just a few years, Linux has developed A fairly complete operating system, and Linux support hardware platform is the most operating system, current Linux support hardware platform: Intel's IA64, Compaq's alpha, Sun's SPARC / SPARC64, SGI MIPS, IBM S396, ARM , PowerPC, etc. The greater linux is that it is gradually applied to embedded devices, and UClinux is produced under this atmosphere. Uclinux is Micro-Control-Linux, which is also an open source project. Uclinux source code and development tools can be downloaded for free from http://www.uclinux.org. Uclinux is designed for embedded processors that do not have MMU (memory management unit), with the mainstream Linux, UCLinux has the following features: 1. Simplified the kernel loading method, Uclinux kernel can run directly on Flash: It is to write the executive image of UCLinux's kernel to Flash. When the system starts, it will be executed in one address of Flash; can also be loaded Memory Run: Store the compressed file of the kernel in Flash, and read the compressed file when the system is started, and then decompressed in memory and then start execution. 2. The ROMFS file system is used as the root file system: this file system requires less space relative to the general EXT2 file system, first-core support ROMFS file system requires less code than support EXT2 file system, secondly ROMFS file system relatively simple Establishing the file system Superblock requires less storage. The ROMFS file system does not support dynamic erasing, and the data that needs to be dynamically saved by the system uses the RAM disk method, and the RAM disk uses the EXT2 file system. 3. Using the FLAT executable format: ELF format has a large file header, the FLAT file is simplified for the file header and some segment information. 4. Overrind the application library: UCLIBC is streamlined for libc, and UClinux uses a static connection to the user program.

Uclinux development environment www.uclinux.org provides the GNU cross-compiler for Uclinux, including the following components: GCC cross-compiler, which develops two-creditable binary on the host, Binutils aid, including Objdump, AS, LD, etc .; GDB debugger. Develop UCLinux on ARM7 as an example: 1. Get the source package of uclinux-distth, www.uclinux.org regularly introduce the corresponding source package for the new Linux kernel, the latest version is kernel-2.4.21, can be from http://www.uclinux.org/pub / UCLINUX / DIST / download is available for free. This source package contains UCLinux-2.4.21, Uclibc, and user applications that have been ported to UCLinux. After download, you will get a UCLinux-Dist-20030522.tar.gz file, save it to the / home directory, then execute: tar zxvf uclinux-dist-20030522.tar.gz, after the TAR program is running, In the / home directory, there will be a new directory of / home / uclinux-delin, which is the source root of Uclinux, with all source code developed by UCLinux. 2. Get ARM development tools, www.uclinux.org provides the UCLinux source, while also providing the corresponding cross-compilation tool. To compile UCLinux for the ARM7 target system on the development host, you need to download the ARM cross-compiler from http://www.uclinux.org/pub/uclinux/arm-elf-tools/: ARM-ELF-TOOLS-20030314. SH. After getting this file, perform the following command: sh am-elf-tools-20030314.sh, this command will automatically establish a cross-compilation environment of UCLinux-ARM on the development host. Type ARM-ELF-GCC, if you can see the following output information: Reading Specs from /usr/lock/lib/gcc-lib/arm-elf/2.95.3/specsgcc version 2.95.3 20010315 (ColdFire Patches) - 20010318 from http://fiddes.net/coldfire/) (jClinux Xip and shared lib patches from http://www.snapgear.com/) indicates that the cross-ARM's cross-compilation environment has been established. Now there is already a UCLinux source code and the tool for compiling these source code. You can also compile UCLinux and user programs with Make MenuConfig, make, compile a kernel image file for the ARM target board, next to do It is necessary to need a ARM7 development board to run this image file (for how to compile UCLinux and user programs, please refer to www.uclinux.org).

Building an ARM7-UClinux development board UCLinux only requires very little hardware resources to run, as an example of ARM7TDMI, only the following hardware: 1. CPU - SAMSUNG S3C4510B 2. SDRAM 8M or more 3. A simple serial port 4.2m Flash 5. An Ethernet interface (optional) Currently, the manufacturers of each embedded microprocessor will provide a DEMO board while the user is available for users to test the performance of the microprocessor. Samsung provides an SNDS100 DEMO board for S3C4510B processors. The schematic of the DEMO board can be downloaded from Samsung's website, and some modifications to this principle are reserved, only the five parts listed above, remove other extra parts. The schematic after modification is an ARM7 target board schematic that can run UCLinux, and then processes several PCB boards according to this schematic. The corresponding components are welded, and a piece of ARM7 development board that runs UClinux is made (this The corresponding schematic of the development board, the PCB map can be downloaded from http://www.dailzh.net). Slow, although this development board has been soldered, but it is only a simple combination of electronic parts. It is necessary to run UCLinux above, and the corresponding software needs to manage these hardware. The previous mentioned UCLinux can run directly from Flash, that is, the UCLinux image file can be burn directly into Flash, then power up, uclinux starts from flash? Yes, it is true. What is going to do now is how to burn Uclinux's kernel image to Flash. Write the UCLinux kernel image into the flash using the writer, then weld the Flash to the PCB board or insert it onto the flash of the development board. Of course, if you have a writer. However, few people can have such a writer in their hands. What we need is a cheap flash writing case. With JTAG, S3C4510B integrates a JTAG, which can control all pin on S3C4510B via JTAG, which can generate the data, address and control bus of S3C4510B by entering the corresponding instructions and data to the JTAG interface. The read and write operation timing of the Flash device, burn Uclinux's core image file into the flash (About S3C4510B's JTAG interface cable making and downloading) UCLinux image files to Flash programs Executable files and source code, see http : //www.dailzh.net on related content). Finally, the UCLinux image file is burn it into the flash. Connect the ARM7 development board and the COM1 port of the ARM7 development board and download a TIP program from the Internet, execute this command: tip -l / dev / ttys0 - S 19200 is displayed on the screen to display Connected. After the power of the ARM7 development board is turned on.

If you are lucky enough, you should see the following information: >> Linux Version 2.4.20-UC0 (Root @ Dailzh) (GCC Version 2.95.3 >> 20010315 (ColDfire Patches - 20010318 from http: // fiddes .NET / COLDFIRE /) >> (UClinux XIP and Shared Lib Patches from http://www.snapgear.com/)) March 19 23:44:11 CST 2003 >> Processor: Samsung S3C4510B Revision 6 >> Architecture : SNDS100 >> ON Node 0 Totalpages: 4096 >> zone (0): 0 pages. >> zone (1): 4096 pages. >> Kernel Command line: root = / devand line: root = / devand Line: root = / devand / ROM0 >> Calibrating delay loop ... 49.76 bogomips ... >> Command: CAT / etc / motd >> Welcome to uclinux.org >> for further information check: http://www.uclinux.org/ >> /> Uclinux has been running on the ARM7 target board, typing familiar LS commands to see what output. Bitting the UClinux image file through the JTAG interface to flash in Flash is too slow, debugging the UCLinux kernel is very inconvenient, is there any other method? Yes, UCLinux can be loaded into the memory in addition to direct operations from Flash. Let's write a bootloader for the ARM7 development board. The role of bootloader is to initialize the ARM7 development board, and then download the Uclinux image to the memory via the Ethernet interface, then run UClinux from the memory. This method downloads that the UCLinux kernel image is only 10 seconds, which is suitable for the development phase often modifies the UCLinux kernel (Bootloader For ARM7 source code can be downloaded from http://www.dailzh.net). After debugging the UCLinux kernel, you can use the JTAG interface to override the UCLinux image file to Flash, so you can run the tried UCLinUX directly from the flash.

UCLinux Development and Debugging Now ARM7 development board can run UCLinUX, how to develop applications under uclinux? Like the Linux program on a normal computer, first write the source code for the application, but use the GCC compilation when compiling, you need to compile with ARM-ELF-GCC. After compiling, the executable must be downloaded to the ARM7 development board to run, download the program to the target board to enable TFTPD programs in Uclinux, and download the host end with TFTPCMD programs, then type can be used in UCLinux console window. The method of executing the file name is running. If you want the application to run automatically when Uclinux is started, you can modify the contents of the / etc / rc file in the UCLinux system. If you want to use GDB to debug the user program, you can refer to the relevant documentation on www.uclinux.org.

About the author Dai Lizhou, hobbed embedded system and Linux development, if you are interested in embedded Linux, please visit our website http://www.dailzh.net, invite you to join.

转载请注明原文地址:https://www.9cbs.com/read-7070.html

New Post(0)