B3.8 __attribute__((interrupt("type"))) function attribute
This 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 optional and can be one of the following:
IRQ.
FIQ.
SWI.
ABORT.
UNDEF.
Usage
This 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, the attribute 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 Arm®v6‑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. For some M-profile targets, such as Armv7‑M, this attribute generates code that forces the stack to be aligned. This attribute is mandatory on exception handlers.
Note:
For architectures that support A32 and T32 instructions, functions that are specified with this attribute compile to A32 or T32 code depending on whether the compile option specifies A32 code or T32 code.
For T32 only architectures, for example the Armv6‑M architecture, functions specified with this attribute compile to T32 code.
Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers of your data.