This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

#pragma vector = ... does not work

Other Parts Discussed in Thread: MSP430F1611

Hi,

I'm trying to get to know the way interrupt service routines are written with msp430-gcc. From code examples found here in the forum I figured out that I have to use  #pragma vector = ... , however when I try to modify the simple blink.c example that comes with msp430-gcc I get a compile error.

Here's the code:

---------------------------------------------------------------------

#include <msp430F1611.h>                


#pragma vector=TIMERA0_VECTOR
__interrupt void TimerA_ISR(void)
{    
 //here later some code would go in
}

int main(void) {
    WDTCTL = WDTPW | WDTHOLD;        // Stop watchdog timer
    P1DIR |= 0x01;                    // Set P1.0 to output direction

    for(;;) {
        volatile unsigned int i;    // volatile to prevent optimization

        P1OUT ^= 0x01;                // Toggle P1.0 using exclusive-OR

        i = 10000;                    // SW Delay
        do i--;
        while(i != 0);
    }
    
    return 0;
}
-----------------------------------------------------------------

The error message I get when compiling this is:

C:/ti/gcc/bin/msp430-elf-gcc -I C:/ti/gcc/bin/../include -mmcu=msp430f1611 -O2 -Wall -g   -c -o blink_isr.o blink_isr.c
blink_isr.c:27:0: warning: ignoring #pragma vector  [-Wunknown-pragmas]
 #pragma vector=TIMERA0_VECTOR
 ^
blink_isr.c:28:13: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'void'
 __interrupt void TimerA_ISR(void)
             ^
make: *** [blink_isr.o] Error 1
make: Target `all' not remade because of errors.

I know there would have to be more initialisation stuff etc. in the code to get TimerA working but for the time being I would be glad if gcc would compile this file in the first place.

I'm using msp430-gcc without CCS on a Windows machine

What's going wrong here (or more certainly: What am I doing wrong)? Any help is welcome.

Regards,

Jens

**Attention** This is a public forum