avr-gcc-list
[Top][All Lists]
Advanced

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

Re: [avr-gcc-list] On getting an ISR leaner with GCC


From: Dave Hylands
Subject: Re: [avr-gcc-list] On getting an ISR leaner with GCC
Date: Sat, 27 Dec 2008 01:48:28 -0800

Hi Dennis,

On Fri, Dec 26, 2008 at 11:52 PM, dlc <address@hidden> wrote:
> The subject says it all.  I've an ISR that is using too many cycles for
> something that kicks every 10us.  I'm very experienced with the PIC and know
> how to specify registers that are not touched outside of the ISR to avoid
> lots of "push-n-pop" actions.  Is there something like that in the AVR
> toolchain or am I going to have to resort to assembly to get this thing
> leaned down?  I'd like to create some memory that is dedicated to the ISR
> such that the compiler knows that it doesn't need to be saved. Also a way to
> get scratchpad memory assigned to it for some basic math that I don't want
> to have to use the overhead of push/pop.  Can anyone offer insight into how
> I can lean an ISR down or what sorts of operations or memory types to avoid
> there with avr-gcc?

In my experience, the number one thing to do to make ISRs leaner is to
avoid function calls from within the ISR. inline function calls are
ok, it's the ones to an external function that isn't. You just have to
look at the assembly code generated to see the difference.

If the ISR doesn't do any function calls, then it will only push/pop
the bare minimum of registers. If the ISR has to do a function call,
then it needs to push/pop all of the registers that "any old" C
function might touch.

-- 
Dave Hylands
Shuswap, BC, Canada
http://www.DaveHylands.com/




reply via email to

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