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

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

Re: [avr-gcc-list] About context saving in Vectors


From: David Kelly
Subject: Re: [avr-gcc-list] About context saving in Vectors
Date: Wed, 14 Jan 2009 15:38:15 -0600
User-agent: Mutt/1.4.2.3i

On Wed, Jan 14, 2009 at 01:41:33PM -0700, dlc wrote:
> I guess that we agree.  :)
> 
>   My biggest problem was getting variables established that gcc 
> wouldn't try to save when the ISR started.  I've tried "REGISTER", but
> I couldn't guarantee that the register I'd fixed an index to was
> really not being used elsewhere, I had one instance where it clearly
> was corrupted elsewhere, even if it was in the list of registers that
> various docs say are "available".

I don't think gcc is trying to save any variables on entry to an ISR.

What gcc does on entry to an ISR is save certain registers that it will
use within that function to hold autos and temporary scratch values. It
has to push those on the stack at entry and pull on exit because the
interrupted routine expects them to be the way it last used them.

So the ISR isn't initializing its variables, its making space for them.

Can declare your variables as static within the ISR to keep them from
being allocated in CPU registers or on the stack. But no matter what,
some register space is needed for any non-trivial ISR.

-- 
David Kelly N4HHE, address@hidden
========================================================================
Whom computers would destroy, they must first drive mad.




reply via email to

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