Check safety-related optimization settings for data initialization
mathworks.hism.hisl_0052
Dependencies: Simulink® Check™
Usage: High-Integrity System Modeling
Guideline: hisl_0052: Configuration Parameters > Optimization > Data initialization
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.
Recommended Actions and Results
Review the violations that are flagged by the check and the recommended action for fixing the issue. After applying the changes, save the model and rerun the check analysis.
If you consider the flagged violation to either not be relevant or not feasible for your design, use the Justify button to provide rationale as to why the violation is either not relevant or not feasible for your design.
You can use the Fix button to allow the Model Advisor to fix all flagged violations. For this check, the Model Advisor configures model code generation settings that can impact safety.
Modeling Condition | Recommended 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. |
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 require model compilation
Does not run on library models
Does not allow exclusions of blocks or charts
Does not highlight parameter names in report without Embedded Coder
Version History
Introduced in R2020a
See Also
Optimize Generated Code Using Minimum and Maximum Values (Embedded Coder)
Topics
- Check Your Model Using the Model Advisor
- Address Model Check Results
- Save and View Model Advisor Check Reports
- Improve Simulation Performance Using Performance Advisor
- Upgrade Models Using Upgrade Advisor
- Use Model Advisor Configuration Editor to Customize Model Advisor
- Exclude Blocks from Model Advisor Check Analysis
- Justify Model Advisor Violations from Check Analysis
- Check Model Compliance Using Edit-Time Checking