how do I handle interrupts in code analysis using Polyspace for C/C++?

12 views (last 30 days)
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?

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 27 Mar 2015
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.
 

More Answers (0)

Tags

No tags entered yet.

Products


Release

R2012b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!