From mboxrd@z Thu Jan 1 00:00:00 1970 From: Matthias Kaehlcke Date: Fri, 18 Dec 2009 23:32:47 +0100 Subject: [U-Boot] [PATCH] ARM: Add support for edb93xx boards In-Reply-To: <20091208203319.0179119F3F@gemini.denx.de> References: <20091206145444.GE22689@darwin> <20091207194629.74F823F6CC@gemini.denx.de> <20091207233313.GA31886@darwin> <20091207235147.8D2B13F6CC@gemini.denx.de> <20091208151358.GD31886@darwin> <20091208203319.0179119F3F@gemini.denx.de> Message-ID: <20091218223247.GA1244@darwin> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.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 : c1f01094: e52de004 push {lr} ; (str lr, [sp, #-4]!) c1f01098: e24dd004 sub sp, sp, #4 ; 0x4 c1f0109c: ebffffe4 bl c1f01034 c1f010a0: ebffffef bl c1f01064 c1f010a4: eb00483d bl c1f131a0 c1f010a8: eb004842 bl c1f131b8 c1f010ac: ebfffff2 bl c1f0107c c1f010b0: eb004852 bl c1f13200 c1f010b4: ebffffea bl c1f01064 c1f010b8: ebffffe3 bl c1f0104c 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 `-