gcc --- __attribute__((interrupt( irq )))


i started with device driver for arm ... there i saw for each handler mention --- __attribute__((interrupt( irq ))) -.I am confused how this attribute will place a call to our driver routine ..??

IRQ of arm have following Vector address--- 0x00000018 (or 0xFFFF0018) As there can be many interrupt handler on same line. Suppose if we have 4 device driver each with its own IRQ to be reistered.

Means some startup code will be provided by the GCC compiler for the IRQ handler & compiler will place call to our routine in that startup code for interrupt handler ..... Am i right ...?

asked on Stack Overflow Dec 9, 2012 by Allan • edited Dec 9, 2012 by Luke Woodward

2 Answers


From GCC docs for interrupt attribute:

The compiler generates function entry and exit sequences suitable for use in an interrupt handler when this attribute is present.

You can use objdump easily to see how this attribute changes your binary which should clarify the situation for you much better.

answered on Stack Overflow Dec 9, 2012 by auselen

The attribute should ONLY be used by interrupt handler of the OS and NOT by interrupt handler of a specific driver. The OS will read the IRQ vector/number and call the appropriate driver function to service the IRQ. You only need to register your driver/ISR with the OS.

answered on Stack Overflow Dec 29, 2012 by sgupta

User contributions licensed under CC BY-SA 3.0