public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Matthias Kaehlcke <matthias@kaehlcke.net>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] ARM: Add support for edb93xx boards
Date: Fri, 18 Dec 2009 23:32:47 +0100	[thread overview]
Message-ID: <20091218223247.GA1244@darwin> (raw)
In-Reply-To: <20091208203319.0179119F3F@gemini.denx.de>

hi,

El Tue, Dec 08, 2009 at 09:33:18PM +0100 Wolfgang Denk ha dit:

> After relocation we have a full-blown, "normal" C runtime environment.
> Before that, you can use C as well, if you mind the restrictions (like
> data and bss not being available/writable yet, no real stack, etc.).

as suggested i reimplemented the flash, pll and sdram initialization
in C, what is working so far.

now i am trying to reimplement the lowlevel_init() function in C. this
seems to be an easy task, but gcc insists to use the stack, which
isn't set up at this point

the C implementation is:

void lowlevel_init(void)
{
        red_LED_on();
        green_LED_on();

        /* Configure flash wait states before we switch to the PLL */
        flash_cfg();

        /* Set up PLL */
        pll_cfg();

        green_LED_off();

        /* Setup SDRAM */
        sdram_cfg();

        green_LED_on();
        red_LED_off();

        /* FIXME: we use async mode for now */
        __asm__ __volatile__("mrc p15, 0, r0, c1, c0, 0\n"
                        "orr r0, r0, #0xc0000000\n"
                        "mcr p15, 0, r0, c1, c0, 0");
}

which results in the following machine/assembly code:

c1f01094 <lowlevel_init>:
c1f01094:       e52de004        push    {lr}            ; (str lr,
[sp, #-4]!)
c1f01098:       e24dd004        sub     sp, sp, #4      ; 0x4
c1f0109c:       ebffffe4        bl      c1f01034 <red_LED_on>
c1f010a0:       ebffffef        bl      c1f01064 <green_LED_on>
c1f010a4:       eb00483d        bl      c1f131a0 <flash_cfg>
c1f010a8:       eb004842        bl      c1f131b8 <pll_cfg>
c1f010ac:       ebfffff2        bl      c1f0107c <green_LED_off>
c1f010b0:       eb004852        bl      c1f13200 <sdram_cfg>
c1f010b4:       ebffffea        bl      c1f01064 <green_LED_on>
c1f010b8:       ebffffe3        bl      c1f0104c <red_LED_off>
c1f010bc:       ee110f10        mrc     15, 0, r0, cr1, cr0, {0}
c1f010c0:       e3800103        orr     r0, r0, #-1073741824    ;
0xc0000000
c1f010c4:       ee010f10        mcr     15, 0, r0, cr1, cr0, {0}
c1f010c8:       e28dd004        add     sp, sp, #4      ; 0x4
c1f010cc:       e8bd8000        pop     {pc}

is there a way to convince the compiler not to use the stack, or is it
for some reason impossible to translate this routine to C without
having a stack?

kind regards

-- 
Matthias Kaehlcke
Embedded Linux Developer
Barcelona


  The salvation of mankind lies only in making everything the concern of all
                         (Alexander Solzhenitsyn)
                                                                 .''`.
    using free software / Debian GNU/Linux | http://debian.org  : :'  :
                                                                `. `'`
gpg --keyserver pgp.mit.edu --recv-keys 47D8E5D4                  `-

      parent reply	other threads:[~2009-12-18 22:32 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-06 14:54 [U-Boot] [PATCH] ARM: Add support for edb93xx boards Matthias Kaehlcke
2009-12-07 15:51 ` Tom
2009-12-07 19:46 ` Wolfgang Denk
2009-12-07 23:33   ` Matthias Kaehlcke
2009-12-07 23:51     ` Wolfgang Denk
2009-12-08 15:13       ` Matthias Kaehlcke
2009-12-08 15:55         ` kevin.morfitt at fearnside-systems.co.uk
2009-12-08 20:42           ` Wolfgang Denk
2009-12-08 20:33         ` Wolfgang Denk
2009-12-08 21:07           ` Matthias Kaehlcke
2009-12-18 22:32           ` Matthias Kaehlcke [this message]

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=20091218223247.GA1244@darwin \
    --to=matthias@kaehlcke.net \
    --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