Table of Contents        Previous topic       Next topic       

C/C++ COMPILER->Interrupt Functions->ARM->Automatic Coding of Interrupt Vector

An alternative way of declaring an interrupt function is to use the _interrupt n qualifier (or __nestableinterrupt n).  The compiler generates exactly the same code for the function as it does when the _interrupt or  __nestableinterrupt qualifier is used but in addition it also creates the code to set up the interrupt vector itself.  There is therefore no need to modify your startup code.

The value of n can be between 1 and 7, excluding 5.  Defines are included in os.h as follows:

#define IVN_SOFTWARE 2
#define IVN_DATA_ABORT 4
#define IVN_IRQ 6
#define IVN_FIQ 7

As an example for the following code:

void _interrupt IVN_SOFTWARE func()
    /* Your interrupt code goes here */

the compiler will generate the a branch instruction at the absolute address of 0X00000008 which will transfer execution to the function.

If the Interrupt Vector Offset (/VO:) command line option is used, the absolute address will be incremented by the specified offset.

The compiler will also generate exit code to appropriate for a software interrupt.

The __task qualifier can also be used.  For example:

void __task _interrupt IVN_SOFTWARE func()
    /* Your interrupt code goes here */

No entry or exit code will be generated by the compiler allowing custom entry and exit code to be provided.