Peter,

If you look at the latest _startup.c you'll see that
_sdcc_external_startup() is now marked __nonbanked. This is a requirement
(or naked) for it to work as you found out.

Maarten


> Thanks to Maarten and Borut's help I was able to get --model-huge code
> working on my system.
>
> I did run into one issue:  if my code contains a _sdcc_external_startup
> routine, the stack gets blown up on return.
>
> As far as I can tell, what happens is this:
>
> 1. We jump to _sdcc_gsinit_startup
> 2. _sdcc_gsinit_startup calls _sdcc_external_startup using a normal call
> direct to the subroutine.
> 3. _sdcc_external_startup does its stuff and returns via the trampoline
> (ljmp __sdcc_banked_ret).
> 4. _sdcc_banked_ret empties the stack and returns to the wrong place.
> 5. Program fails.
>
> If I don't use an _sdcc_external_startup function, everything works.
> Only when I add the external startup do I get a failure.
>
> I was able to make the external startup work by making it a naked
> function and forcing a normal return.
>
> char _sdcc_external_startup (void) __naked {
>
>     asm
>         ret
>     end_asm;
>
> }
>
> Other than that, so far so good.
>
> I am using the SDCC :
> mcs51/gbz80/z80/ds390/pic16/pic14/TININative/ds400/hc08 2.9.7 #5729
> (Mar  9 2010) (MINGW3)


------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Sdcc-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sdcc-user

Reply via email to