You copied the Doc URL to your clipboard.

__attribute__((interrupt("type"))) function attribute

The GNU style interrupt attribute instructs the compiler to generate a function in a manner that is suitable for use as an exception handler.

Syntax

__attribute__((interrupt("type")))

Where type is one of the following:

  • IRQ.
  • FIQ.
  • SWI.
  • ABORT.
  • UNDEF.

Usage

The interrupt attribute affects the code generation of a function as follows:

  • If the function is AAPCS, the stack is realigned to 8 bytes on entry.
  • For processors that are not based on the M-profile, preserves all processor registers, rather than only the registers that the AAPCS requires to be preserved. Floating-point registers are not preserved.

  • For processors that are not based on the M-profile, the function returns using an instruction that is architecturally defined as a return from exception.

Restrictions

When using __attribute__((interrupt("type"))) functions:

  • No arguments or return values can be used with the functions.
  • The functions are incompatible with -frwpi.

Note

In ARMv6-M, ARMv7-M, and ARMv8-M, the architectural exception handling mechanism preserves all processor registers, and a standard function return can cause an exception return. Therefore, specifying the interrupt attribute does not affect the behavior of the compiled output. However, ARM recommends using the interrupt attribute on exception handlers for clarity and easier software porting.

Note

  • For architectures that support A32 and T32 instructions, functions specified with the interrupt attribute compile to A32 or T32 code depending on whether the compile option specifies ARM or Thumb.

  • For Thumb only architectures, for example ARMv6-M, functions specified with the interrupt attribute compile to T32 code.

  • The interrupt attribute is not available for A64 code.
Was this page helpful? Yes No