Bootloader transplants S3C44B0 of uClinux

Publisher:电子创意达人Latest update time:2023-02-03 Source: elecfansKeywords:bootloader  uClinux  S3C44B0 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

S3C44B0 is a 32-bit processor developed by Samsung for handheld devices or other general-purpose devices. It is based on the ARM7TDMI core and has no memory management unit (MMU). The uClinux system is widely used in embedded systems using MMU-free microprocessors. As a derivative system of Linux, it has the advantages of supporting multi-tasking, streamlined kernel, high efficiency and stability, and open source code. The basic process of system transplantation includes: obtaining a newer version of the linux-2.6.9 kernel source code, modifying the hardware platform-related parts of the source code according to the target platform, adding necessary peripheral drivers, and cross-fertilizing the system for the target platform. Compilation, downloading and debugging of the generated kernel image file, etc.


Hardware environment introduction

The hardware platform is based on S3C44B0 as the core, and the external crystal oscillator frequency is 6MHz. The core frequency can reach up to 66MHZ. The platform uses 2MB AMD29LV160DB as rom, and its address space is 0~1fffff. It uses HY57V1620HG sdram as memory, and the address space is 0c000000~ 0c7fffff, 8MB in total, uses RTL8019as as the network control chip, connected to Bank5 of S3C44B0, and supports online debugging and program programming through the parallel port connection between JTAG and PC.

Bootloader transplants S3C44B0 of uClinux

Figure 1 Hardware platform block diagram


Transplantation of uClinux

3.1 Establishment of cross-compilation environment

Cross-compilation is the process of using a compiler running on a certain machine (host machine) to compile a source program to generate target code that runs on another machine (target machine). The cross-compilation environment of this article is established as follows: Install the Linux operating system on the PC as our host, the version is FEDore Core 5, download the cross-compilation tool chain arm-elf-tools20040427 from http://uClinux.org/ and install it On the Linux host, this establishes the uClinux-arm cross-compilation environment.


3.2 Transplantation of U-Boot-1.1.2

Bootloader is the first piece of code that runs after the system is powered on. In an ARM-based embedded system, execution usually starts at address 0X00000000 when the system is powered on or reset, and this address is usually the system's bootloader. Through this Segment programs can initialize hardware devices and establish memory space mapping, thereby adjusting the system's software and hardware environment to a suitable state, so as to prepare the correct environment for the final call to the operating system kernel.

In this article, the bootloader is implemented by transplanting U-Boot. The full name of U-Boot is Universal Boot Loader. It is a Bootloader developed by the German DENX team for a variety of embedded CPUs. It supports PowPC, ARM, MIPS, M68K and other processor platforms, and supports Linux, VxWorks, NetBSD, etc. A variety of embedded operating systems are mainly used to develop embedded system initialization code bootloaders, which are easy to cut and debug, comply with the GPL (General Public License) convention, and are completely open source. The source code of multiple versions of it can be obtained from. This article uses u-boot-1.1.2 as an example for transplantation.


Before transplanting, you can understand the main structure of U-Boot source code by viewing the doc document. Among the many directories, the main ones related to transplantation are board, cpu, drivers and other directories. The basic process of transplantation is as follows:

(1) Find the hardware platform with S3C44B0 processor as the core. This purpose is to simplify the difficulty of transplantation;

Run find -exec grep -l 44B0 {} under board/ to find /dave/B2/B2.c. From this we know that the B2 platform of dave company is based on the S3C44B0 processor, so the transplantation can be carried out with reference to the B2 platform;

(2) Create the directory lanlan for our target platform, and copy the B2 board files to the created directory, but you need to modify the name of the file;

(3) Modify the name of the file in the newly created directory and change all B2 in the file to lanlan;

(4) Add the configuration file lanlan.h of the target platform in include/configs/; this file can be created by referring to B2.h;

(5) Modify the Makefile file in the general directory and add the compilation information of the target board;

After this process is completed, you can run make lanlan_config in the u-boot/ directory; make to compile. If files such as u-boot.bin can be generated after the compilation is completed, it means that the previous process is correct. If an error occurs, you need to follow the error. Make relevant modifications to the information;

(6) Modify the hardware-related files. There is a directory of S3C44B0 in cpu/, which means that U-Boot has provided support for S3C44B0. We just need to modify some files to make them suitable for our target platform. The main modification is cpu/ Download start.S and serial.c, and lanlan.h under include/configs/ about the CPU frequency, serial port baud rate, PLLCON register, flash and sdram size, base address and network control chip base address, etc., After confirming that the modification is correct, run the make lanlan_config;make command. The compiled u-boot.bin is the boot program we need;

(7) Burn the generated u-boot.bin to the 0x0 address of the target platform through JTAG, and configure minICom under Linux or HyperTerminal under Windows. Note that the configured serial port and serial port baud rate must be the same as those set in U-Boot. The same as before, after pressing the reset button or powering on and restarting the target platform, you can see U-Boot running in the system from minicom or Hyper Terminal.

