[U-Boot-Users] can gd cause hang in board_init_r?

zhuzhenhua zzh.hust at gmail.com
Tue Nov 22 14:23:28 CET 2005


in board_init_r(lib_mips/board.c)

i add three serial out lines
       serial_puts("before gd\n");
      printf("gd =%x \n", gd);
serial_puts("after cmd relocate!\n");

sometimes, it only output first line,sometimes the first two lines,
sometimes the three lines are all outputed, are  these caused by gd
operation? or other reasons?

thanks for any hints

Regards
       zhuzhenhua




my board_init_r as follows

void board_init_r (gd_t *id, ulong dest_addr)
{
	DECLARE_GLOBAL_DATA_PTR;
	cmd_tbl_t *cmdtp;
	ulong size;
	extern void malloc_bin_reloc (void);
#ifndef CFG_ENV_IS_NOWHERE
	extern char * env_name_spec;
#endif
	char *s, *e;
	bd_t *bd;
	int i;

       serial_puts("before gd\n");
	gd = id;
      printf("gd =%x \n", gd);
	gd->flags |= GD_FLG_RELOC;	/* tell others: relocation done */

	//debug ("Now running in RAM - U-Boot at: %08lx\n", dest_addr);

	gd->reloc_off = dest_addr - CFG_MONITOR_BASE;

	monitor_flash_len = (ulong)&uboot_end_data - dest_addr;

	/*
	 * We have to relocate the command table manually
	 */
 	for (cmdtp = &__u_boot_cmd_start; cmdtp !=  &__u_boot_cmd_end; cmdtp++) {
		ulong addr;

		addr = (ulong) (cmdtp->cmd) + gd->reloc_off;
#if 0
		printf ("Command \"%s\": 0x%08lx => 0x%08lx\n",
				cmdtp->name, (ulong) (cmdtp->cmd), addr);
#endif
		cmdtp->cmd =
			(int (*)(struct cmd_tbl_s *, int, int, char *[]))addr;

		addr = (ulong)(cmdtp->name) + gd->reloc_off;
		cmdtp->name = (char *)addr;

		if (cmdtp->usage) {
			addr = (ulong)(cmdtp->usage) + gd->reloc_off;
			cmdtp->usage = (char *)addr;
		}
#ifdef	CFG_LONGHELP
		if (cmdtp->help) {
			addr = (ulong)(cmdtp->help) + gd->reloc_off;
			cmdtp->help = (char *)addr;
		}
#endif
	}

serial_puts("after cmd relocate!\n");

#if 0
...
#endif
while(1);
}




More information about the U-Boot mailing list