Re: Adding the address of an exception/interrupt handler to the vector table

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

 



On Wed, 2009-04-29 at 17:39 -0700, Ian Lance Taylor wrote:
> John Farmer <news02@xxxxxxxxxxx> writes:
> 
> > As far as I have been able to find out it is not possible to write an
> > interrupt function where its address is added to a selectable position in
> > the vector table automatically by the compiler/linker. Just to be certain
> > would that be right?
> 
> Seems like it could be done pretty easily with a bit of assembly code or
> with some linker script magic.
> 
> > Would I be correct in thinking that a normal function could be used as an
> > ISR in which case I do not need to use the __attribute__((interrupt)) at
> > all? If this is the case what is this attribute used for?
> 
> It depends on the details of your platform.  For ARM, the different
> types of interrupt routines return to their caller in different ways, so
> they can not be replaced by a regular function (though I think they
> could be replaced by an assembly code wrapper).
> 
> Ian

It depends on your ARM chip.  For Cortex-m3 (rev 2 or later, IIRC[1])
any function with a prototype "void func(void)" can be used as an ISR
since the hardware will do all the register stacking for you.

R.

[1]  It works on earlier revs too, provided you don't have variadic
functions.


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux