Main Content

Check safety-related optimization settings for data initialization

Check ID: mathworks.hism.hisl_0052

Check model configuration for optimization settings that can impact safety.

Description

This check verifies that model optimization configuration parameters are set optimally for generating code for a safety-related application. Although highly optimized code is desirable for most real-time systems, some optimizations can have undesirable side effects that impact safety.

Available with Simulink® Check™.

Results and Recommended Actions

ConditionRecommended Action
The optimization that suppresses the generation of initialization code for root-level inports and outports that are set to zero is selected. For safety-related code, you should explicitly initialize all variables.If you have an Embedded Coder® license and are using an ERT-based system target file, clear Configuration Parameter Remove root level I/O zero initialization (Embedded Coder) or set the parameter ZeroExternalMemoryAtStartup to on. Alternatively, confirm that your compiler is standards-compliant, as most modern C compilers initialize global data to zero. Or, integrate external, handwritten code that initializes all I/O variables to zero explicitly.
The optimization that suppresses the generation of initialization code for internal work structures, such as block states and block outputs that are set to zero, is selected. For safety-related code, you should explicitly initialize every variable.If you have an Embedded Coder license and are using an ERT-based system target file, clear Configuration Parameter Remove internal data zero initialization (Embedded Coder) or set the parameter ZeroInternalMemoryAtStartup to on. Alternatively, confirm that your compiler is standards-compliant, as most modern C compilers initialize global data to zero. Or, integrate external, handwritten code that initializes every state variable to zero explicitly.

Action Results

Clicking Modify Settings configures model optimization settings that can impact safety.

Subchecks depend on the results of the subchecks noted with D in the results table in the Model Advisor window.

Capabilities and Limitations

  • Does not run on library models.

  • Does not allow exclusions of blocks or charts.

  • Does not highlight parameter names in report without Embedded Coder.

See Also