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.

CCS5 (5.0.1.00026) gives interrupt keyword as syntax error



This is a minor issue but CCS5 appears to report a syntax error on the interrupt keyword. The error is only shown in the editor and not in the Problems window during compilation.

For example in the following function definition the interrupt keyword is highlighted as a syntax error:

interrupt void Evh_ResetInt(void)

For information we are using the TMS570 processor running TMS470 Code Genration Tools 4.7.0B2.

Regards,

Richard

  • Richard,

    This appears to be very similar to the problem reported here with other keywords: http://e2e.ti.com/support/development_tools/code_composer_studio/f/81/p/88538/306519.aspx#306519

    In that thread it only impacted .cpp files but with the interrupt keyword C files also show the problem.  You can use the workaround described in the other thread if you want to get rid of the question marks.  I will update the defect in the other thread to indicate that the interrupt keyword needs to be identified as well.

    Regards,

    John

     

  • Hi John,

    I can confirm that the fix suggested via the link that your post refers to (http://dev.eclipse.org/newslists/news.eclipse.tools.cdt/msg17873.html) resolves the problem.

    In our case, I included the following text before the interrupt definition and the warning goes away:

    #ifdef __CDT_PARSER__

    #define interrupt

    #endif

    Regards,

    Richard

  • Hi John,

    I confirm too, but don't forget the two unserscores preceding interrupt key word.

    #define __interrupt

        Regards.

            Henri

  • I am using CCS version  5.1.0.09000. I have a syntax error being reported for the interrupt written below:

    #pragma vector = USCI_B1_VECTOR

    __ interrupt void USCI_B1_ISR(void)

    I have two underscores before the interrupt. Can anyone tell me the right syntax for interrupt.

     

    Thank you!

  • Harika,

    Did you make sure to use a new workspace whith CCS 5.1 or did you open a existing workspace created with an older version of CCS5 or CCSv4? The syntax errors may stil appear if you open an older workspace. Try opening a new workspace, and import your project into it and let us know if the syntax errors still persist.

  • Thanks Aarti, it cleared up my syntax errors!

  • I got the interrupt the 1sttime through. It got lost after that but I tried some other sample code and they do the same thing.

     

    #pragma vector = USCI_B0_VECTOR
    __interrupt void USCI_B0_ISR(void)
    {
      switch(__even_in_range(UCB0IV,12))
      {
      case  0: break;                           // Vector  0: No interrupts
      case  2: break;                           // Vector  2: ALIFG
      case  4: break;                           // Vector  4: NACKIFG
      case  6: break;                           // Vector  6: STTIFG
      case  8: break;                           // Vector  8: STPIFG
      case 10: break;                           // Vector 10: RXIFG
      case 12:                                  // Vector 12: TXIFG 
        if (TXByteCtr)                          // Check TX byte counter
        {
          UCB0TXBUF = *PTxData++;               // Load TX buffer
          TXByteCtr--;                          // Decrement TX byte counter
        }
        else
        {
          UCB0CTL1 |= UCTXSTP;                  // I2C stop condition
          UCB0IFG &= ~UCTXIFG;                  // Clear USCI_B0 TX int flag
          __bic_SR_register_on_exit(LPM0_bits); // Exit LPM0
        } 
      default: break;
      }
    }