[U-Boot] RFC: Aligning arch initialisation sequences

Wolfgang Denk wd at denx.de
Sat Nov 13 22:53:02 CET 2010


Dear Reinhard Meyer,

In message <4CDF04A8.4050802 at emk-elektronik.de> you wrote:
> 
> But whats left of my ideas is the following:
> 
> in asm: set stack to end of SRAM (or whatever)
> (board-config.h would not subtract GENERATED_GBL_DATA_SIZE
> anymore)
> 
> in c:
> board_early_init(void)
> {
> 	gd_t auto_gd;
> 	gd = &auto_gd;
> 
> That would rid us of all alignment concerns:
> Setting stack to end of initial storage will certainly
> be aligned, and the auto_gd will be aligned as the
> toolchain deems necessary.
> 
> We would not need GENERATED_GBL_DATA_SIZE anymore.
> 
> The auto_gd space on stack will be valid even into the call
> to relocate_code.

This has but on tiny shortcoming: we use GD to pass data around, for
example to pass clock frequencies determind before relocation to the
code running after relocation - which means that GD must be of a
statically allocated storage class.

Your stack variable above will go out of scope as soon as we leave the
board_early_init() function...

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
To know how another being, another creature feels -  that  is  impos-
sible.                  - Terry Pratchett, _The Dark Side of the Sun_


More information about the U-Boot mailing list