Beruflich Dokumente
Kultur Dokumente
Abstract—Bootloader is an important part of ARM embedded CMOS standard cell and a memory compiler, and adopted a
system. The realization of Bootloader is closely related with new bus architecture which is called the Advanced
hardware. This paper gives a brief introduction to S3C2440 Microcontroller Bus Architecture (AMBA).
development board and its starting mode. Mainly introduces
the initialization of the each function module in S3C2440 A. S3C2440 Demoboard Configuration
during the system startup, and scheme out the Simplified S3C2440 is a S3C2440A-40 processor-based demoboard.
Bootloader for S3C2440. After testing, This Bootloader has Its internal resources includes Hitachi 4.3-inch touch screen
good practicability and portability. LCD, 8bit width 256M NAND FLASH, 2MB NOR FLASH,
32bit width 64M SDRAM, 7-12V wide voltage input,
Keywords-ARM; Bootloader; embedded system; starting
LT1765 high efficiency DC / DC buck, standard 12V power
mode
supply, as well as 100Mbps low power embedded Ethernet
I. INTRODUCTION network chips DM9000A [2].
Every computer system has its own bootloader. Like B. S3C2440 Demoboard Boot Mode
Windows system requires BIOS boot program, embedded For S3C2440 demoboard can boot in two ways: NAND
systems also need boot program. Unlike the BIOS in and NOR boot mode, which can be adjusted by the toggle
Windows systems which is boot by firmware, the boot switch on the board.
process of embedded systems is done by developers due to The NOR mode is when the board is powered on, the
economic considerations, which is the boot program called address 0 "saw" by CPU is the address 0 on the NOR
the Bootloader [1]. Bootloader is a piece of the boot FLASH. That is when using NOR mode, CPU can run
program. It usually executes after the system is powered on, directly from NOR FLASH address 0 when the board is
which is used to initialize the hardware devices, set the powered on. Therefore, the Bootloader can be burned
appropriate software environment, and finally start the directly onto NOR FLASH address 0. Hence, when you
operating system kernel. For different types of demoboard, start the demoboard, Bootloader’s boot program will start
their hardware configuration varies. Therefore, Bootloader from NOR FLASH address 0. But NOR FLASH has some
is needed for each type of the bare boards according to their drawbacks, which is that it can read data like reading
hardware features. This paper introduces various functional SDRAM memory, but cannot write to an address in NOR
modules’ initialization during S3C2440 boot process, and FLASH like writing to SDRAM memory.
designs a suitable thin Bootloader for S3C2440. The NAND mode is when the board is powered on,
Bootloader’s boot program is the first program to be NAND FLASH accesses the control interface and 4KB of
executed in an embedded system. It can initialize the system data is automatically copied from NAND FLASH address 0
hardware, relocate the Bootloader from the Flash to to the first 4KB address space of the on-chip RAM of 2440.
SDRAM, establish SDRAM memory image map, and set This space is usually referred to as 4KB "Steppingstone".
some environment parameters to pass to the operating Therefore, the address 0 “saw” by CPU is the address 0 in
system kernel, and finally jumps to the location of the RAM on 2440 chip. Hence, the Bootloader can be burned
kernel in the memory to start the kernel. directly onto NAND FLASH address 0. When the board
starts, it will automatically copy the first 4KB code of the
II. S3C2440 DEMOBOARD INTRODUCTION Bootloader to 2440’s RAM for execution [2].
S3C2440 is a chip produced by Samsung, which is
based on an ARM920T core 16/32-bit embedded RISC III. BOOT PROCESS AND IMPLEMENTATION
microprocessor and belongs to ARMv4T instruction set. It is A. Boot Process Analysis
primarily used for handheld devices as well as high cost and
low-power consumption applications. Its operating Bootloader program is composed of the assembler code
frequency is up to 203 MHz. It is developed using 0.13um and C code. Its execution is also divided into two phases.
The first phase executes the assembly code, which mainly
152
151
FLASH, then read the data directly from the NOR FLASH Bootloader program’s link script is defined as:
as reading from the memory into the SDRAM. If it is in the SECTIONS {
NAND FLASH, you need to follow the NAND FLASH . = 0x33f80000;
timing requirements for reading. .text : { *(.text) }
For NAND FLASH initialization, follow 2440 chip’s . = ALIGN(4);
manual and operate register NFCONF and NFCONT. .rodata : {*(.rodata*)}
NAND FLASH’s reading operation is slightly . = ALIGN(4);
complicated, detailed operation procedures is shown in .data : { *(.data) }
Figure 3. . = ALIGN(4);
__bss_start = .;
.bss : { *(.bss) *(COMMON) }
__bss_end = .;
}
153
152
e) Set Serial Port
After the kernel is boot, information will be printed
out, so the serial port settings needs to be done. Initialize
the serial ports according to 2440 chip’s manual, and add
functionality to print characters and strings. Details is as Figure 5. uImage structure
follows:
/* In the image file uImage, zImage is the actual kernel.
* Initialize UART0 So the actual kernel should be the storage location of
* 115200,8N1, no flow control uImage plus 64 bytes. Kernel size will not exceed 2MB.
*/ If the kernel is stored in the NAND FLASH
void uart0_init (void) (previously stored at address 0x60000), read 2MB data
{ from the NAND FLASH at address 0x60000 + 64 to
// GPH2, GPH3 used as TXD0, RXD0 address 0x30008000 in SDRAM.
GPHCON | = 0xa0; If the kernel is stored in the NOR FLASH (previously
// GPH2, GPH3 internal pullup stored at address 0), read 2MB data from NOR FLASH at
GPHUP = 0x0c; address 0 + 64 to address 0x30008000 in SDRAM [5].
// 8N1 (8 data bits, no check, 1 stop bit)
b) Set parameters
ULCON0 = 0x03;
Passing parameters from the Bootloader to the kernel
// Query, UART clock source is PCLK
is done by tag structure, and it needs to set up four type of
UCON0 = 0x05;
tags, which are the start tag, memory tag, command line
// Do not use the FIFO
tag, and end tag. The command line tag is the most
UFCON0 = 0x00;
important tag, expressed as "noinitrd root = / dev /
// Do not use flow control
mtdblock3 init = / linuxrc console = ttySAC0".
UMCON0 = 0x00;
Tags are expressed in the form of tag, whose structure
// 115200 baud rate
is shown in Figure 6.
UBRDIV0 = UART_BRD;
}
/ * Send a character * /
void putc (unsigned char c)
{
/ * Wait until the all data in the buffer is sent * /
while ((UTRSTAT0 & TXD0READY)!);
/ * Write data to UTXH0 register, UART
automatically sends it out * /
UTXH0 = c;
}
/ * Print a string * /
void puts (char * str)
{
int i = 0;
while (str [i])
{
putc (str [i]); Figure 6. tag structure
i ++;
} Each tag uses the tag header structure as the starting
} part. The tag_header structure is shown in Figure 7.
f) Execution of the main function
Jump to the main function to perform the second
phase of the operation, i.e., execute:
ldr pc, = main
Figure 7. Tag header structure
2) Second Phase of the Bootloader
a) Reads kernel from FLASH to SDRAM The core of the start tag is constituted by tag core
The detailed structure of the kernel image file uImage structure, which is shown in Figure 8.
is shown in Figure 5.
154
153
c) Load kernel
The kernel is stored at address 0x30008000 in
SDRAM, and the machine ID is 362, so the kernel is boot
as follows:
Figure 8. tag_core structure
void (* theKernel) (int zero, int arch, unsigned int
params);
The core of the memory tag is constituted by puts ("Boot kernel \ n \ r");
tag_mem32 structure, which is shown in Figure 9. theKernel = (void (*) (int, int, unsigned int))
0x30008000;
theKernel (0, 362, 0x30000100);
IV. PROGRAMMING VERIFICATION
Figure 9. tag_mem32 structure
The Bootloader is programmed into the NAND
FLASH or NOR FLASH, and some of the printed
The core of the command line tag is constituted by information after boot is shown in Figure 12.
tag_cmdline structure, which is shown in Figure 10.
Figure 12. Part of the printed information after starting the kernel
155
154
computer system, 2014, 23(9):204-207.
[4] Ruilong Deng, Jiming Chen, Jialu Fan, Youxian Sun. A general
approach for building Linux on sensor node Imote2 [J].Computer
Standards & Interfaces, 2011, 34(1):101-108.
[5] XIE Fei, JIANG Daming. Implementation of automatic
identification boot in U—Boot based on ARM9 [J].Electronic
design engineering, 2013, 21(3):54-56.
[6] Xiaoming Liu, Lian Pan. The Study of Target Tracking Based on
ARM Embedded Platform [J].Journal of Computers, 2012,
7(8):2015-2023.
[7] Liu Zhichao, Jing Qi. A way to verify running Linux Kernel
function [J].Microcomputer & Its Applications, 2014, 33(21):4-5.
156
155