Through the above steps, the main work of U-Boot transplantation is completed.


3.3 Transplantation of uClinux kernel

3.3.1 Preparation of uClinux-dist source code package

Download the uclinux-dist source code package from the official website of uClinux. The source code package contains uClinux kernel, uClibc library and busybox and other user applications under uClinux. What is downloaded in this article is uClinux-dist-20041215.tar.gz. After decompression under the Linux system, a uClinux-dist directory will be generated. The directory contains all the files needed to compile the uClinux kernel. The uClinux-dist directory contains three subdirectories: linux-2.2.x, linux-2.4.x, and linux-.2.6.x, which are the source codes of the three versions of uClinux kernels. Our purpose is to convert uClinux-2.6.9 version is ported to the target platform, so we also need to download linux-2.6.9.tar.bz2 from http://www.uClinux.org, download linux-2.6.9-uc0.patch from http://www.uClinux.org, and download it from Samsung’s website Download the patch file linux-2.6.9-uc0.hsc0.patch from http://www.oprenSRC.sec.samsung.com. Unzip the kernel Linux-2.6.9.tar.bz2 under the Linux system and apply the patch files linux-2.6.9-uc0.patch and linux-2.6.9-uc0- hsc0.patch. Rename the patched 2.6.9 kernel. For linux-2.6.x and replace linux-2.6.x in the uClinux-dist package, complete the preparations before transplantation.


3.3.2 Modification of uClinux-dist source code

Follow the steps below to add S3C44B0 related files:

# cp uClinux-dist/vendors/Samsung/4510b –r uClinux-dist/vendors/Samsung/44b0, copy the Samsung 4510b file already in the source code package and rename it to 44b0. This process can also be done directly Complete with the mouse;

# cp linux-2.6.x/arch/armnommu/configs/s3c44b0x_defconfig

vendors/Samsung/44b0/config.linux-2.6.x, this step is to copy the s3c44b0x_defconfig file to the 44b0 directory. This step can also be completed by copying and pasting;

Although the patch file has been added to the linux-2.6.9 kernel, we still need to modify the source code to successfully compile it. The file modifications are as follows:

(1) Modify linux-2.6.x/arch/armnommu/arch/kernel/vmlinux.lds.S and add the following content:

(.got)?Global offset table */
romfs_start = .;
romfs.o
romfs_end = .;

The purpose of this modification is to connect the romfs file system to the kernel image.

(2) Modify linux-2.6.x/arch/armnommu/kernel/setup.c, add variables romfs_start, romfs_end and modify them

Its settings are as follows:
default_command_line 
extern int _stext, _text, _etext, _EDAta, _end; 
extern int romfs_start,romfs_end; 
char *from = default_command_line; 
sprintf(default_command_line, "root=https://www.eeworld.com.cn/dev/ ram0 initrd=0x%08lx,%ldk keePINitrd", (unsigned 
long)&romfs_start,((unsigned long)&romfs_end - (unsigned long)&romfs_start)>>10);

(3) Modify /bin/expand /etc/ramfs.img /dev/ram1 in the vendors/MICetek/44b0/rc file;

(4) Add the serial port driver, add the files linux-2.6.x/drivers/serial/serial_s3c44b0.c and linux-2.6.x /include/asm-armnommu/arch-s3c44b0/UART.h, because in linux-2.6. The support for S3C44B0 in the 9 kernel is not very good. The system only provides a simple serial port driver, so a serial port driver needs to be added.


3.3.3 Kernel configuration and compilation

You need to configure the kernel before compiling the kernel. You can configure the kernel in three ways: run make config/make menuconfig/make xconfig in the uClinux-dist directory, where make config is in the character interface and make menuconfig is in the character interface. The menu interface implemented, make xconfig is a graphical interface, and the three configuration methods are consistent. The xconfig interface is relatively friendly and easy to master, but it is not as stable as the menuconfig menu, and it cannot run on some machines. This article is completed using make menuconfig of. When running make menuconfig, the program will appear in sequence with configuration interfaces for the development platform, kernel, file system, and application, which can be configured according to your own needs. Most options can use their default values ​​during configuration, and only a small number of options require users to choose according to their needs. When configuring the kernel, there are three options, and their respective meanings are as follows:
"Y" - compile this function into the kernel;
"N" - do not compile the function into the kernel;
"M" - compile the function into a module that can be dynamically inserted into the kernel when needed;

[1] [2]
Keywords:bootloader  uClinux  S3C44B0 Reference address:Bootloader transplants S3C44B0 of uClinux

Previous article:Transplantation of μCOS-Ⅱ on ARM series microcontroller S3C44B0x
Next article:Illustration of JLINK debugging experience under ADS

Latest Microcontroller Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号