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

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

Re: [avr-gcc-list] 2 tricky questions


From: Julius Luukko
Subject: Re: [avr-gcc-list] 2 tricky questions
Date: Tue, 17 Jun 2003 11:47:39 +0300
User-agent: KMail/1.4.1

On Tuesday 17 June 2003 11:36, Marko Panger AGB Lab wrote:
> 2) Is it possible to link user defined (my) interrupt prologue and epilogue
> functions instead of the integrated ones ?

Hi,

Here's one solution I have used: I looked how SIGNAL and INTERRUPT are defined 
in avr/signal.h and changed the attribute signal or interrupt to naked

#define MYISR(signame)                        \
void signame (void) __attribute__ ((naked));    \
void signame (void)

attribute naked is _really_ naked so that no prologue nor epilogue is added at 
all. Therefore you need to add your prologue and epilogue by hand in every 
ISR you have:

MYISR(signame) {
  MyISRPrologue();

  /* ISR code */

 MyISREpilogue();
}

MyISREpilogue() must have a reti instruction as the last instruction.

I hope this helps.

-- 
D.Sc. Julius Luukko
Laboratory of Control Engineering/Department of Electrical Engineering
Lappeenranta University of Technology, FINLAND
phone:+358-5-621 6713, fax:+358-5-621 6799, www: http://www.ee.lut.fi



reply via email to

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