Linux is an operating system that supports processors of various architectures and has strong portability. This paper describes the method and process of porting μClinux to a target board based on the S3C4510B processor. First, the S3C4510B processor and μClinux are introduced, and a brief explanation is given on how to build a porting environment. Then, the design and implementation of the Bootloader on the development board and the porting method of the μClinux kernel are discussed in detail. Finally, a brief explanation is given on how to develop applications in this μClinux-based embedded system environment.
1 Introduction
ARM (Advanced RICS Computers) can be considered as the name of a company, a general term for a microprocessor, or the name of a technology.
ARM was founded in Cambridge, UK in 1991, mainly selling licenses for chip design technology. At present, microprocessors using ARM technology intellectual property (IP) cores, commonly known as ARM microprocessors, have spread across various product markets such as industrial control, consumer electronics, communication systems, network systems, and wireless systems. Microprocessor applications based on ARM technology account for more than 75% of the market share of 32-bit RISC microprocessors. ARM technology is gradually penetrating into every aspect of our lives.
ARM microprocessors using RISC architecture generally have the following characteristics: small size, low power consumption, low cost, high performance; support Thumb (16-bit)/ARM (32-bit) dual instruction sets, and good compatibility with 8-bit/16-bit devices; extensive use of registers, faster instruction execution speed; most data operations are completed in registers; flexible and simple addressing mode, high execution efficiency; fixed instruction length. ARM's products mainly include ARM7Thumb family, ARM9Thumb family, ARM10Thumb family and StrongARM family.
2 Based on ARM S3C4510B processor and μClinux
The S3C4510B used in this article is an embedded microprocessor developed by Samsung using the ARM7 processor core. As a cost-effective network processor, the S3C4510B has been widely used in various network devices. Its central processor is the ARM7TDMI core. ARM7TMDI is the most widely used 32-bit embedded RISC processor and is a low-end ARM processor core. The basic meaning of TDMI is:
T: supports 16-bit compressed instruction set Thumb;
D: Support on-chip Debug;
M: Embedded hardware multiplier (Multiplier);
I: Embedded IC E, supports on-chip breakpoints and debug points.
The ThumbTM 16-bit compressed instruction set can achieve 32-bit system performance with a smaller storage space requirement. The S3C4510B processor includes 8kB configurable integrated Cache/SRAM, 1 I2C serial interface, 2 UARTs , 2 32-bit timers, 18 programmable general-purpose I/O ports, and 1 10M/100M Ethernet controller. The rich on-chip peripherals greatly simplify the system design. At the same time, this microprocessor supports a wide range of operating systems, including Windows CE, Linux, PalmOS, etc. μClinux is an embedded Linux operating system for the control field. It is derived from the Linux 2.0/2.4 kernel and inherits most of the features of mainstream Linux. It is suitable for microprocessors/microcontrollers that do not have a memory management unit (Memory Management Unit, referred to as MMU), such as ARM7TDMI, which usually has embedded systems with little memory or Flash. Under the guarantee of the GNU General Public License (GUN GPL), users running the μClinux operating system can use almost all Linux API functions without being affected by the lack of MMU.
3 Establishing μClinux development environment
The biggest difference between embedded system development and general application development is that the former requires the establishment of a special hardware environment, while the latter is generally based on a specific operating system or distributed platform. The latter platform has abstracted the hardware or network media, so there is no need for system developers to complete these tasks. In embedded system development, this is also done by developers.
The embedded system development environment is generally divided into two parts: the host (HOST) and the target board (TARGET). The host is the development platform, used to run various tools in the development process; the target board is the running and testing platform, and is the final resident environment of the embedded system. There needs to be some way for communication between the host and the target board, such as using the RS232C serial port. The purpose of this communication is to send control instructions and transmit data, and at the same time obtain feedback information. Figure 1 shows the hardware environment for system transplantation.
The host PC uses COM1 to connect to the UART1 of S3C4510B through MAX232, and completes the necessary control functions of the target board through the serial port. The S3C4510B development board is equipped with a DM9161 Ethernet card chip to establish a raw IP connection with the host, and use the link layer address to complete the transmission of large batches of data.
After the hardware environment is established, you need to create a software development environment. The software environment mainly refers to the cross-compilation environment of the ARM architecture. The RedHatLinux8.0 operating system is used on the host side, and the cross-development environment of the ARM architecture of gCC is established on it. The tool chain can be downloaded from http://mac.os.nctu.edu.tw:
(1)armelfbinutils2.115.i385.rpm
Some auxiliary tools, including objdump (can decompile binary files), as (assembly compiler), ld (connector), etc.
(2)armelfgcc2.95.32.i386.rpm
Configure the GNU C compiler for arm. Use it to develop and compile binaries that can run on the target on the host machine.
(3)genromfs0.5.11.i386.rpm
A tool to generate Romfs. Romfs is a file system that requires less space than the general ext2 file system.
Place these three files in any directory on the host machine, and then enter the following command to install:
We have established the μClinux software development environment.
4Bootloader design and implementation
Bootloader is used for the transition from hardware startup to operating system startup, and is an essential program in embedded systems. It is equivalent to BIOS and OSLoader in PC, and is used to initialize the hardware and start the operating system. Therefore, its implementation method is determined by the characteristics of the hardware. Like BIOS/OSLoader, it needs to be fixed in the target board. Every time the target board is started, the Bootloader will be run first. After it completes the initialization of the CPU and related hardware, it will start the operating system or embedded application fixed program from the pre-specified address.
In the process of embedded system development, Bootloader also plays the role of communicating with the host. It is equivalent to a "server" that constantly monitors the control information and data information sent from the host to complete the corresponding operations.
When the system is powered on, the Bootloader starts executing from address 0x0, reconfigures the memory map as shown in Table 1, and executes the hardened Linux kernel.
Bootloader can be downloaded to the target board via JTAG using ARM emulation software SDT2.5 .
Compilation and transplantation of 5μClinux kernel
As the core of the operating system, the μClinux kernel is responsible for managing the system's processes, memory, device drivers, file systems, and network systems, and determines the various performances of the system. The μClinux kernel adopts a modular organizational structure, and increases or decreases the system's functions by adding or reducing kernel modules.
In kernel configuration, select Samsung/4510B in the product list. Select uC-libc in library selection.
(2)makedep
Look for dependencies.
(3) makeclean
Clear all object files, module files, and some temporary files generated when building the kernel previously.
(4)makelib_only
Compile the library file.
(5)makeuser_only
Compile the user application files.
(6)makeromfs
Generate a romfs file system.
(7)makeimage
(8)make
Through the makefile files in each directory, a large number of target files will be generated in each directory.
After completing the above steps, the compilation of μClinux source code is completed. We can see two kernel files in the /μClinuxSamsung/images directory: image.ram and image.rom.
Among them, iamge.rom can be directly burned into the Flash memory . When the system is reset or powered on, the kernel is self-decompressed to SDRAM for execution. Image.ram can be loaded into SDRAM through SDT for direct execution.
The μCLinux kernel has two optional running modes: it can run directly on Flash or it can be loaded into RAM and run.
Flash operation mode: burn the kernel executable image file to the Flash, and execute it sentence by sentence from a certain address in the Flash when the system starts. This method is actually adopted by many embedded systems.
Kernel loading RAM method: Store the kernel's compressed file on Flash. When the system starts, read the compressed file, decompress it in memory, and then start execution. This method is relatively complicated, but the running speed may be faster. At the same time, this is also the startup method used by the standard Linux system.
6Application Development on μClinux
The following describes the process of adding an application (such as examplec) to μClinux.
First, enter the μClinux-Samsung/user directory and create a subdirectory of your own, such as myproject. Copy examplec to the myproject directory and write the corresponding makefile. Then enter the user directory and add a line of statement to the makefile in the directory:
dir_$(CONFIG_USER_MAAPP_ LED NXY)+=myapp
Switch to the μClinuxSamsung/config directory, open the configin file, and add a statement similar to the following at the end:
mainmenu_optionnext_comment
comment'MyAppICation '
bool'example'CONFIG_USER_MYPROJECT_
EXAMPLE
comment'MyApplication
endmenu
After that, when compiling the kernel's makemenuconfig, you can select your own application example in the submenu of CustomizeVendor/UserSetting (NEW), and then compile it in the same way as in Section 5.
However, if we have to add the application to the kernel and recompile it every time we modify it, it is obviously too inefficient and not feasible. So is there any way to save debugging time?
In the above chapter, we mentioned that Bootloader can be responsible for communicating with the host. Here we can use it to quickly download the application to the target board.
First, use the elf2flt tool to cross-compile example.c to generate an executable file example (flat format) under μClinux. The command is as follows:
arm-elf-g CC -Wall-o2-wl,elf2flt-oexampleexample.c
Then connect the host computer and the target board through a serial cable, and start a hyperterminal on the host computer, such as minicom, select a COM port (usually serial port 1), set the baud rate to 19200, 8 data bits, 1 stop bit, and no parity. Then select the transmission protocol Zmodom, and finally select the file example to be transmitted and send it. After the transmission is completed, you can find example in the directory of the target board through the hyperterminal, which means that the transmission is successful.
On the target board, add the x attribute (executable attribute) to example, and then enter the command /example to run the program. Obviously, this method can be used to debug the application program very conveniently and quickly. After the debugging is completed, add it to the kernel and compile it together.
7 Conclusion
This paper discusses the basic process of porting μClinux to the ARM7 system microprocessor S3C4510B, and briefly introduces the Bootloader and the loading and debugging methods of the application. In different host and target board environments, various errors or problems may occur during the specific porting process. You can make full use of the powerful tool GCC and correct it step by step according to its error prompts, and finally successfully port μClinux.
Previous article:GIS coal mine safety real-time monitoring system based on ARM embedded technology
Next article:Method of Linux system transplantation based on ARM
Recommended ReadingLatest update time:2024-11-16 12:49
- Popular Resources
- Popular amplifiers
- Chip Manufacturing: A Practical Tutorial on Semiconductor Process Technology (Sixth Edition)
- A Microprocessor Performance Analysis Approach Based on Microbench and Ideal Bound
- Principles and Applications of Single Chip Microcomputers and Embedded Systems
- 2004_High Frequency High-Efficiency Voltage Regulators for Future Microprocessor
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- Why does the CAN message fail to send?
- How to understand the equivalent of capacitors passing AC
- C28x Filter Library User Experience
- What is the function of the resistor between the input and output of 78L05?
- 【Project source code】 LCD1602 data sheet
- rk3568 latest core board + Android11
- Learning MCU development precautions and requirements
- What are the options for TI DSP?
- The long-awaited ADI system solution selection is now online~
- Tips for overcoming RF challenges with WiFi 6