Main Content

pslinkoptions

Create options object to customize Polyspace runs from MATLAB command line

Description

example

opts = pslinkoptions(codegen) returns an options object with the configuration options for code generated by codegen.

example

opts = pslinkoptions(model) returns an options object with the configuration options for the Simulink® model.

opts = pslinkoptions(sfunc) returns an options object with the configuration options for the S-Function.

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).

Examples

collapse all

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

Input Arguments

collapse all

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

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 .

Example: model_opt = pslinkoptions('my_model')

Data Types: char

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 .

Example: sfunc_opt = pslinkoptions('path/to/sfunction')

Data Types: char

Output Arguments

collapse all

Polyspace 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'

See Also

(Polyspace Code Prover)

Introduced in R2012a