[U-Boot] ARM relocation, probably trivial mistake

Heiko Schocher
2010-09-30T15:38:39Z

Hello Reinhard,

Reinhard Meyer wrote:
> Hello,
>
> after enabling relocation I get the following output:
>
> U-Boot 2010.09-00106-g6e135b9-dirty (Sep 30 2010 - 16:57:43)
>
> U-Boot code: 21F00000 -> 21F3C140 BSS: -> 21F7D700
> CPU: AT91SAM9XE
> Crystal frequency: 18.432 MHz
> CPU clock : 198.656 MHz
> Master clock : 99.328 MHz
> I2C: ready
> monitor len: 0007D700 <<<< this must be wrong, the binary is short of 256k large
> ramsize: 04000000 <<<< correct
> Top of RAM usable for U-Boot at: 24000000 <<<< correct
> Reserving 501k for U-Boot at: 23f82000
> Reserving 143k for malloc() at: 23f5e100
> Reserving 24 Bytes for Board Info at: 23f5e0e8
> Reserving 88 Bytes for Global Data at: 23f5e090
> New Stack Pointer is: 23f5e088
> RAM Configuration:
> Bank #0: 20000000 64 MiB <<< correct
> relocation Offset is: 02082000 <<<< could be right
>
> <<< system hangs here >>>
>
> Details: initial bootstrap loads u-boot to RAM at 21f00000
> (1MiB short of 32 MiB which is the minimum RAM populated)
>
> I have set the following values:
> #define CONFIG_SKIP_LOWLEVEL_INIT
> #define CONFIG_SKIP_RELOCATE_UBOOT

With this, your TEXT_BASE must be == relocation address,
Probably this is not the case ...

> /*#define CONFIG_SYS_ARM_WITHOUT_RELOC*/
> #define CONFIG_SYS_NO_ICACHE
> #define CONFIG_SYS_NO_DCACHE
>
> and
>
> /* SDRAM: min 32, upto 128 MB */
> #define CONFIG_NR_DRAM_BANKS 1
> #define PHYS_SDRAM 0x20000000
> #define PHYS_SDRAM_MAX_SIZE 0x08000000
> #define CONFIG_SYS_MEMTEST_START PHYS_SDRAM
> #define CONFIG_SYS_MEMTEST_END 0x21e00000
> #define CONFIG_SYS_LOAD_ADDR (PHYS_SDRAM+0x01000000) /* 16 MB into RAM */
> #define CONFIG_SYS_SDRAM_BASE PHYS_SDRAM
> #define CONFIG_SYS_INIT_SP_ADDR (CONFIG_SYS_SDRAM_BASE + 0x1000 - CONFIG_SYS_GBL_DATA_SIZE)
>
> and in config.mk:
>
> TEXT_BASE = 0x21f00000
>
> and
>
> int dram_init(void)
> {
> gd->ram_size =
> get_ram_size((void*)PHYS_SDRAM, PHYS_SDRAM_MAX_SIZE);
> return 0;
> }
>
> void dram_init_banksize(void)
> {
> gd->bd->bi_dram[0].start = PHYS_SDRAM;
> gd->bd->bi_dram[0].size =
> get_ram_size((void*)PHYS_SDRAM, PHYS_SDRAM_MAX_SIZE);
> }

This function is not necessary, because it is equal to the
default in arch/arm/lib/board.c

> I do probably have a simple misunderstanding of the concept.
>
> 1. should CONFIG_SKIP_RELOCATE_UBOOT be not defined anymore?

If TEXT_BASE == relocation address it could be defined,
never tested.

> 2. TEXT_BASE must be the address where the u-boot is loaded
> by 1st loader and startet, right?

Yep.

bye,
Heiko
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany