Question

How to get rid of the syntax error flagged by Simplicity Studio for ISR function definitions?

Answer

While including ISR function definitions, Simplicity Studio can show squiggly lines and this syntax error - "Multiple markers at this line" (see figure below)

 

Screen Shot 2017-04-27 at 9.41.02 AM.png

This does not cause any build errors but is just not a very appealing sight during the development phase. 

 

Why is this happening?

 

The Eclipse CDT parser (which parses the code to build an index) does not like that syntax even though the Silicon Labs C compiler accepts it. 

 

How to fix this?

 

Since the compiler itself does not generate any errors, you could ignore the CDT syntax error. You can also turn off syntax error reporting in the editor by going to

 

  1. [Window] > [Preferences] > [General] > [Editors] > [Text Editors] > [Annotations],
  2. Select  C/C++ Indexer Markers, and
  3. Uncheck all the checkboxes.

Also in many cases, the error is due to 8051 compiler extensions that are not ANSI C compliant.  For example, the interrupt and using keywords are 8051 extensions.  To have the CDT parser automatically ignore these keywords, instead use the SI_INTERRUPT() or SI_INTERRUPT_USING() macros from si_toolchain.h.

 

si_toolchain.h uses conditional compilation to automatically remove unrecognized keywords from the CDT parser to prevent syntax errors.

 

#else  // __SLS_IDE__ : Macros defined to remove syntax errors within Simplicity Studio
#define SI_INTERRUPT(name, vector) void name (void)
#define SI_INTERRUPT_USING(name, vector, regnum) void name (void)
#define SI_INTERRUPT_PROTO(name, vector) void name (void)
#define SI_INTERRUPT_PROTO_USING(name, vector, regnum) void name (void)

  • 8-bit MCUs
  • 32-bit MCUs
  • Development Environments
  • Knowledge Base Articles
  • Simplicity Studio