public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] Initializing global_data on SuperH before board_init_f() ?
Date: Wed, 16 Aug 2017 10:47:40 +0200	[thread overview]
Message-ID: <20170816104740.5d45138c@windsurf> (raw)
In-Reply-To: <48db112b-383c-5ea3-fb53-fd72f1b2c62f@ti.com>

Hello,

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,
they:

 - 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
assembly.

Thanks for the hint!

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

  reply	other threads:[~2017-08-16  8:47 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-15 21:07 [U-Boot] Initializing global_data on SuperH before board_init_f() ? Thomas Petazzoni
2017-08-16  2:39 ` Lokesh Vutla
2017-08-16  8:47   ` Thomas Petazzoni [this message]
2017-08-17 18:30 ` Vladimir Zapolskiy
2017-08-19 10:04   ` Thomas Petazzoni

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170816104740.5d45138c@windsurf \
    --to=thomas.petazzoni@free-electrons.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox