[U-Boot] Initializing global_data on SuperH before board_init_f() ?

Thomas Petazzoni thomas.petazzoni at free-electrons.com
Wed Aug 16 08:47:40 UTC 2017


On Wed, 16 Aug 2017 08:09:06 +0530, Lokesh Vutla wrote:

> > Should we put global_data within the .bss section, so that it gets
> > zero-initialized automatically? Should we zero-initialize it explicitly?  
> I am not sure how SuperH allocates the space for global data but
> typically the following two function takes care of allocating and
> zeroing global data(at least for arm):
> In file common/init/board_init.c
> board_init_f_alloc_reserve()
> board_init_f_init_reserve()
> May be, using these two functions might solve your problem.

Seems like a good idea indeed, I hadn't noticed those functions. If I
understand correctly, and after looking at how a few architectures do,

 - Initialize the stack pointer just below the U-Boot entry point

 - Call board_init_f_alloc_reserve(), to allocate enough space for the
   global data on the stack

 - Call board_init_f_init_reserve() to zero initialize it

I guess the SH code can be adapted to use this logic, I'll have a look
into that. Could take a while though, since I'm not fluent in SH

Thanks for the hint!

Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering

More information about the U-Boot mailing list