[Top][All Lists]

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

Re: [avr-gcc-list] custom signal prologue

From: Jim Brain
Subject: Re: [avr-gcc-list] custom signal prologue
Date: Tue, 23 Nov 2004 08:55:59 -0600
User-agent: Mozilla Thunderbird 0.8 (Windows/20040913)

Ben Mann wrote:

Hi all,

Is there any way to customise the prologue of an interrupt handler?
I had the same issue.  I'm interested in responses you receive, but here
is what I did:

#ifdef JOY_ASM_INT
void SIG_OUTPUT_COMPARE1A (void) __attribute__ ((interrupt))
__attribute__ ((naked));    \
void SIG_OUTPUT_COMPARE1A (void) {
asm volatile ("push r24" ::);
asm volatile ("push __tmp_reg__" ::);
 // bring output high
 // turn off IRQ
 TIMSK&=(unsigned char)~(1<<OCIE1A);
 if((TIFR & (1<<OCF1B)) != 0) {
#ifdef JOY_ASM_INT
asm volatile ("pop __tmp_reg__" ::);
asm volatile ("pop r24" ::);
asm volatile ("reti" ::);

I compile with JOY_ASM_INT undefined, and see what registers the routine
requires.  I then tweak the ASM and recompile with JOY_ASM_INT defined.

I'm not wild about my solution, but I absolutely had to remove all the
extraneous pushes and pops, or the code was worthless.


Jim Brain, Brain Innovations
address@hidden                                http://www.jbrain.com
Dabbling in WWW, Embedded Systems, Old CBM computers, and Good Times!

reply via email to

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