Uboot Transplant (vi)--uboot launch Phase II (init_sequence)

Source: Internet
Author: User

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

init_fnc_t **init_fnc_ptr through the preceding definition; you know init_sequence is a function pointer array is stored in the function name, these functions are board-level initialization function, *init_fnc_ptr dereference is a function pointer, the purpose of this for loop is to go through the function pointer array, The purpose of the traversal is to execute the function inside the function pointer array to initialize the part of the Development Board's peripherals. Jump out of this for loop when traversing to the last element null.

init_fnc_t *init_sequence[] = {    cpu_init,         /* basic cpu dependent setup */#if  defined (CONFIG_SKIP_ Relocate_uboot)     reloc_init,        /* set  the relocation done flag, must                    do this after cpu_init (),  but  as soon                    as possible */#endif     board_init,         /* basic board dependent setup */     interrupt_init,        /* set up exceptions  */    env_init,        /* initialize environment */     init_baudrate,        /* initialze baudrate  settings */    serial_init,        /*  serial communications setup */    console_init_f,         /* stage 1 init of console */     display_banner,        /* say that we are  here */#if  defined (config_display_cpuinfo)     print_cpuinfo,         /* display cpu info  (and speed)  */#endif # if  defined (Config_display_boardinfo)     checkboard,         /* display board info */#endif #if defined (CONFIG_HARD_I2C)  | |  defined (CONFIG_SOFT_I2C)     init_func_i2c, #endif     dram_init,         /* configure available ram banks */     display_dram_config,    NULL,};

(1) CPU_INIT:CPU internal initialization, the actual function is an empty function

(2) Board_init: Initialize NIC and DDR

(3) Interrupt_init: Initialize timer 4 (used for timing such as BootDelay), here set the 10ms time

(4) Env_init: Environment variable setting

(5) Init_baudrate: Initialize baud rate

(6) Serial_init: Serial port initialization (serial port in the first phase of Uboot start has been completed), here actually nothing to do

(6) The first stage of Console_init_f console initialization (in fact we do not use the console)

(7) Display_banner: Print Uboot version information

(8) Print_cpuinf: Initialize Clock

(9) Checkboard: Print clock information

(INIT_FUNC_I2C): There is no use of i²c equipment, so there is no practical effect

(one) assignment of the global variables in the DDR configuration section of the DRAM_INIT:GD->BD (size start address, etc.)

(display_dram_config): Print DDR configuration information

NULL: Used to jump out of a for loop.


These are the main things Uboot did in the second phase.

Env_relocate ();

Relocation of environment variables, reading environment variables from SD card into DDR

It is important to note that there is no environment variable at the beginning of the SD card, Uboot the first time the environment variable is a hard-coded set of environment variables in the configuration header file in Uboot (such as x210sd.h), the environment variable is written to the SD card raw partition when I start the uboot using the Saveen command. This environment variable is also used in the SD card later on.


Uboot start the second phase of the end is to enter a dead loop, input command parsing command

for (;;)    {Main_loop (); }

The Main_loop function executes once to represent the input parsing and execution of a command. The kernel startup phase also starts with this function.












Uboot Transplant (vi)--uboot launch Phase II (init_sequence)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.