You copied the Doc URL to your clipboard.

__irq

The __irq keyword enables a C or C++ function to be used as an exception handler.

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

Usage

The __irq keyword causes the compiler to generate a function in a manner that makes it suitable for use as an exception handler. This means that the compiler makes the function:

  • Preserve all processor registers, not only those required to be preserved by the AAPCS. Floating-point registers are not preserved.

  • Return using an instruction that is architecturally defined as causing an exception return.

Restrictions

No arguments or return values can be used with __irq functions. __irq functions are incompatible with --apcs /rwpi.

Note

In ARMv6-M and ARMv7-M the architectural exception handling mechanism preserves all processor registers, and a standard function return can cause an exception return. Therefore, 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.

Was this page helpful? Yes No