public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Heiko Schocher <hs@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] kirkwood: CONFIG_SYS_INIT_SP_ADDR wrong?
Date: Wed, 10 Nov 2010 17:46:52 +0100	[thread overview]
Message-ID: <4CDACC7C.3040609@denx.de> (raw)
In-Reply-To: <4CDABE3D.50506@schmid-telecom.ch>

Hello Daniel,

Daniel Hobi wrote:
> On 10.11.2010 16:40, Heiko Schocher wrote:
>> Daniel Hobi wrote:
>>> But you also added assembly code to setup the initial stack pointer in
>>> arch/arm/cpu/*/start.S (ie commit ab86f72c for arm926ejf) which reads:
>>>
>>> /* Set stackpointer in internal RAM to call board_init_f */
>>> call_board_init_f:
>>> 	ldr	sp, =(CONFIG_SYS_INIT_SP_ADDR)
>>>
>>> CONFIG_SYS_INIT_SP_ADDR may not be aligned properly, especially with
>>> your latest patch to km_arm.h:
>>>
>>> #define CONFIG_SYS_INIT_SP_ADDR	(0xC8012000 - GENERATED_GBL_DATA_SIZE)
>> Ah, good catch.
>>
>> Then we should add this alignment into the generation of
>> GENERATED_GBL_DATA_SIZE.

looked in the generation of GENERATED_GBL_DATA_SIZE:

./lib/asm-offsets.c

        /* Round up to make sure size gives nice stack alignment */
        DEFINE(GENERATED_GBL_DATA_SIZE,
                (sizeof(struct global_data)+15) & ~15);

this is ok.

> Hm? The stack pointer needs alignment, not GENERATED_GBL_DATA_SIZE. What
> happens if I define:
> 
> #define CONFIG_SYS_INIT_SP_ADDR	(0xC8012004 - GENERATED_GBL_DATA_SIZE)

Indeed, that would be bad ... don;t do it ;-)

> Why not add alignment to start.S?
> 
>  /* Set stackpointer in internal RAM to call board_init_f */
>  call_board_init_f:
>  	ldr	sp, =(CONFIG_SYS_INIT_SP_ADDR)
> +	bic	sp, sp, #7

Hmm.. because we do in board_init_f:

 gd = (gd_t *) (CONFIG_SYS_INIT_SP_ADDR);

Hmm.. maybe we should call board_init_f with the info, where to
find the stack, but this would be a change for all architectures,
not only arm ...

opinions?

bye,
Heiko
-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany

  parent reply	other threads:[~2010-11-10 16:46 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-10 13:57 [U-Boot] kirkwood: CONFIG_SYS_INIT_SP_ADDR wrong? Daniel Hobi
2010-11-10 14:15 ` Heiko Schocher
2010-11-10 14:37   ` Daniel Hobi
2010-11-10 15:02     ` Heiko Schocher
2010-11-10 15:13       ` Daniel Hobi
2010-11-10 15:40         ` Heiko Schocher
2010-11-10 15:46           ` Daniel Hobi
2010-11-10 16:29             ` Albert ARIBAUD
2010-11-10 16:46             ` Heiko Schocher [this message]
2010-11-10 17:53               ` Daniel Hobi
2010-11-10 20:13               ` Wolfgang Denk
2010-11-10 20:11           ` Wolfgang Denk

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=4CDACC7C.3040609@denx.de \
    --to=hs@denx.de \
    --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