UBOOT part of the C code

A series of initialization function call

Table 1 specifies the initial function:

init_fnc_t *init_sequence[] = {

cpu_init, / * cpu basic settings * /

board_init, / * initialize the basic development board * / interrupt_init, / * initialize interrupt * / env_init, / * initialize the environment variables * / init_baudrate, / * initialize the baud rate * / serial_init, / * initialize serial communication * / console_init_f, / * a first stage console initialization * / display_banner, / * where to notify have already run * / dram_init, / * formulated available memory area * / display_dram_config,

#if defined(CONFIG_VCMA9) || defined (CONFIG_CMC_PU2) checkboard,

 

#endif

 

};


 

NULL,

 

Initialization code executes the following functions:

for (init_fnc_ptr = init_sequence; *init_fnc_ptr; ++init_fnc_ptr) { if ((*init_fnc_ptr)() != 0) {

hang ();

}

}

 

2. Configure available Flash district

flash_init ()

 

3. Initialize the memory allocation functions

mem_malloc_init()

 

4. nand flash initialization

#if (CONFIG_COMMANDS & CFG_CMD_NAND) puts ("NAND:");

nand_init (); / * initialize NAND * / see Section 3.2.3 in Part VII point 3 nand_init () function.

 

5. initialize the environment variables

 

env_relocate ();

 

6. Peripherals initialization

devices_init()

 

7. I2C bus initialization i2c_init ();

 

  1. LCD initialization drv_lcd_init ();

 

  1. VIDEO initialization drv_video_init ();

 

10. Keyboard initialization drv_keyboard_init ();

 

11. The system initialization drv_system_init ();

 

 

Initialize the network equipment

Initialization related network equipment, fill in IP, MAC address and so on. 1. Set the IP address

/* IP Address */

gd->bd->bi_ip_addr = getenv_IPaddr ("ipaddr");

 

/* MAC Address */

{

int i; ulong reg;

char * s * e; flying tmp [64];

 

i = getenv_r ("ethaddr", tmp, sizeof (tmp)); s = (i > 0) ? tmp : NULL;

 

for (reg = 0; reg < 6; ++reg) {

gd->bd->bi_enetaddr[reg] = s ? simple_strtoul (s, &e, 16) : 0; if (s)

s = (* e)? and + 1: and;

}

}

 

Enter the main UBOOT command line

Entry command cycle (i.e., duty cycle of the entire boot), receiving a user command inputted from the serial port, then the corresponding work.

for (;;) {

main_loop (); /* 在 common/main.c */

}

 

Code Handling

In order to support NAND flash starter, S3C2410 built inside a 4k buffer SRAM "Steppingstone". When starting, NAND flash initial 4k bytes are read into the "Steppingstone" then starts executing boot code. Content is typically will boot code in the NAND flash copying SDRAM main code for execution.

The use of hardware ECC, the validity of the data in the NAND flash will be detected.

Features

  1. NAND flash mode: read / erase / programming NAND Flash

2. Automatic start mode: start code will be read into "Steppingstone", and then starts executing boot code at reset.

3. Hardware ECC detection module (hardware detection, software correction)

4. "Steppingstone" 4KB internal SRAM may alternatively be used after the starting.

Guess you like

Origin www.cnblogs.com/fanweisheng/p/11105628.html