Presentation is loading. Please wait.

Presentation is loading. Please wait.

Chap. 4 ARM Boot Loader Internals. 2 S3C2500 ARM940T Core module ARM9TDMI CoreIC.

Similar presentations


Presentation on theme: "Chap. 4 ARM Boot Loader Internals. 2 S3C2500 ARM940T Core module ARM9TDMI CoreIC."— Presentation transcript:

1 Chap. 4 ARM Boot Loader Internals

2 2 S3C2500 ARM940T Core module ARM9TDMI CoreIC

3 3 S3C2500B Block Diagram

4 4 ARM940T Block Diagram

5 5  Introduction  What does the bootloader do before entering C code.  Bootloader assembly code

6 6 Introduction #1/2  The main purpose of bootloader is to initialize the target system,and load the operating system to execute.  The bootloader is usually the first piece of code that will be executed on any hardware.  Bootloader has absolutely high dependence on the target system. On different target system, despite of the same CPU, you usually need to modify the bootloader.

7 7 Introduction #2/2  A more friendly and powerful bootloader can include the following extra function. 1. Power on Self Test (POST) 2. Support console operate 3. Support download kernel image or file from serial port, Ethernet, even USB. 4. Support write / erase kernel image or file to flash. 5. Setting up IP, MAC, System Time, etc. 6. Support Accessing I/O, memory, register.  The universal bootloader, U-boot and Blog, are such examples of powerful bootloaders.

8 8 Boot Init Flow 0x00000000 0x0000001C Exception Vector Table B Reset_Handle Reset_Handle Hardware Environment configuration Big Endian System Configuration Set Internal clock Disable peripheral clock Disable interrupt Protection Region Unit Disable Disable protection unit Disable ICache Disable DCache SDRAM Initialize clock, refresh, wait cycle EEPROM/Flash/SRAM init Copy ROM image to SDRAM Remap Stack Intialize Initial variable depend on develop environment copy the static data IRQ disable Call C function call execute the loader Init the consol UART Init the Ethernet Load the program file from the tftp server to the 0x200000

9 9 Copy ROM image to SDRAM(1)  由 memory address 0x00000000 (FLASH) 開始的地方複製 128KB 的資料 到 address 0x40000000 (SDRAM) 開始 的地方 0x00000000 0x40000000 0x00000000 0x40000000 128KB

10 10 Flash EXT I/O Bank #1 EXT I/O Bank #2 EXT I/O Bank #3 EXT I/O Bank #4 EXT I/O Bank #5 EXT I/O Bank #6 EXT I/O Bank #7 Reserved SDRAM #0 Reserved SDRAM #1 Reserved Internal Register 0x00000000 0x01000000 0x02000000 0x03000000 0x04000000 0x05000000 0x06000000 0x07000000 0x08000000 0x40000000 0x48000000 0x80000000 0x88000000 0xF0000000 0xFFFFFFFF Flash EXT I/O Bank #1 EXT I/O Bank #2 EXT I/O Bank #3 EXT I/O Bank #4 EXT I/O Bank #5 EXT I/O Bank #6 EXT I/O Bank #7 Reserved SDRAM #0 Reserved SDRAM #1 Reserved Internal Register 0x00000000 0x08000000 0x40000000 0x48000000 0x80000000 0x81000000 0x82000000 0x83000000 0x84000000 0x85000000 0x86000000 0x87000000 0x88000000 0xF0000000 0xFFFFFFFF remap

11 11 STACK area USR_STACK UDF_STACK ABT_STACK IRQ_STACK FIQ_STACK SUP_STACK ﹜ 4KBytes ﹜ ﹜ ﹜ 1KBytes ﹜ ﹜ 4KBytes STACK area

12 12 Initializing Memory required by run time Environment IMPORT |Image$$RO$$Limit| ;// End of ROM code (=start of ROM data) IMPORT |Image$$RW$$Base| ;// Base of RAM to initialise IMPORT |Image$$ZI$$Base| ;// Base and limit of area IMPORT |Image$$ZI$$Limit| ;// to zero initialise Static data dynamic data Zero initial data code RO region RW region Image.rom ZI region Stack region 0x00 RO Limit RW Base STACK_BASE

13 13 EXT I/O Bank #0 EXT I/O Bank #1 EXT I/O Bank #2 EXT I/O Bank #3 EXT I/O Bank #4 EXT I/O Bank #5 EXT I/O Bank #6 EXT I/O Bank #7 Reserved SDRAM #0 Reserved SDRAM #1 Reserved Internal Register 0x00000000 0x08000000 0x40000000 0x48000000 0x80000000 0x81000000 0x82000000 0x83000000 0x84000000 0x85000000 0x86000000 0x87000000 0x88000000 0xF0000000 0xFFFFFFFF After remap, the memory map Exception Handler Vector Table Code Area RW data ZERO initial data STACK area User area 0x00000000 Flash 0x01000000 RO data 0x80000000 0x80200000 DSP 0x84000000 0x84004000 ﹜ 18KBytes

14 14 Memory Map change process

15 15 7.Set interrupt stack pointer #2/5 Undefined Abort Supervisor IRQ FIQ USR  After initializing stacks, the memory map will be as following.  You can set stack size of each mode at init_gun.h file. That will describe letter. SDRAM

16 16 What does the bootloader do before entering C code.  The part of bootloader before entering C code is written in ARM assembly code. Its main purpose is to initialize the target system and prepare the environment for C language. 1.Stop all Interrupts : To prevent from interrupt before completing initial process. 2.Initial memory, which includes enable memory banks, initializing memory configuration registers, and so on. 3.Disable instruction / data caches. 4.Copy RO_RW section to SDRAM (according to CPU). 5.Clear ZI section. 6.Memory banks Remap (according to CPU). 7.Set interrupt stack pointer : prepare for executing C code. 8.Branch to the entry point of C code.

17 17 Bootloader assembly code  We take the bootloader example on target system that use S3C2500 CPU.  The target system have 2MB Flash and 16MB SDRAM.  The complete bootloader source example is at the attached file.

18 18 Branch to the entry point of C code.  Now, we can branch to C code. And use C language to achieve powerful function of bootloader and load OS kernel. IMPORT C_Entry B C_Entry ; "System Start !"


Download ppt "Chap. 4 ARM Boot Loader Internals. 2 S3C2500 ARM940T Core module ARM9TDMI CoreIC."

Similar presentations


Ads by Google