2

I am using the newest CCS with MSP-GCC compiler. The following code

#pragma vector=USCI_A1_VECTOR
__interrupt void USCI_A1_ISR(void)
{...isr}

which is the newest officially supported method by TI of declaring ISR-s is not working, I get the following complier messages:

warning: ignoring #pragma vector  [-Wunknown-pragmas]
#pragma vector=USCI_A1_VECTOR
^
error: expected '=', ',', ';', 'asm' or '__attribute__' before 'void'
__interrupt void USCI_A1_ISR(void)

I have also tried different methods, like:

interrupt(USCI_A1_VECTOR) USCI_A1_ISR(void) {  //code goes here}

which gives the error:

c:/ti/ccsv6/ccs_base/msp430/include_gcc/msp430f5529.h:5328:33: error: expected declaration specifiers or '...' before '(' token
#define USCI_A1_VECTOR          (47)                     /* 0xFFDC USCI A1 Receive/Transmit */
                                ^
../uart_printf.c:40:11: note: in expansion of macro 'USCI_A1_VECTOR'
interrupt(USCI_A1_VECTOR) USCI_A1_ISR(void)
          ^

This seems to work though:

__attribute__((interrupt(USCI_A1_VECTOR)))
void USCI_A1_ISR(void){ //code goes here }

What am I missing here?

hgabe
  • 141
  • 2
  • 9

1 Answers1

5

There is no C standard for interrupt routine declaration (a real pitty). Each compiler has it's own way to do it.

TI relased RedHat MSP430 GCC last month and had no time to take a look into it. But for the old MSPGCC branch your last example should be valid.

MSPGCC also provides an include file for better compiler interop:

#include <isr_compat.h>

ISR(USCI_A1, USCI_A1_ISR)
{
    // Code goes here
}

Important: remove the '_VECTOR' tail from the ISR name

Take a look at the isr_compat.h file. It is actually designed to work with all compilers on the market. Maybe it's a good idea to borrow it into your project, if there's nothing similar on your compiler suite.

mgruber4
  • 744
  • 7
  • 11