Configure Advanced Polyspace Options in MATLAB Coder App
Before analyzing generated code with Polyspace® in the MATLAB Coder App, you can change some of the default options. This topic shows how to configure the options and save this configuration.
For getting started with Polyspace analysis in the MATLAB Coder App, see Run Polyspace on C/C++ Code Generated from MATLAB Code.
Configure Options
The default analysis runs Code Prover based on a default project configuration.
The results are stored in a folder
result_
in the
current working folder.project_name
You can change these options in the MATLAB Coder App itself:
Product mode: Select Code Prover or Bug Finder.
Results type: Check for MISRA C™:2004 (MISRA AC AGC) or MISRA C:2012 rule violations, in addition to or instead of the default checkers.
Output folder: Choose an output folder name. To save the results of each run in a new folder, under Advanced Settings, select Make output folder name unique by adding a suffix.
Check code generation options: Choose to see warnings or errors if the code generation uses options that can result in imprecise Code Prover analysis.
For instance, if the code generation setting Use memset to initialize floats and doubles to 0.0 is disabled, Code Prover can show imprecise orange checks because of approximations. See Orange Checks in Polyspace Code Prover.
To see the other default options or update them, under Advanced Settings, click the Configure button. You see the options on a Configuration pane.
For more information on the options, see Bug Finder Analysis Options or Code Prover Analysis Options.
Share and Reuse Configuration
If you change some of the default options in the
Configuration pane, your updated configuration is saved as
a .psprj
file in the results folder. Using this file, you can
reuse your configuration across multiple MATLAB Coder projects.
Reuse Configuration in Coder App
To reuse a previous configuration in the current project opened in the MATLAB
Coder App, under Advanced Settings, select Reuse
existing configuration. For Template configuration
file, provide the .psprj
file that stores the
previous configuration.
The Results type option in the MATLAB Coder app still shows Based on Polyspace configuration but the configuration used is the one that you provided.
Reuse Configuration on Command Line
At the MATLAB® command line, you create an options object with the pslinkoptions
function. You modify the analysis options by using
the properties of this object and then run analysis with the pslinkrun
function.
opts = pslinkoptions('ec'); ... pslinkrun('-codegenfolder', codegenFolder, opts);
You can associate advanced analysis options set in a .psprj
file with the options object. Use the properties
EnablePrjConfigFile
and
PrjConfigFile
.
opts.EnablePrjConfigFile = true; opts.PrjConfigFile = 'C:\Polyspace\config.psprj';