[U-Boot] [PATCH] arm relocation: Fix calculation of board_init_r

Albert ARIBAUD albert.aribaud at free.fr
Sat Feb 5 08:53:15 CET 2011


Hi Alexander,

Le 03/02/2011 21:52, Alexander Stein a écrit :
> Signed-off-by: Alexander Stein<alexander.stein at informatik.tu-chemnitz.de>
> ---
> Hello,
>
> I just played a bit with my at91sam9g20ek and tried using a new u-boot.
> So I compiled 656b990daa84bfdd512407ee2e3d2610e305a455 (atmel/wip110202) load
> it into memory using jtag to 0x22000000 while it was linked to 0x20000000.

Side note: loading and starting U-Boot at an address different from the 
one which it was linked for is not currently supported.

> I stepped through the relocation code and at start.S:291 'mov pc, lr' the pc
> gets an invalid address (0x25F81D70 while memory ends at 0x24000000).
> While stepping to start.S:286 some registers have the following contents:
> r0: 00000d70
> r1: 22000000
> r9: 03f81000
> lr: 22000d70
> The content if r0 seems ok, but r1 seems wrong, it should be 0x20000000.
> Indeed r1 should contain the linked address of _start not the address
> relative from the current code.

Correct, since we're trying to find the post-relocation address of 
board_init_r, we should add the relocation offet to its link-time 
address, not run-time address -- the fact that both are the same right 
now is only incidental. Thus:

Applied to u-boot-arm, thanks.

Amicalement,
-- 
Albert.


More information about the U-Boot mailing list