1 Introduction
At present, embedded processors based on ARM core have become the mainstream in the embedded system market. With the widespread application of ARM technology, the establishment of embedded operating systems for ARM architecture has become a hot topic in current research. S3C2410 is a 16/32-bit embedded processor developed by SAMSUNG based on the ARM920T processor core. It has a running frequency of more than 200M and has rich on-chip resources such as MMU and cache. It is currently the chip with the largest shipment volume based on the ARM920T core. There are also many embedded operating systems, such as Tor2nado's VxWork, Microsoft's Windows CE, etc. However, a large number of developers choose Linux because its source code is open and can be easily modified and transplanted to their own target platform system for use. And it has been proven that the effect is satisfactory. The combination of the two will surely create a new world in the world of embedded systems.
2 Linux operating system porting
2.1 Meaning of transplantation
To make standard Linux run on ARM embedded processors, it is necessary to go through the process of porting. Porting means to make a set of software run normally on a selected hardware platform, that is, to make appropriate modifications to the platform dependent parts. The arch subdirectory of the kernel source code includes all the core codes related to the platform architecture. Each of its subdirectories represents a supported architecture. arm is the subdirectory about the processor architecture we selected. Our porting work is mainly concentrated in this directory.
2.2 Specific Implementation of Transplantation
If we have built a complete cross-compilation platform, the porting work can begin (taking the most widely used linux-2.4 as an example, put it under /usr/SRC/linux-2.4.18 ) .
/Makefile
A project often contains many files, which are placed in multiple directories according to certain rules. Makefile is used to specify compilation rules, such as which files need to be compiled and which files should be compiled first. What needs to be done here is:
Specify the target platform ARCH := $(shell uname -m | sed -es/i.86/i386/ -es/sun4u/sparc64/ -es/arm.*/arm/ -es/sa110/arm/)
Set to ARCH := arm
Specify the cross compiler CROSS_COMPILE =
Set CROSS_COMPILE = arm-linux-
/arch/arm/Makefile
The boot code is generated through this file. Since the 2.4 kernel does not support S3C2410, add the following code by yourself
ifeq ((CONFIG_ARCH_ S3C2410),y)
TEXTADDR = xxx
MACHINE = s3c2410
Endif
TEXTADDR is the virtual starting address of the kernel[6] and also the final running address of the kernel. It is usually set to PAGE_OFFSET + 0x8000 and must be combined with the actual situation[2].
/arch/arm/config.in
config.in is the configuration file that determines what we see in the configuration menu. Add the $CONFIG_ARCH_S3C2410 suboption [5] by yourself.
if [ "$CONFIG_ARCH_S3C2410" = "y" ]; then
comment'Archimedes/A5000 Implementations'
dep_bool ' SMD K (MERI TECH BOARD) '
CONFIG _S3C2410_SMDK//
$CONFIG_ARCH_S3C2410
//other
fi
in if [ "$CONFIG_FOOTBRIDGE_HOST" = "y" -o
…
"$CONFIG_ARCH_SA1100" = "y" ]; then
define_bool CONFIG_ ISA y
else
define_bool CONFIG_ISA n
fi
Add "$CONFIG_ARCH_s3c2410" = "y"-o in the same way.
/arch/arm/boot/Makefile
ZTEXTADDR is the location of image.rom before decompression, and ZRELADDR is the location where the kernel is decompressed and finally executed. The mapping relationship between ZRELADDR and TEXTADDR is as follows: __virt_to_phys(TEXTADDR) == ZRELADDR[6].
ifeq ((CONFIG_ARCH_s3c2410),y)
ZTEXTADDR = xxx
ZRELADDR = xxx
Endif
/arch/arm/boot/compressed/ Makefile
Add ifeq ("$(CONFIG_ARCH_S3C2410),y)
OBJS +=head-s3c2410.o
endif
/arch/arm/boot/compressed/head-s3c2410.s
Here you need to add the kernel decompression pre-processor initialization file head-s3c2410.s, sample code:
.section ".start", "ax"
__S3C2410_start:
b IC r2, pc, #0x1f @ Clear pc related bits and put them in r2
add r3, r2, #0x4000
1: ldr r0, [r2], #32
teq r2, r3
bne 1b
mcr p15, 0, r0, c7, c10, 4 @ Write back to Write Buffer
mcr p15, 0, r0, c7, c7, 0 @ refresh I & D caches
#if 0
@ Disable MMU, caches
…
#endif
mov r0, #0x00200000
1: subs r0, r0, #1
bne 1b
/arch/arm/kernel/ Makefile
Add $(CONFIG_ARCH_2400) $(CONFIG_ARCH_2410) to the same
no- IRQ -arch :=$(CONFIG_ARCH_INTEGRATOR) $(CONFIG_ARCH_CLPS711X)
…
$(CONFIG_ARCH_AT91RM9200
And add obj-$(CONFIG_MIZI) += ecard.o
obj-$(CONFIG_ARCH_APM) +=apm2.o
/arch/arm/kernel/entry-armv.S
This file mainly defines the interrupt processing part during CPU initialization [6]. Please refer to the processor manual and set it according to the processor usage requirements.
/arch/arm/kernel/debug-armv.S
This file is used for the most basic serial port debugging functions [6], including debugging serial port address initialization, sending, waiting, busy status definition, etc. This file can be used to print out relevant information during the startup process.
/arch/arm/kernel/setup.c
In this file, several variables need to be set according to the board used [5]. nr_banks specifies the number of memory blocks, bank specifies the range of each memory block, PAGE_OFFSET is the memory start address, and MEM_SIZE is the memory size. PAGE_OFFSET and MEM_SIZE should be defined in /include/asm-arm/arch-s3c2410.
/arch/arm/mm/mm-armv.c
This file is used for hardware-related memory management, such as initializing memory page tables, memory mapping, etc.
Change init_maps->bufferable = 0; to init_maps->bufferable = 1;
/arch/arm/mach-s3c2410
Create the corresponding directory and write irq.c, mm.c, time.c, arch.c, and Makefile according to the processor usage requirements, respectively implementing the initialization of the interrupt controller, the virtual-real mapping relationship of the address, clock interrupt and real-time clock processing, and the setting of Ramdisk usage parameters.
/include/asm-arm/arch-s3c2410
The header files used are defined in this directory.
At this point, the transplantation work is basically completed. By performing the following compilation process, we can obtain the image file we need [4].
make dep; make clean; make zImage
3. Composition of the complete system
In order for Linux to really run, it also requires the support of the root file system. The commonly used method is Ramdisk. Ramdisk is a driver mechanism that creates and mounts a file system by simulating the computer's memory (RAM) as a device. It should generally include the following directory contents: /dev (device file directory); /proc (proc file system directory); /etc (system configuration file directory); /sbin (system program directory); /bin (basic application directory); /lib (shared function library directory); /mnt (directory for mounting other disk nodes); /usr (directory for additional applications)[3].
In addition, a complete embedded system also needs boot code, such as vivi, u_boot, etc. Bootloader also needs to be transplanted and compiled, which is not described in detail here. After the above three parts are prepared and the FLASH is divided into intervals[1], the FLASH burning tool can be used to burn the Bootloader, kernel and root file system into the FLASH in sequence. Then the system can be started.
The system starts to execute the Bootloader from address 0. After the Bootloader completes the related hardware initialization work, it copies the compressed kernel image from the FLASH to the SDRAM and passes the address parameter of the root file system to the kernel [1]. After the kernel is copied to the SDRAM, it is decompressed and started. During the kernel startup process, the root file system is searched according to the address parameter passed by the Bootloader and loaded into the embedded system. In this way, the entire Linux is booted and started and enters the normal working state.
4 Conclusion
The author's innovation: The commonly used 2.4 version of Linux does not include support for S3C2410, which brings inconvenience to the development of embedded systems based on it. Based on the understanding of the common problems in the transplantation process and the author's accumulated experience and lessons, this article analyzes in detail the main technologies of how to transplant Linux2.4 to the embedded system of the ARM platform, so that the system can well support the target platform, and the transplanted Linux retains the original stable working characteristics. Emphasizing its principles and operability in the transplantation process is very important for deepening the understanding of the Linux kernel and developing embedded systems, and has reference significance for the development of other embedded systems.
References
[1] Liu Jingjing, Design of boot program for embedded system based on ARM-Linux[J], Microcomputer Information, 2006, 2-2: 123-125
[2] Li Ming, ARM Linux porting process and analysis, Electronic Design Applications [J], 2003, 7: 55-57
[3] Xu Hong et al., Operating System Experiment Guide [M], Beijing: Tsinghua University Press, 2002, 5
[4] Zhang Jie, Cao Weihua, Wu Min, Shi Weiqiang, Linux transplantation based on S3C2410 [J], Microcomputer Development, 2005 (15), 6: 142-144
[5] Sun Tianze, Yuan Wenju, Zhang Haifeng, Embedded Design and Linux Driver Development Guide [M], Beijing: Electronic Industry Press, 2005, 9
[6]Wookey and Tak-Shing, Porting the Linux Kernel to a New ARM Platform, SOLUTIONS JOURNAL, 2002, 4: 52-57
Previous article:Distributed embedded system upgrade solution using CAN bus
Next article:Design methods and steps of serial communication under Linux environment
- Popular Resources
- Popular amplifiers
- Naxin Micro and Xinxian jointly launched the NS800RT series of real-time control MCUs
- How to learn embedded systems based on ARM platform
- Summary of jffs2_scan_eraseblock issues
- Application of SPCOMM Control in Serial Communication of Delphi7.0
- Using TComm component to realize serial communication in Delphi environment
- Bar chart code for embedded development practices
- Embedded Development Learning (10)
- Embedded Development Learning (8)
- Embedded Development Learning (6)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Intel promotes AI with multi-dimensional efforts in technology, application, and ecology
- ChinaJoy Qualcomm Snapdragon Theme Pavilion takes you to experience the new changes in digital entertainment in the 5G era
- Infineon's latest generation IGBT technology platform enables precise control of speed and position
- Two test methods for LED lighting life
- Don't Let Lightning Induced Surges Scare You
- Application of brushless motor controller ML4425/4426
- Easy identification of LED power supply quality
- World's first integrated photovoltaic solar system completed in Israel
- Sliding window mean filter for avr microcontroller AD conversion
- What does call mean in the detailed explanation of ABB robot programming instructions?
- "Cross-chip" quantum entanglement helps build more powerful quantum computing capabilities
- Ultrasound patch can continuously and noninvasively monitor blood pressure
- Ultrasound patch can continuously and noninvasively monitor blood pressure
- Europe's three largest chip giants re-examine their supply chains
- Europe's three largest chip giants re-examine their supply chains
- Breaking through the intelligent competition, Changan Automobile opens the "God's perspective"
- The world's first fully digital chassis, looking forward to the debut of the U7 PHEV and EV versions
- Design of automotive LIN communication simulator based on Renesas MCU
- When will solid-state batteries become popular?
- Adding solid-state batteries, CATL wants to continue to be the "King of Ning"
- Problems encountered with diode step-down
- PLD Practice Reference Examples
- DK_MINI_GW1N-LV4LQ144C6I5_V1.1 User Manual
- Application Tips/Microcontrollers to Improve Power Efficiency in 8051 Systems
- Microchip introduces new digital signal control
- Confused question about inductor
- Learn about the antenna of the wireless router
- Can small companies still make a difference in the current mobile communications market?
- Programming with Ada on the Adafruit STM32 Feather Development Board
- Advances in radio technology may be significant