Remove root level I/O zero initialization

Description

Specify whether to generate initialization code for root-level inports and outports set to zero.

Category: Optimization

Settings

Default: The Remove root level I/O zero initialization check box is selected and at the command line, ZeroExternalMemoryAtStartup is set to 'off' when the Code interface packaging parameter is set to Nonreusable function. The Remove root level I/O zero initialization check box is cleared and at the command-line ZeroExternalMemoryAtStartup is set to 'on' when the Code interface packaging parameter is set to Reusable function or C++ Class.

On

Does not generate initialization code for root-level inports and outports set to zero.

During startup, standards-compliant C and C++ compilers initialize global data to zero negating the need to include zero initialization code for this data in the generated code. Standards-compliant compilers do not necessarily initialize dynamically allocated data and local variables to zero. Before selecting the Remove root level I/O zero initialization parameter confirm that your model meets the following conditions:

  • If your compiler is not standards compliant, confirm that it initializes global data to zero.

  • If you set the Code Interface packaging to Reusable function or C++ Class, confirm that data is either statically allocated or that dynamically allocated data is initialized to zero.

Off

Generates initialization code for root-level inports and outports.

If you set the Code interface packaging parameter to Reusable function and select the Use dynamic memory allocation for model initialization parameter, the Remove root level I/O zero initialization check box is cleared and ZeroExternalMemoryAtStartup is set to 'on'.

Note

Generated code never initializes data whose storage class has imported scope.

Dependencies

  • This parameter appears only for ERT-based targets.

  • This parameter requires a Embedded Coder® license when generating code.

Command-Line Information

Parameter: ZeroExternalMemoryAtStartup
Value: 'off' | 'on'
Default: 'off'

Note

The command-line values are reverse of the settings values. Therefore, 'on' in the command line corresponds to the description of “Off” in the settings section, and 'off' in the command line corresponds to the description of “On” in the settings section.

Recommended Settings

ApplicationSetting
DebuggingNo impact
TraceabilityNo impact
EfficiencyOn (GUI), off (command line) (execution, ROM), No impact (RAM)
Safety precautionNo recommendation

Related Topics