You copied the Doc URL to your clipboard.

__irq

The __irq keyword enables a C or C++ function to be used as an interrupt routine.

__irq is a function qualifier. It affects the type of the function.

Restrictions

All corrupted registers except floating-point registers are preserved, not only those that are normally preserved under the AAPCS. The default AAPCS mode must be used.

No arguments or return values can be used with __irq functions.

In architectures other than ARMv6-M and ARMv7-M, the function exits by setting the program counter to lr-4 and the CPSR to the value in SPSR.

Note

In ARMv6-M and ARMv7-M, specifying __irq does not affect the behavior of the compiled output. However, ARM recommends using __irq on exception handlers for clarity and easier software porting.

Note

  • For architectures that support ARM and Thumb-2 technology, for example ARMv6T2, ARMv7-A, and ARMv7-R, functions specified as __irq compile to ARM or Thumb code depending on whether the compile option or #pragma specify ARM or Thumb.

  • For Thumb only architectures, for example ARMv6-M and ARMv7-M, functions specified as __irq compile to Thumb code.

  • For architectures before ARMv6T2, functions specified as __irq compile to ARM code even if you compile with --thumb or #pragma thumb.

See also