A number of special function attributes are supported, to provide access to the special features of the MSP430, and the special needs of embedded programming.
reserve(x) | When applied to main(), this reserves “x” bytes of RAM above the stack. This cannot be used with C++ (if C++ is supported later on). |
interrupt(x) | Make the function an interrupt service routine for interrupt “x”. |
signal | Make an interrupt service routine allow further nested interrupts. |
wakeup | When applied to an interrupt service routine, wake the processor from any low power state as the routine exits. When applied to other routines, this attribute is silently ignored. |
naked | Do not generate a prologue or epilogue for the function. |
critical | Disable interrupts on entry, and restore the previous interrupt state on exit. |
reentrant | Disable interrupts on entry, and always enable them on exit. |
saveprologue | Use a subroutine for the function prologue, to save memory. |
noint_hwmul | Supress the generation of disable and enable interrupt instructions around hardware multiplier code. |
The syntax for using these attributes is “__attribute__((attribute_name(x)))”, where “attribute_name” is replaced by the required attribute name, and “x” is replaced by a parameter to that attribute. For attributes which do not accept parameters, “(x)” should be omitted.
The header file “signal.h” defines a number of alternative names for some of these attributes. In the sections below, some of these alternative names are used in more detailed discussions of the use of these attributes.