gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

Coding > 'interrupt' function attribute extension in GCC

#28891 - ayqazi - Mon Nov 08, 2004 3:43 pm

Hi,

Just browsing the GCC info file looking at extensions and stuff, and here's what I came across:

`interrupt'
Use this attribute on the ARM, AVR, C4x, M32R/D and Xstormy16
ports to indicate that the specified function is an interrupt
handler. The compiler will generate function entry and exit
sequences suitable for use in an interrupt handler when this
attribute is present.

Note, interrupt handlers for the m68k, H8/300, H8/300H, H8S, and
SH processors can be specified via the `interrupt_handler'
attribute.

Note, on the AVR, interrupts will be enabled inside the function.

Note, for the ARM, you can specify the kind of interrupt to be
handled by adding an optional parameter to the interrupt attribute
like this:

void f () __attribute__ ((interrupt ("IRQ")));

Permissible values for this parameter are: IRQ, FIQ, SWI, ABORT
and UNDEF.


Does anybody know if this works? You'll excuse me if I am talking gibberish, its been a while since I tried GBA coding. From what I remember (from doing the famous gba coding tutorials) writing interrupt functions required different techniques than this.

Thanks,
Asfand Yar
_________________
--
http://www.it-is-truth.org/

#28900 - tepples - Mon Nov 08, 2004 4:36 pm

The GBA doesn't need interrupt handlers to be declared as ARM interrupt handlers because the BIOS has an internal interrupt handler that just calls yours as a standard procedure.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#28920 - ayqazi - Mon Nov 08, 2004 6:36 pm

The devrs faq says some stuff about the stack not being very big by default and of only some of the registers being saved when the interrupt function is called. I just thought that this was an easy way to avoid these problems.

I also thought that I could be a bit clever and get everybody to say, "wow! what a clever guy he is, we didn't know that before!" Oh well, maybe next time :-)
_________________
--
http://www.it-is-truth.org/

#28936 - Abscissa - Mon Nov 08, 2004 10:08 pm

Wow! What a clever guy ayqazi is, I didn't know that before!

;)

#28966 - ayqazi - Tue Nov 09, 2004 8:16 am

*sob* You've made me so happy.....
_________________
--
http://www.it-is-truth.org/