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.

problem with interrupts (msp430g2553)

Other Parts Discussed in Thread: MSP430G2553

There is my code and problem. I have error with interrupt command. There is: "Multiple markers on this line. -Syntax error -expected '=' , ';' , 'asm' or '__atribiute__' before 'void' " This code is from TI examples for MSP430G2553 so i don't know what is wrong.


I will be very thankful for help.

  • What toolchain are you using?  I see from the picture it is Eclipse based, but is this Code Composer Studio?  It certainly wouldn't be IAR Embedded Workbench.

    The examples are built for CCS or IAR from the Product Folder.  If you are targeting a different code generation tools suite, then you will probably need to modify how that toolchain handles interrupt keywords, etc.

  • It looks like you're using mspgcc as commandline compiler for eclipse.

    Older versions of MSPGCC (I'm not suere for the latest uniarch versions) do not use the #pragma for marking a fucntion as ISR.
    The pragma is simply ignored, while the __interrupt is undefined and therefore unexpected before the void.

    Instead,
    interrupt(VECTOR_NAME) ISR_name(void){...} is used by MSPGCC.

    interrupt(vector) itself is again a macro that translates into a function attribute:

    #define interrupt(x) void __attribute__((interrupt (x)))

    isr_compat.h also supports some alternative notations for other compilers, so MSPGCC code can be compiled on different compilers using the ISR(v,n) notation, which then translates into
    interrupt[v_VECTOR] void n(void)
    for older IARs, or
    _Pragma(vector=v_VECTOR)
    __interrupt void n(void)
    for the newer IARs
    or many different flavors for Quadravox, Rowley, CCS or MSPGCC.

    However, this won't provide backwards compatibility from outher compiler's code. But it can serve as a translation lookup instruction for manual ports.

**Attention** This is a public forum