MATLAB: How to handle interrupts in code analysis using Polyspace for C/C++

Polyspace Client for C/C++

The interrupts are a functions from the micro processor, which Polyspace does not know what to with and hence produces error during analysis?
How do I handle this in Code analysis using Polyspace?

Best Answer

In your header file you have a line:
 
typedef interrupt void(*PINT)(void);
The reason that this will fail compilation is that 'interrupt' is a compiler directive for your compiler - it is not a keyword nor a variable nor a type.
What Polyspace needs to see for the PINT function pointer type definition to work is
 
typedef void(*PINT)(void);
Hence, to achieve this enter the following as a macro in the Configuration > Target & Compiler > Macros > Preprocessor definitions :
interrupt=
NOTE: No spaces before or after, or in between 'interrupt' and '='
So with this Macro set as above, Polyspace will remove all occurences of 'interrupt' keyword from the source code. As Polyspace does static code analysis, it is ok to do so.
If you have multiple interrupt functions, and removing the keyword is not the way to move forward, please refer to more information on adding interrupts in Polyspace analysis. Please go through the Polyspace documentation to setup your source code accordingly: in the documentation, search for entry-points.