U-boot Start Output Information analysis--based on tiny6410

Source: Internet
Author: User

CPU: [Email protected]
FCLK = 532MHz, hclk = 133MHz, Pclk = 66MHz, Serial = Clkuart (SYNC Mode)
board:mini6410
dram:256 MB
flash:0 KB
nand:2048 MB
In:serial
Out:serial
Err:serial
Mac:08:90:90:90:90:90
The output information of the following code can be found in the
1. Initialize the hardware device to be used at this stage
2. Detection System memory Mapping
3. Read the kernel image and root file system image from Flash to ram space
4. Set startup parameters for the kernel
5. Call the kernel
The file ARCH/ARM/LIB/BOARD.C defines the relevant output function:
/************************************************************************
* Init utilities*
************************************************************************
* Some of this code should is moved into the core functions,
* or dropped completely,
* But let ' s get it Working (again) first.
*. Initialize the serial port and set the baud rate so that you can interact with the Uboot
*/
static int init_baudrate (void)
{
Char tmp[64];/* long enough for environment variables */
int i = getenv_r ("baudrate", TMP, sizeof (TMP));
Gd->bd->bi_baudrate = Gd->baudrate = (i > 0)
? (int) Simple_strtoul (tmp, NULL, 10)
: Config_baudrate;

return (0);
}

static int Display_banner (void)
{
printf ("\n\n%s\n\n", version_string);
Debug ("U-boot Code:%08LX,%08LX BSS:--%08lx\n",
_armboot_start, _bss_start, _bss_end);
#ifdef config_memory_upper_code/* by Scsuh */
Debug ("\t\bmalloc and Stack is above the U-boot code.\n");
#else
Debug ("\t\bmalloc and Stack is below the U-boot code.\n");
#endif
#ifdef Config_modem_support
Debug ("Modem support enabled\n");
#endif
#ifdef CONFIG_USE_IRQ
Debug ("IRQ Stack:%08lx\n", Irq_stack_start);
Debug ("FIQ Stack:%08lx\n", Fiq_stack_start);
#endif

return (0);
}

/*
* Warning:this code looks "cleaner" than the PowerPC version, but
* Has the disadvantage so either get nothing, or everything.
* On PowerPC, your might see "DRAM:" Before the system Hangs-which
* Gives a simple yet clear indication which part of the
* initialization if failing.
*/
static int display_dram_config (void)
{
int i;
ULONG size = 0;
/* Only one piece of DDR RAM, size 256m*/
for (i=0; i<config_nr_dram_banks; i++) {
Size + = gd->bd->bi_dram[i].size;
}

Puts ("DRAM:");
Print_size (size, "\ n");
return (0);
}

#ifndef Cfg_no_flash
static void Display_flash_config (ULONG size)
{
Puts ("Flash:");
Print_size (size, "\ n");
}
#endif/* Cfg_no_flash */


typedef int (init_fnc_t) (void);

