Main Content

Recommended Model Configuration Parameters for Polyspace Analysis

Before analyzing the generated code, check that your model configuration is optimized for a Polyspace® analysis. Set the following parameters to the recommended value. If you do not use the recommended value for SystemTargetFile, you get an error. For other parameters, if you do not use the recommended value, you get a warning.

GroupingCommand-LineName and Location in ConfigurationRationale for Recommendation
Code Generation

Name: SystemTargetFile (Simulink Coder)

Value: An Embedded Coder® Target Language Compiler (TLC) file.

For example ert.tlc or autosar.tlc.

Location: Code Generation

Name: System target file

Value: Embedded Coder target file

Polyspace supports targets based on ert.tlc or autosar.tlc.

Name: MatFileLogging (Simulink Coder)

Value: 'off'

Location: Code Generation > Interface

Name: MAT-file logging

Value: Not selected

Disabling MAT file logging enhances precision of Polyspace analysis

Name: GenerateSampleERTMain (Embedded Coder)

Value: 'off'

Location: Code Generation > Templates

Name: Generate an example main program

Value: Not selected

Polyspace removes the example main before analysis if an example main is generated.

Name: GenerateComments (Simulink Coder)

Value: 'on'

Location: Code Generation > Comments

Name: Include comments

Value: Selected

Including comments allow navigating from the generated code to the corresponding parts of the model. Additionally, Embedded Coder can insert comments that justify come coding rule violations automatically.
Optimization

Name: DefaultParameterBehavior (Simulink Coder)

Value: 'Inlined'

Location: Optimization

Name: Default parameter behavior

Value: Inlined

The value Inlined enhances precision of Polyspace analysis. If you want to specify external constraints on the parameters, set the value to Tunable.

Name: InitFltsAndDblsToZero (Simulink Coder)

Value: 'on'

Location: Optimization

Name: Use memset to initialize floats and doubles to 0.0

Value: Not selected

Using memset() to initialize floats and doubles to 0.0 can cause additional violations and orange checks in a Polyspace analysis.

Name: ZeroExternalMemoryAtStartup (Embedded Coder)

Value: 'off'

Location: Optimization

Name: Remove root level I/O zero initialization

Value: Selected

Not selecting this configuration parameter can result in false positive violations or more orange checks.
Solver

Name: SolverType (Simulink)

Value: 'Fixed-Step'

Location: Solver

Name: Type

Value: Fixed-step

Using fixed step solvers enhances the precision of Polyspace analysis.

Name: Solver (Simulink)

Value: 'FixedStepDiscrete'

Location: Solver

Name: Solver

Value: discrete (no continuous states)

Using discrete solvers enhances the precision of Polyspace analysis.

In addition to setting the preceding model configuration parameters, you can use the Code generation Advisor to check the compatibility of your model with a Polyspace analysis of the generated code. See Analyze Code and Perform Software-in-the-Loop Testing (Simulink Check).