These function attributes are supported by the AVR back end:
interruptOn the AVR, the hardware globally disables interrupts when an
interrupt is executed. The first instruction of an interrupt handler
declared with this attribute is a SEI instruction to
re-enable interrupts. See also the signal function attribute
that does not insert a SEI instruction. If both signal and
interrupt are specified for the same function, signal
is silently ignored.
nakedasm statements can safely be included in naked functions
(see Basic Asm). While using extended asm or a mixture of
basic asm and C code may appear to work, they cannot be
depended upon to work reliably and are not supported.
OS_mainOS_taskOS_main or OS_task attribute
do not save/restore any call-saved register in their prologue/epilogue.
The OS_main attribute can be used when there is
guarantee that interrupts are disabled at the time when the function
is entered. This saves resources when the stack pointer has to be
changed to set up a frame for local variables.
The OS_task attribute can be used when there is no
guarantee that interrupts are disabled at that time when the function
is entered like for, e.g. task functions in a multi-threading operating
system. In that case, changing the stack pointer register is
guarded by save/clear/restore of the global interrupt enable flag.
The differences to the naked function attribute are:
naked functions do not have a return instruction whereas
OS_main and OS_task functions have a RET or
RETI return instruction.
naked functions do not set up a frame for local variables
or a frame pointer whereas OS_main and OS_task do this
as needed.
signalSee also the interrupt function attribute.
The AVR hardware globally disables interrupts when an interrupt is executed.
Interrupt handler functions defined with the signal attribute
do not re-enable interrupts. It is save to enable interrupts in a
signal handler. This “save” only applies to the code
generated by the compiler and not to the IRQ layout of the
application which is responsibility of the application.
If both signal and interrupt are specified for the same
function, signal is silently ignored.