[U-Boot] Trying to understand ARM926EJS/start.S

Albert ARIBAUD
2010-10-30T21:56:42Z

Le 30/10/2010 21:21, Wolfgang Denk a ?crit :
> Dear Albert ARIBAUD,
>
> In message<4CCC69E4.8090103@free.fr> you wrote:
>>
>>> ldr r0, _TEXT_BASE /* r0<- Text base */
>>> %%% why are we using _TEXT_BASE here and not _start?
>>
>> Because we're accessing the relocation tables in the FLASH (or freshly
>> NAND-loaded) "source" copy of u-boot, not in the RAM "target" copy (in
>> which the relocation tables won't exist).
>
> Sorry, but I don't understand this explanation.
>
> With the linker script we make sure that the symbol _start gets linked
> to the absolute address CONFIG_SYS_TEXT_BASE, right? And _TEXT_BASE
> is a storage that holds exactly the value CONFIG_SYS_TEXT_BASE, which
> should be identical to the address of _start ?

Somehow I thought the question was "why use the source location rather
than the target".

Yes, if we're still running from the "source" address at that point, the
value of _start and the content of _TEXT_BASE should be the same -- that
does change once we start the fixup loop, though; after the loop is
done, I think "adr r0, _start" will still give us the source start
address but _TEXT_BASE will contain the target start address -- though
at this time of the evening I'd want to be careful about that.

Tomorrow morning I'll run a step-by-step case on my ED Mini V2 and on my
OpenRD and see if / where we can use "adr rX, _start".

> Best regards,
>
> Wolfgang Denk

Amicalement,
--
Albert.