主要内容

hisl_0052: Configuration Parameters > Code Generation > Optimization > Data initialization

R2026b

Explicitly initialize data variables in generated code for fully defined data

Usage: High-Integrity System Modeling

Guideline ID: hisl_0052

Rules

hisl_0052: Configuration Parameters > Code Generation > Optimization > Data initialization

Explicitly initialize variables for models that are configured with these model configuration parameter settings:

  • System target file set to an ERT-based system target file other than autosar.tlc

  • Code interface packaging is set to Nonreusable function or Reusable function.

For these models, you can configure code generation that completely defines data and initializes internal and external data to zero by clearing these model configuration parameters:

  • Remove root level I/O zero initialization

  • Remove internal data zero initialization

Rationale

Support fully defined data in generated code.

Verification

Check safety-related optimization settings for data initialization (Simulink Check)

Tips

  • If the target environment provides mechanisms to initialize I/O and state variables, consider using the target environment initialization mechanism instead of clearing the Remove root level I/O zero initialization and Remove internal data zero initialization parameters.

  • If a model is configured with a data code interface:

    • For data that is mapped to a storage class that has imported data scope, Simulink selects Remove root level I/O zero initialization parameter. Imported data is not defined by the generated code and zero initialization of such data is the responsibility of the target environment.

    • For data that is mapped to a storage class with exported data scope, clear the Remove root level I/O zero initialization parameter.

  • If a model is configured to use a service code interface, Simulink selects the Remove root level I/O zero initialization parameter for root-level inports and outports that are mapped to a service interface configured with the outside-execution or during-execution data communication method. The target environment defines the data for communication and is responsible for initialization. If a service interface is configured to use direct access the data communication method, the code generator applies storage classes, which results in data interface behavior.

Industry Standards

  • DO-331, Section MB.6.3.3.b 'Software architecture is consistent'

  • IEC 61508-3, Table A.4 (3) 'Defensive Programming'

  • IEC 62304, 5.5.3 - Software Unit acceptance criteria

  • ISO 26262-6, Table 1 (1d) 'Use of defensive implementation techniques'

    Table 6 (1c) 'Initialization of variables'

  • EN 50128, Table A.3 (1) 'Defensive Programming'

  • EN 50657, Table A.3 (1) 'Defensive Programming'

  • EN 50716, Table A.3 (1) 'Defensive Programming'

Version History

Introduced in R2010a

expand all