Hi Albert, On 20.06.2013 18:42, Albert ARIBAUD wrote: >> diff --git a/arch/arm/lib/crt0.S b/arch/arm/lib/crt0.S >> index a9657d1..b05f66a 100644 >> --- a/arch/arm/lib/crt0.S >> +++ b/arch/arm/lib/crt0.S >> @@ -85,7 +85,13 @@ ENTRY(_main) >> bic sp, sp, #7 /* 8-byte alignment for ABI compliance */ >> sub sp, #GD_SIZE /* allocate one GD above SP */ >> bic sp, sp, #7 /* 8-byte alignment for ABI compliance */ >> +#if !defined(CONFIG_SPL_BUILD) >> +/* >> + * SPL already has GD set to the correct location (in s_init), we mustn't >> + * move it around now since some data (clocks etc) is already present. >> + */ >> mov r8, sp /* GD is above SP */ >> +#endif >> mov r0, #0 >> bl board_init_f >> > > NAK in this form. I don't want gd to be set "somewhere in the code" > depending on the actual target; I want it set in crt0.S, period. > > I see there are several locations in ARM architecture or board code > which set up GD themselves in the same manner as OMAP does. Luckily all > these locations set it to the same value, the address of gdata. > > The correct fix (read: the one I won't NAK) is thus to add a #else > clause in the code above, in which r8 will be set to =gdata, and to > remove the corresponding assignments in the various places where they > reside.
Here's the problem. Setting r8 in _main is too late. As it has already been used (in the current implementation) to store some data (e.g. clocks for baudrate generation etc). Here the code from arch/arm/cpu/armv7/omap3/board.c:s_init(): #ifdef CONFIG_SPL_BUILD gd = &gdata; preloader_console_init(); timer_init(); #endif Note that this is done *before* _main() is called (we are talking about SPL for OMAP here). And it did cost me quite some time to find this problem, that r8 was re-configured in _main() and all the already set values disappeared again (no serial output etc). Yes, this needs some cleanup/fixup. Unfortunately I won't find the time to look into such a cleanup in the next days. Perhaps somebody else might jump in... Thanks, Stefan _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot