[U-Boot] ARM relocation, probably trivial mistake

Wolfgang Denk
2010-10-01T07:51:31Z

Dear Heiko Schocher,

In message <4CA57762.3000201@denx.de> you wrote:
>
> 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 we have to be careful here.

Please keep in mind that the with the new setup the relocation address
is not a constant, not even for systems that come with a fixed memroy
configuration.

If you enable for example the protected RAM feature, the relocation
address will be shifted down by the amount needed for the reserved
PRAM area - which is variable, as it can be set through an
environment variable.

So assume you have a system with a preloader, and you optimize your
configuration to load U-Bot to the "final" position close to the end
of the RAM. Not the user defines "setenv pram 128" and reboots.
Now U-Boot will try to relocate itself 128 kB down, which pretty
reliably causes an overlap.

Eventually we have to detect such situations and relocate twice then?

Best regards,

Wolfgang Denk

--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
The shortest unit of time in the multiverse is the News York Second,
defined as the period of time between the traffic lights turning
green and the cab behind you honking.
- Terry Pratchett, _Lords and Ladies_