[U-Boot] ARM relocation, probably trivial mistake

Albert ARIBAUD
2010-10-01T05:40:56Z

Le 01/10/2010 07:25, Heiko Schocher a ?crit :
> Hello Wolfgang,
>
> Wolfgang Denk wrote:
>> Dear Heiko Schocher,
>>
>> In message<4CA4AEFF.3050101@denx.de> you wrote:
>>>> 1. should CONFIG_SKIP_RELOCATE_UBOOT be not defined anymore?
>>> If TEXT_BASE == relocation address it could be defined,
>>> never tested.
>>
>> We should point out that this is only intended (and allowed) for
>> boards where U-Boot gets loaded into RAM by some other means (like a
>> first stage boot loader, say when booting from NAND or SDCard).
>>
>> When booting from NOR or some other persistent memory TEXT_BASE will
>> point to that address range, and then it is obviously impossible to
>> use the same value as relocation address.
>
> Yes, you are right, that just work on boards, which use a preloader ...
>
> bye,
> Heiko

Actually CONFIG_SKIP_RELICATE_UBOOT should become unneeded once all
boards which use it are made to support relocation, as the code will
always check if it runs at its intended location and relocate only if
needed.

Of course, code which is loaded in RAM at a location different from its
intended one (e.g., during a debugging session) will relocate -- which
raises the interesting question of overlapping source and destination
areas. That might of course be completely solved, if there is room
enough in IRAM (or cache memory) by putting the relocating code there
alongside initial stack, jumping to it from FLASH, and having it jump
back to the RAM location of the rest of the code. But is it worth it?

Amicalement,
--
Albert.