[U-Boot] A question in lowlevel_init.S

Reinhard Meyer u-boot at emk-elektronik.de
Sat Jan 22 08:39:38 CET 2011


Dear Albert ARIBAUD,
> Hi Vamsi,
>
> Le 22/01/2011 05:18, krrish53 a écrit :
>>
>> Hello everybody,
>> I have a question pertaining to almost every lowlevel_init.S. The code goes
>> like
>>
>> /*make r0 relative the current location so that it*/
>> /*reads SMRDATA out of flash rather than memory*/
>> ldr r0,=SMRDATA
>> ldr r1,_TEXT_BASE
>> sub r10,r0,r1
>>
>> I couldn't relate the code to comments made ahead of that(how does TEXT_BASE
>> - addrof(SMRDATA) yield the location of SMRDATA in flash. I totally dint get
>> it.  Please enlighten me. I  greatly appreciate any response.
>
> It would be easier if you gave the precise source code origin, filename
> and location of the code you're mentioning. I took the u-boot-arm
> current master branch, and could not exactly find any occurrence of "sub
> r10, r0, r1" so I looked for an appraoching sequence, and found e.g.
> arch/arm/cpu/arm926ejs/at91/lowlevel_init.S, line 63. Is this what you
> meant?
>
> 	/* memory control configuration */
> 	/* this isn't very elegant, but	 what the heck */
> 	ldr	r0, =SMRDATA
> 	ldr	r1, _MTEXT_BASE
> 	sub	r0, r0, r1
> 	add	r2, r0, #80
>
> If so, the code does not compute TEXT_BASE - SMRDATA, rather the reverse
> : SMRDATA - TEXT_BASE, .i.e. the relative address of SMRDATA with
> respect to the image start (depending on START_FROM_MEM, in Flash or
> physical RAM). I assume #80 is an absolute base address of the actual
> SMRDATA, but I'm no at91 specialist.

I am not aware of any AT91SAM9xxx systems right now that uses low-level init, it
would only make sense for those that boot directly from NOR, without
AT91BOOTSTRAP involved.
Since we also have no NAND_SPL for AT91, it might well be that only AT91RM9200
systems use low level init code...

To clarify, AT91BOOTSTRAP is the first code loaded by the SoC ROM into internal
SRAM and therefore restricted in size to only 4k for some AT91 SoCs. This code
has to init the SDRAM and load u-boot into SDRAM (hence the relocation stuff
was not really needed for AT91).

Best Regards,
Reinhard

Best Regards,
Reinhard


More information about the U-Boot mailing list