int print_cpuinfo (void);/* test-only */
/* Here is a series of initializations, all placed in a block */
init_fnc_t *init_sequence[] = {
cpu_init,/* Basic CPU Dependent Setup */
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 is here */
#i F defined (config_display_cpuinfo)
print_cpuinfo,/* DISPLAY CPU info (and speed) */
#endif
#if defined (config_ Display_boardinfo)
checkboard,/* Display Board info */
#endif
dram_init,/* Configure available RAM banks */
Display_dram_config,
NULL,
};
U-boot start the second stage of the program entry
void Start_armboot (void)
{
init_fnc_t **init_fnc_ptr;
Char *s;
#ifndef cfg_no_flash
ulong size;
#endif

#if defined (config_vfd) | | Defined (CONFIG_LCD)
unsigned long addr;
#endif

#if defined (Config_boot_movinand)
UINT *magic = (UINT *) (phys_sdram_1);
#endif

/* Pointer is writable since we allocated a register for it */
#ifdef config_memory_upper_code/* by Scsuh */
ULONG Gd_base;

Gd_base = Cfg_uboot_base + cfg_uboot_size-cfg_malloc_len-cfg_stack_size-sizeof (gd_t);
#ifdef CONFIG_USE_IRQ
Gd_base-= (Config_stacksize_irq+config_stacksize_fiq);
#endif
GD = (gd_t*) gd_base;
#else
GD = (gd_t*) (_armboot_start-cfg_malloc_len-sizeof (gd_t));
#endif

/* Compiler optimization barrier needed for GCC >= 3.4 */
__asm__ __volatile__ (""::: "Memory");

memset ((void*) GD, 0, sizeof (gd_t));
GD->BD = (bd_t*) ((char*) gd-sizeof (bd_t));
memset (gd->bd, 0, sizeof (bd_t));

Monitor_flash_len = _bss_start-_armboot_start;

for (init_fnc_ptr = init_sequence; *init_fnc_ptr; ++init_fnc_ptr) {
if ((*INIT_FNC_PTR) ()! = 0) {/* invokes each of the initializer functions in the list */
Hang ();/* If there is an error, press the Reset key */
}
}

#ifndef Cfg_no_flash
/* Configure available FLASH banks */
Size = Flash_init ();
Display_flash_config (size);
#endif/* Cfg_no_flash */

/* Armboot_start is defined in the BOARD-SPECIFIC linker script */
#ifdef config_memory_upper_code/* by Scsuh */
Mem_malloc_init (cfg_uboot_base + cfg_uboot_size-cfg_malloc_len-cfg_stack_size);
#else
Mem_malloc_init (_armboot_start-cfg_malloc_len);
#endif

#if defined (config_smdk6400) | | Defined (config_smdk6410) | | Defined (config_smdk6430) | | Defined (config_smdk2450) | | Defined (config_smdk2416) | | \
Defined (config_mini6410)

#if defined (Config_nand)
Puts ("NAND:");
Nand_init ();/* Go init the NAND */
Nand_init ();
#endif

#if defined (Config_onenand)
Puts ("Onenand:");
Onenand_init ();/* Go init the One-nand * *
#endif

#if defined (Config_boot_movinand)
Puts ("MMC:");

if ((0x24564236 = = Magic[0]) && (0x20764316 = = Magic[1])) {
printf ("Boot Up for burning\n");
} else {
Movi_set_capacity ();
Movi_set_ofs (MOVI_TOTAL_BLKCNT);
Movi_init ();
}
#endif

#else

#if (Config_commands & Cfg_cmd_nand)
Puts ("NAND:");
Nand_init ();/* Go init the NAND */
#endif

#endif

#ifdef Config_has_dataflash
At91f_dataflashinit ();
Dataflash_print_info ();
#endif

/* Initialize Environment */
Env_relocate ();

#ifdef CONFIG_VFD
/* Must do this after the framebuffer is allocated */
Drv_vfd_init ();
#endif/* CONFIG_VFD */

/* IP Address */
GD->BD->BI_IP_ADDR = getenv_ipaddr ("ipaddr");

/* MAC Address */
{
int i;
ULONG Reg;
Char *s, *e;
Char 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)? E + 1:e;
}

#ifdef CONFIG_HAS_ETH1
i = Getenv_r ("Eth1addr", TMP, sizeof (TMP));
s = (i > 0)? Tmp:null;

for (reg = 0; reg < 6; ++reg) {
Gd->bd->bi_enet1addr[reg] = s? Simple_strtoul (S, &e, 16): 0;
if (s)
s = (*e)? E + 1:e;
}
#endif
}

Devices_init ();/* Get the devices list going. */

#ifdef CONFIG_CMC_PU2
Load_sernum_ethaddr ();
#endif/* CONFIG_CMC_PU2 */

Jumptable_init ();

Console_init_r ();/* Fully init console as a device */

#if defined (config_misc_init_r)
/* Miscellaneous Platform Dependent initialisations */
Misc_init_r ();
#endif

/* Enable exceptions */
Enable_interrupts ();

/* Perform network card initialisation if necessary */
#if defined (config_driver_dm9000) && defined (config_driver_dm9000_no_eeprom)
extern int Eth_set_mac (BD_T * BD);
if (getenv ("ethaddr")) {
Eth_set_mac (GD->BD);
}
#endif

#ifdef config_driver_cs8900
CS8900_GET_ENETADDR (GD->BD->BI_ENETADDR);
#endif

#if defined (config_driver_smc91111) | | Defined (config_driver_lan91c96)
if (getenv ("ethaddr")) {
SMC_SET_MAC_ADDR (GD->BD->BI_ENETADDR);
}
#endif/* config_driver_smc91111 | | CONFIG_DRIVER_LAN91C96 * *

/* Initialize from Environment */
if ((s = getenv ("loadaddr"))! = NULL) {
LOAD_ADDR = Simple_strtoul (S, NULL, 16);
}
#if (Config_commands & Cfg_cmd_net)
if ((s = getenv ("Bootfile"))! = NULL) {
Copy_filename (Bootfile, S, sizeof (Bootfile));
}
#endif/* cfg_cmd_net */

#ifdef Board_late_init
Board_late_init ();
#endif
#if (Config_commands & Cfg_cmd_net)
#if defined (CONFIG_NET_MULTI)
Puts ("Net:");
#endif
Eth_initialize (GD->BD);
#endif
/* Main_loop () can return to retry autoboot, if so just run it again. */
for (;;) {
Main_loop (); /* Enter the next stage of the Main_loop * *
}

/* Notreached-no-out-of-command loop except booting */
}

U-boot Start Output Information analysis--based on tiny6410

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.