Create options object to customize Polyspace runs from MATLAB command line
returns an options object with the configuration options for the S-Function.opts
= pslinkoptions(sfunc
)
Note
Before you run Polyspace® from MATLAB®, you must link your Polyspace and MATLAB installations. See Integrate Polyspace with MATLAB and Simulink (Polyspace Code Prover).
Load psdemo_model_link_sl and create a Polyspace® options object from the model:
load_system('psdemo_model_link_sl'); model_opt = pslinkoptions('psdemo_model_link_sl')
model_opt = ResultDir: 'results_$ModelName$' VerificationSettings: 'PrjConfig' OpenProjectManager: 1 AddSuffixToResultDir: 0 EnableAdditionalFileList: 0 AdditionalFileList: {} VerificationMode: 'CodeProver' EnablePrjConfigFile: 0 PrjConfigFile: '' AddToSimulinkProject: 0 InputRangeMode: 'DesignMinMax' ParamRangeMode: 'None' OutputRangeMode: 'None' ModelRefVerifDepth: 'All' ModelRefByModelRefVerif: 0 AutoStubLUT: 0 CxxVerificationSettings: 'PrjConfig' CheckConfigBeforeAnalysis: 'OnWarn'
The model is already configured for Embedded Coder®, so only the Embedded Coder configuration options appear.
Change the results folder name option and set OpenProjectManager
to
true.
model_opt.ResultDir = 'results_v1_$ModelName$';
model_opt.OpenProjectManager = true
model_opt = ResultDir: 'results_v1_$ModelName$' VerificationSettings: 'PrjConfig' OpenProjectManager: 1 AddSuffixToResultDir: 0 EnableAdditionalFileList: 0 AdditionalFileList: {} VerificationMode: 'CodeProver' EnablePrjConfigFile: 0 PrjConfigFile: '' AddToSimulinkProject: 0 InputRangeMode: 'DesignMinMax' ParamRangeMode: 'None' OutputRangeMode: 'None' ModelRefVerifDepth: 'All' ModelRefByModelRefVerif: 0 AutoStubLUT: 0 CxxVerificationSettings: 'PrjConfig' CheckConfigBeforeAnalysis: 'OnWarn'
Create a Polyspace® options object called new_opt
with Embedded Coder® parameters:
new_opt = pslinkoptions('ec')
new_opt = ResultDir: 'results_$ModelName$' VerificationSettings: 'PrjConfig' OpenProjectManager: 0 AddSuffixToResultDir: 0 EnableAdditionalFileList: 0 AdditionalFileList: {} VerificationMode: 'CodeProver' EnablePrjConfigFile: 0 PrjConfigFile: '' AddToSimulinkProject: 0 InputRangeMode: 'DesignMinMax' ParamRangeMode: 'None' OutputRangeMode: 'None' ModelRefVerifDepth: 'Current model only' ModelRefByModelRefVerif: 0 AutoStubLUT: 1 CxxVerificationSettings: 'PrjConfig' CheckConfigBeforeAnalysis: 'OnWarn'
To follow the progress in the Polyspace interface, set the
OpenProjectManager
option to true. Change the configuration to
check for both checks and MISRA C® 2012 coding rule violations:
new_opt.OpenProjectManager = true;
new_opt.VerificationSettings = 'PrjConfigAndMisraC2012'
new_opt = ResultDir: 'results_$ModelName$' VerificationSettings: 'PrjConfigAndMisraC2012' OpenProjectManager: 1 AddSuffixToResultDir: 0 EnableAdditionalFileList: 0 AdditionalFileList: {} VerificationMode: 'CodeProver' EnablePrjConfigFile: 0 PrjConfigFile: '' AddToSimulinkProject: 0 InputRangeMode: 'DesignMinMax' ParamRangeMode: 'None' OutputRangeMode: 'None' ModelRefVerifDepth: 'Current model only' ModelRefByModelRefVerif: 0 AutoStubLUT: 1 CxxVerificationSettings: 'PrjConfig' CheckConfigBeforeAnalysis: 'OnWarn'
Create a Polyspace® options object called new_opt
with TargetLink® parameters:
new_opt = pslinkoptions('tl')
new_opt = ResultDir: 'results_$ModelName$' VerificationSettings: 'PrjConfig' OpenProjectManager: 0 AddSuffixToResultDir: 0 EnableAdditionalFileList: 0 AdditionalFileList: {} VerificationMode: 'CodeProver' EnablePrjConfigFile: 0 PrjConfigFile: '' AddToSimulinkProject: 0 InputRangeMode: 'DesignMinMax' ParamRangeMode: 'None' OutputRangeMode: 'None' AutoStubLUT: 1
Set the OpenProjectManager
option to true to follow the progress
in the Polyspace interface. Also change the configuration to check for both run-time
errors and MISRA C® coding rule violations:
new_opt.OpenProjectManager = true;
new_opt.VerificationSettings = 'PrjConfigAndMisra'
new_opt = ResultDir: 'results_$ModelName$' VerificationSettings: 'PrjConfigAndMisra' OpenProjectManager: 1 AddSuffixToResultDir: 0 EnableAdditionalFileList: 0 AdditionalFileList: {} VerificationMode: 'CodeProver' EnablePrjConfigFile: 0 PrjConfigFile: '' AddToSimulinkProject: 0 InputRangeMode: 'DesignMinMax' ParamRangeMode: 'None' OutputRangeMode: 'None' AutoStubLUT: 1
codegen
— Code generator'ec'
| 'tl'
Code generator, specified as either 'ec'
for Embedded Coder or 'tl'
for TargetLink®.
Each argument creates a Polyspace options object with properties
specific to that code generator.
For a description of all configuration options and their values, see .
Example: ec_opt = pslinkoptions('ec')
Example: tl_opt = pslinkoptions('tl')
Data Types: char
model
— Simulink model nameSimulink model, specified by the model name. Creates a Polyspace options object with the configuration options of that model. If you have not set any options, the object has the default configuration options. If you have set a code generator, the object has the default options for that code generator.
For a description of all configuration options and their values, see .
Example: model_opt = pslinkoptions('my_model')
Data Types: char
sfunc
— path to S-FunctionPath to S-Function, specified as a character vector. Creates a Polyspace options object with the configuration options for the S-function. If you have not set any options, the object has the default configuration options.
For a description of all configuration options and their values, see .
Example: sfunc_opt = pslinkoptions('path/to/sfunction')
Data Types: char
opts
— Polyspace configuration optionsPolyspace configuration options, returned as an options
object. The object is used with pslinkrun
to run Polyspace from
the MATLAB command line.
For the list of object properties, see .
Example: opts= pslinkoptions('ec')
opts.VerificationSettings
= 'Misra'
pslinkoptions Properties (Polyspace Code Prover)