[U-Boot] {Spam?} u-boot relocation

Reinhard Meyer u-boot at emk-elektronik.de
Sun Dec 26 14:38:04 CET 2010


Dear Marcel,
> Hi,
>
> I updated my u-boot-usb to continue my work on the SAM9 USB parts, but got
> stuck with the following issue :
>
> There seems to be a new relocation scheme. I also added some stuff to make it
> detect the SDRAM, but than I get stuck.
>
>   int dram_init(void)
> {
>          gd->bd->bi_dram[0].start = PHYS_SDRAM;
>          gd->bd->bi_dram[0].size = PHYS_SDRAM_SIZE;
This is accessing bss before relocation. BSS does not exist then.
>          /* dram_init must store complete ramsize in gd->ram_size */
>          gd->ram_size = get_ram_size((volatile void *)PHYS_SDRAM,
> PHYS_SDRAM_SIZE);
>          dram_init_banksize();
This function, if defined, is called automagically. Normally, with single
DRAM bank AT91SAM9 designs the default weak function provided by u-boot is
sufficient:
void __dram_init_banksize(void)
{
	gd->bd->bi_dram[0].start = CONFIG_SYS_SDRAM_BASE;
	gd->bd->bi_dram[0].size =  gd->ram_size;
}
void dram_init_banksize(void)
	__attribute__((weak, alias("__dram_init_banksize")));

Don't define this function in your board file!!!
>          return 0;
> }
Please have a look at the emk/top9000 board for what is needed:

int dram_init(void)
{
	gd->ram_size = get_ram_size(
		(void *)CONFIG_SYS_SDRAM_BASE,
		CONFIG_SYS_SDRAM_SIZE);
	return 0;
}

/* NO dram_init_banksize() !!! */

Note also that the defines have changed to have a CONFIG_SYS_ prefix.
Change your board definition accordingly.

Best Regards,
Reinhard


More information about the U-Boot mailing list