[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] Not naked but "topless" functions?

From: Tvrtko A. Ursulin
Subject: Re: [avr-gcc-list] Not naked but "topless" functions?
Date: Thu, 17 Oct 2002 11:40:00 +0200

On Friday 11 October 2002 18:02, Larry Barello wrote:

> There is nothing wrong with this prolog.  The CLI clears the interrupt
> enable flag.  When the OUT instruction restores the flag by restoring SREG,
> that doesn't take affect until AFTER the next instructions (read the chip
> data sheets carefully), so the update of the stack will be complete.

Right, I missed that in manual. :)

> IMHO the "naked" function is simply broken code.  Unfortunately there is no
> "No Return" attribute implemented for GCC (well, there is, but it has never
> made it into the GCC source) which is what you really want.  I too wrote an

Why it has never made it?

> I still use the "naked" attribute in my RTOS, but I have the restriction
> that you can't have more than 8 bytes of automatic variables in the top
> level routine (GCC allocates registers, then stack frame variables).
> Fortunately, GCC is so fantastic about register recycling, I can often get
> 10-12 bytes worth of automatics before the compiler needs to resort to the
> frame.  Unfortunately, I have to inspect the resulting assembly all the
> time to make sure modifying the code didn't introduce frame variables
> which, of course, would break.

Only 8? Once I tested how many register variables I can have, and when I used 
30 of them, compiler put only 5 of them on the stack!? When I used 20, none 
was on the stack. Is there an fixed number of available registers? Some are 
reserved like r0,r1. All other registers are free or not?

avr-gcc-list at http://avr1.org

reply via email to

[Prev in Thread] Current Thread [Next in Thread]