The demo code on the web for defining an ISR for ARM is generally this:
__irq void ISRFunc (void);
Using ARM-GCC, this gives syntax errors on compile, I've tried obvious variants like _irq
but they all have the same problem. Some google references state that you don't need to specify the function as an ISR, i.e. void ISRFunc(...)
will also work. However, I'm having trouble getting my programs to run, so it would help a lot if someone could confirm (a) is the type specifier __irq
(or equivalent) required, and (b) what should it be to avoid compile errors.
Thanks for any information.
__isr
is ARM C compiler specific keyword (and looks like it was Keil specific too, but obsoleted), and will not compile via GCC.
As per GCC documentation, following is the syntax for declaring ARM interrupt service routine:
void __attribute__((interrupt("IRQ"))) do_irq()
{
//your irq service code goes here
}
Extra details:
In fact, you may use any of the following to inform compiler that your function is the interrupt handler.
void __attribute__((interrupt)) ...
void __attribute__((interrupt("FIQ"))) ...
void __attribute__((interrupt("IRQ"))) ...
The difference is both "IRQ"
and "FIQ"
should switch register contexts and save certain
registers ("FIQ"
stacks nothing), while plain interrupt
is more a general "save
what you use here and restore when exiting".