Contenido principal

Verify model generated code (-main-generator)

Specify that a main function must be generated if it is not present in source files

Description

This option is automatically set if you run Polyspace® from Simulink® or MATLAB® on generated code. If you run Polyspace on generated code outside Simulink or MATLAB, set this option manually.

Specify that Polyspace must generate a main function if it does not find one in the source files.

Set Option

Set the option using one of these methods:

  • Polyspace Platform user interface (desktop products only): In your project configuration, on the Static Analysis tab, select the Run Time Errors node and then select this option. This option is visible only when you open the Polyspace Platform user interface from Simulink.

  • Command line and options file: Use the option -main-generator. See Command-Line Information.

Settings

This option is always enabled for code generated from models.

Polyspace generates a main function for the analysis. The generated main contains cyclic code that executes in a loop. The loop can run an unspecified number of times.

The main performs the following functions before the loop begins:

The main then performs the following functions in the loop:

Finally, the main calls the functions specified by Termination functions (-functions-called-after-loop).

Command-Line Information

Parameter: -main-generator
Default: Off
Example (Bug Finder): polyspace-bug-finder -sources file_name -main-generator ...
Example (Code Prover): polyspace-code-prover -sources file_name -main-generator ...
Example (Bug Finder Server): polyspace-bug-finder-server -sources file_name -main-generator ...
Example (Code Prover Server): polyspace-code-prover-server -sources file_name -main-generator ...