RX Function Attributes (Using the GNU Compiler Collection (GCC)) (original) (raw)

Use this attribute to indicate that the specified function is an interrupt handler. The compiler generates function entry and exit sequences suitable for use in an interrupt handler when this attribute is present.

On RX and RL78 targets, you may specify one or more vector numbers as arguments to the attribute, as well as naming an alternate table name. Parameters are handled sequentially, so one handler can be assigned to multiple entries in multiple tables. One may also pass the magic string "$default" which causes the function to be used for any unfilled slots in the current table.

This example shows a simple assignment of a function to one vector in the default table (note that preprocessor macros may be used for chip-specific symbolic vector names):

void attribute ((interrupt (5))) txd1_handler ();

This example assigns a function to two slots in the default table (using preprocessor macros defined elsewhere) and makes it the default for the dct table:

void attribute ((interrupt (RXD1_VECT,RXD2_VECT,"dct","$default"))) txd1_handler ();