1 / 18

Chap. 4

Chap. 4. ARM Boot Loader Internals. S3C2500. S3C2500. ARM940T. ARM9TDMI. IC. Core module. Core. S3C2500B Block Diagram. ARM940T Block Diagram. Introduction What does the bootloader do before entering C code. Bootloader assembly code. Introduction #1/2.

uma-hodges
Download Presentation

Chap. 4

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Chap. 4 ARM Boot Loader Internals

  2. S3C2500 S3C2500 ARM940T ARM9TDMI IC Core module Core

  3. S3C2500B Block Diagram

  4. ARM940T Block Diagram

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

  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. Introduction #2/2 • A more friendly and powerful bootloadercan 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. Boot Init Flow 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 Exception Vector Table 0x00000000 B Reset_Handle 0x0000001C • Init the consol UART • Init the Ethernet • Load the program file • from the tftp server • to the 0x200000 Hardware Environment configuration • Stack Intialize • Initial variable depend on • develop environment • copy the static data • IRQ disable • Call C function call • execute the loader

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

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

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

  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 0x00 code RO region Static data RO Limit Image.rom RW Base dynamic data Zero initial data RW region ZI region STACK_BASE Stack region

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

  14. Memory Map change process

  15. 7.Set interrupt stack pointer #2/5 • 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. Undefined Abort Supervisor IRQ FIQ USR SDRAM

  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. • Stop all Interrupts : To prevent from interrupt before completing initial process. • Initial memory, which includes enable memory banks, initializing memory configuration registers, and so on. • Disable instruction / data caches. • Copy RO_RW section to SDRAM (according to CPU). • Clear ZI section. • Memory banks Remap (according to CPU). • Set interrupt stack pointer : prepare for executing C code. • Branch to the entry point of C code.

  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. 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 !"

More Related