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

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

Re: [avr-gcc-list] Inserting code before context save in an ISR (for nes


From: David Brown
Subject: Re: [avr-gcc-list] Inserting code before context save in an ISR (for nested interrupts)
Date: Mon, 06 Aug 2007 14:48:38 +0200
User-agent: Thunderbird 2.0.0.6 (Windows/20070728)

David Carr wrote:
Hi all,

I'm working on a hard realtime application where I need to keep the time
where interrupts are disabled as small as possible.  I've noticed that a
typical ISR can take 40+ cycles to push registers onto the stack before
executing any user ISR code.  I'd like for interrupts to be re-enabled
immediately upon entering the ISR (before the context save).

The only way that I can think of to do this is to add the naked attribute
to my ISRs.  Unfortunately, this is very unattractive because then I have
to do all context save operations manually.  My ISRs are written in C and
therefore I wouldn't know which registers would need to be saved and would
be forced to save all of them --- an expensive proposition.

Is there a way to inject a simple sei() into the start of an ISR before
the automatic context save?

Thanks,
David Carr


If you use the "interrupt" attribute instead of the "signal" attribute, nested interrupts are enabled as soon as possible in the interrupt routine.

As an aside, a typical ISR takes only a few cycles to push the registers onto the stack - you should avoid using any code that requires function calls in your interrupt routine, as they lead to many more registers needing to be saved (that includes library functions, but not inlined functions).

mvh.,

David





reply via email to

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