The vector Pragma

The vector pragma indicates that the function that follows is to be used as the interrupt vector routine for the listed vectors. The syntax of the pragma is:

#pragma vector =vec1[,vec2,vec3, ...]

The vector pragma requires linker command file support. The command file must specify output sections for each interrupt vector of the form .intxx where xx is the number of the interrupt vector. The output sections must map to the physical memory location of the appropriate interrupt vector. The standard linker command files are set up to handle the vector pragma. See Section 6.7.4.

If you do not specify an ISR routine for some interrupt vectors, an ISR routine will be provided for those vectors from the RTS library and the RTS library will automatically be linked with your application. The default ISR routine puts the device in low power mode. You can override the ISR provided by the RTS with the unused_interrupts keyword as follows:

#pragma vector=unused_interrupts interrupt void user_trap_function(void) { // code for handling all interrupts that do not have // specific ISRs }

The __even_in_range intrinsic provides a hint to the compiler when generating switch statements for interrupt vector routines. The intrinsic is usually used as follows:

switch (__even_in_range(x, NUM))
{
    ...
}

The __even_in_range intrinsic returns the value x to control the switch statement, but also tells the compiler that x must be an even value in the range of 0 to NUM, inclusive.

NOTE

Interrupt service routine (ISR) warning

The linker emits a warning for any device-specific interrupts that do not have an associated interrupt service routine. However, a default vector handler is now provided by the run-time support (RTS) library, so you should not see this error if you are linking with the provided RTS library.

For more details, see the MSP430 Assembly Language Tools User's Guide section for the .intvec directive.