[U-Boot] ARM relocation, probably trivial mistake

Heiko Schocher
2010-10-01T06:57:41Z

Hello Reinhard,

Reinhard Meyer wrote:
> Dear Heiko Schocher,
>
>>>>> In message<4CA4AEFF.3050101@denx.de> you wrote:
>>>>>> If TEXT_BASE == relocation address it could be defined,
>>>>>> never tested.
>
> If I think right, relocation address would vary with u-boot size,
> so there seems no really reliable way to ensure above "if" is true.
> Even worse, when it happens to become untrue because the size
> changed, it will try to relocate overlapping areas.

Yes, true, but you can with each release try your u-boot, and
eventually fix it ...

>>> 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.
>
> "intended location" == "relocation address based on ram size" ??

admitted, just a good idea for boards where ramsize is always fix ...

>> If u-boot starts in RAM, then it is the task from the preloader
>> where it copies u-boot code, and if there is somewhere in IRAM
>> enough room for it, this would be an option. Otherwise it is a
>> problem if relocation results in overlapping source and destination
>> areas ... but you will fast detect this problem, when you see,
>> that u-boot no longer works ;-)
>
> I think it would be safe that a preloader loads u-boot to the very
> bottom of SDRAM. If the SDRAM is not at least double the size of
> u-boot, u-boot needs a diet ;)

Yep. Idea behind my "intended location == relocation address" is
to save one copy of u-boot (one from the preloader and one from
relocation) ... but this is not a need for all boards, this is
something a board maintainer can decide and use (for example, if
speed is a critical point) ...

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