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 `- _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot