pslinkoptions
Create an options object to customize configuration of a Simulink model, generated code or a S-Function block. Use the object to specify configuration options for these Simulink objects in a Polyspace run from the MATLAB command line
Description
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 Bug Finder).
Examples
Create generic options object for code generated by Embedded Coder
This example shows how you can create a generic Polyspace options object that is suitable for analyzing code generated by using Embedded Coder. This options object is prepopulated with appropriate Embedded Coder parameters. Edit the options object to modify the generic analysis.
Create a new Polyspace configuration object new_opt
by calling the function pslinkoptions
and specify 'ec'
as the input argument.
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' VerifAllSFcnInstances: 0
By default, this options object uses the same verification settings that you specify in the Polyspace project. To check MISRA C® 2012 coding rule violations in addition to the existing verifications specified in the project, run this code at the MATLAB command line:
new_opt.VerificationSettings = 'PrjConfigAndMisraC2012'
new_opt = ResultDir: 'results_$ModelName$' VerificationSettings: 'PrjConfigAndMisraC2012' 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' VerifAllSFcnInstances: 0
When you start the Polyspace analysis of the generated code, you might want to open the Polyspace User Interface to follow the progress of the and to review the results afterwards. To open the Polyspace interface when you start the analysis, run this code:
new_opt.OpenProjectManager = true
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' VerifAllSFcnInstances: 0
Create and edit options object to modify Polyspace configuration
This example shows how you can store the Polyspace configurations of a Simulink model in to an object, and use the object to edit the configuration options.
Load the model closed_loop_control
.
load_system('closed_loop_control');
To create an object containing the Polyspace configurations of the model, call pslinkoptions
.
model_opt = pslinkoptions('closed_loop_control')
model_opt = ResultDir: 'results_$ModelName$' VerificationSettings: 'PrjConfig' OpenProjectManager: 0 AddSuffixToResultDir: 0 EnableAdditionalFileList: 0 AdditionalFileList: {} VerificationMode: 'BugFinder' EnablePrjConfigFile: 0 PrjConfigFile: '' AddToSimulinkProject: 0 InputRangeMode: 'DesignMinMax' ParamRangeMode: 'None' OutputRangeMode: 'None' ModelRefVerifDepth: 'Current model only' ModelRefByModelRefVerif: 0 AutoStubLUT: 1 CxxVerificationSettings: 'PrjConfig' CheckConfigBeforeAnalysis: 'OnWarn' VerifAllSFcnInstances: 0 ModelRefIgnoreList: [] EnableModelRefIgnoreList: 0 ModelRefMinMaxVerif: 'CheckAndConstrain'
The model is already configured for Embedded Coder®, so only the Embedded Coder configuration options appear as the fields of the object model_opt
.
To modify a Polyspace configuration option, set the corresponding field of model_opt
. For instance, change the results directory and set the verification mode to CodeProver
by modifying fields : model_opt.ResultDir
and model_opt.VerificationMode
, respectively.
model_opt.ResultDir = 'results_v1_$ModelName$'; model_opt.VerificationMode = 'CodeProver'
model_opt = ResultDir: 'results_v1_$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' VerifAllSFcnInstances: 0 ModelRefIgnoreList: [] EnableModelRefIgnoreList: 0 ModelRefMinMaxVerif: 'CheckAndConstrain'
Create and edit an options object for TargetLink at the command line
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
Input Arguments
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 pslinkoptions Properties (Polyspace Bug Finder).
Example: ec_opt = pslinkoptions('ec')
Example: tl_opt = pslinkoptions('tl')
Data Types: char
model
— Simulink model name
model name
Simulink 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 pslinkoptions Properties (Polyspace Bug Finder).
Example: model_opt = pslinkoptions('my_model')
Data Types: char
sfunc
— path to S-Function
character vector
Path 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 pslinkoptions Properties (Polyspace Bug Finder).
Example: sfunc_opt = pslinkoptions('path/to/sfunction')
Data Types: char
Output Arguments
opts
— Polyspace configuration options
options object
Polyspace configuration options, returned as an options
object. The object is used with pslinkrun
to run Polyspace from
the MATLAB command line.
You can specify many properties of a Polyspace analysis using a pslinkoptions
object. For the list of
object properties, see pslinkoptions Properties (Polyspace Bug Finder).
The properties you specify using a pslinkoption
object is a
subset of Polyspace analysis options. Additional properties can be specified using the class
polyspace.ModelLinkOptions
(Polyspace Bug Finder). This class allows you to
specify properties a polyspace.Project
(Polyspace Bug Finder) object to run analysis on
generated code. You can create a polyspace.ModelLinkOptions
object by
using an existing pslinkoptions
object.
Example: opts= pslinkoptions('ec')
opts.VerificationSettings
= 'Misra'
Version History
Introduced in R2012a
See Also
pslinkoptions Properties (Polyspace Bug Finder)
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)