[U-Boot-Users] Cmdtp falling out of RAM bounds

Jeff Mann MannJ at embeddedplanet.com
Mon Jun 26 18:07:38 CEST 2006



I appologize for the lack of subject on the last one. 

Subject: 

I am having a problem in board.c. I realize the problem is probobly a
configuration error, and would appreciate help from those most
experienced in identifying the cause. 

I am having a problem in board_init(...) in ./lib_ppc/board.c (see
except below). The problem seems to be the result of incorrect
__u_boot_cmd_start and __u_boot_cmd_end values. You see,
__u_boot_cmd_end - __u_boot_cmd_start = 0xFF01C118-0xFFff01B838 = 0x8E0
= 2272. 

[cmdtp++] is preforming [cmdtp = cmdtp + 24] (as you know, cmdtp is a
pointer of type cmd_tbl_t). However, 2272 is not divisible by 24. Thus
in "for (cmdtp = &__u_boot_cmd_start; cmdtp !=  &__u_boot_cmd_end;
cmdtp++)," [cmdtp !=  &__u_boot_cmd_end] will always be true; cmdtp will
never equal &__u_boot_cmd_end. So, &__u_boot_cmd_end is jumped over and
cmdtp continues until it exceeds the DRAM boundary (64MB or 0x03FFFFFF)
and results in an error

U-boot is runing from RAM at this point. It had been coppied to
0x03FDF000. so __u_boot_cmd_end actually = 0x03FFb118 and
__u_boot_cmd_start actually = 0x03FFa838. 

Thanks for your help,
JM

    ./lib_ppc/board.c

    IN: void board_init_r(...)

 629         /*
 630          * We have to relocate the command table manually
 631          */
 632         for (cmdtp = &__u_boot_cmd_start; cmdtp !=
&__u_boot_cmd_end; cmdtp++) {
 633                 ulong addr;
 634                 addr = (ulong) (cmdtp->cmd) + gd->reloc_off;
 635 #if 0
 636                 printf ("Command \"%s\": 0x%08lx => 0x%08lx\n",
 637                                 cmdtp->name, (ulong) (cmdtp->cmd),
addr);
 638 #endif
 639                 cmdtp->cmd =
 640                         (int (*)(struct cmd_tbl_s *, int, int, char
*[]))addr;
 641 
 642                 addr = (ulong)(cmdtp->name) + gd->reloc_off;
 643                 cmdtp->name = (char *)addr;
 644 
 645                 if (cmdtp->usage) {
 646                         addr = (ulong)(cmdtp->usage) +
gd->reloc_off;
 647                         cmdtp->usage = (char *)addr;
 648                 }
 649 #ifdef  CFG_LONGHELP
 650                 if (cmdtp->help) {
 651                         addr = (ulong)(cmdtp->help) +
gd->reloc_off;
 652                         cmdtp->help = (char *)addr;
 653                 }
 654 #endif
 655         }

MAP
...
ff01b838 A __u_boot_cmd_start
...
ff01bd40 D __u_boot_cmd_autoscr
ff01bd58 D __u_boot_cmd_bdinfo
ff01bd70 D __u_boot_cmd_reset
ff01bd88 D __u_boot_cmd_go
ff01bda0 D __u_boot_cmd_imls
ff01bdb8 D __u_boot_cmd_iminfo
ff01bdd0 D __u_boot_cmd_bootd
ff01bde8 D __u_boot_cmd_boot
ff01be00 D __u_boot_cmd_bootm
ff01be18 D __u_boot_cmd_coninfo
ff01be30 D __u_boot_cmd_bootvx
ff01be48 D __u_boot_cmd_bootelf
ff01be60 D __u_boot_cmd_protect
ff01be78 D __u_boot_cmd_erase
ff01be90 D __u_boot_cmd_flinfo
ff01bea8 D __u_boot_cmd_itest
ff01bec0 D __u_boot_cmd_loadb
ff01bed8 D __u_boot_cmd_loads
ff01bef0 D __u_boot_cmd_mtest
ff01bf08 D __u_boot_cmd_loop
ff01bf20 D __u_boot_cmd_base
ff01bf38 D __u_boot_cmd_crc32
ff01bf50 D __u_boot_cmd_cmp
ff01bf68 D __u_boot_cmd_cp
ff01bf80 D __u_boot_cmd_mw
ff01bf98 D __u_boot_cmd_nm
ff01bfb0 D __u_boot_cmd_mm
ff01bfc8 D __u_boot_cmd_md
ff01bfe0 D __u_boot_cmd_sleep
ff01bff8 D __u_boot_cmd_nfs
ff01c010 D __u_boot_cmd_rarpboot
ff01c028 D __u_boot_cmd_tftpboot
ff01c040 D __u_boot_cmd_bootp
ff01c058 D __u_boot_cmd_run
ff01c070 D __u_boot_cmd_saveenv
ff01c088 D __u_boot_cmd_setenv
ff01c0a0 D __u_boot_cmd_printenv
ff01c0b8 D __u_boot_cmd_question_mark
ff01c0d0 D __u_boot_cmd_help
ff01c0e8 D __u_boot_cmd_echo
ff01c100 D __u_boot_cmd_version
ff01c118 A __start___ex_table
ff01c118 A __stop___ex_table
ff01c118 A __u_boot_cmd_end
...





More information about the U-Boot mailing list