Remove internal data zero initialization
Description
Specify whether to generate initialization code for internal work structures, such as block states and block outputs, to zero.
Category: Optimization
Settings
Default: When you set the Code interface
packaging parameter to Nonreusable function
, the
Remove internal data zero initialization check box is selected. At
the command line, ZeroInternalMemoryAtStartup
is set to
'off'
. When you set the Code interface packaging
parameter to Reusable function
or C++
Class
, the Remove internal data zero initialization
check box is cleared and ZeroInternalMemoryAtStartup
is set to
'on'
.
On
Does not generate code that initializes internal work structures to zero.
During startup, standards-compliant C and C++ compilers initialize global data to zero, eliminating 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 leaving the Remove internal data zero initialization parameter selected, confirm that your model meets these 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
orC++ class
, confirm that data is either statically allocated or that dynamically allocated data is initialized to zero.
Generated code initializes data that you specify in an Initialize Function block, even if you select this parameter.
Off
Generates code that initializes internal work structures to zero.
Generated code does not initialize data whose storage class has imported scope, unless you specify that data in an Initialize Function block.
The Remove internal data zero initialization check box is cleared.
ZeroInternalMemoryAtStartup
is set to 'on'
and is
read-only for a model in which the Code interface packaging parameter
is set to C++ class
and you have selected the Use dynamic memory allocation for model initialization
parameter.
If you set the Code interface packaging parameter to
Reusable function
and select the Use dynamic memory allocation for model block instantiation
parameter, the Remove internal data zero initialization check box is
cleared and ZeroInternalMemoryAtStartup
is set to
'on'
.
Dependencies
This parameter appears only for ERT-based targets.
This parameter requires Embedded Coder® when generating code.
Command-Line Information
Parameter:
ZeroInternalMemoryAtStartup |
Value:
'off' | 'on' |
Default:
'off' |
Note
The command-line values are the reverse of the settings values. At the command line,
'on'
corresponds to the description of “Off” in the settings section.
'off'
corresponds to the description of “On” in the settings
section.
Recommended Settings
Application | Setting |
---|---|
Debugging | No impact |
Traceability | No impact |
Efficiency | On (GUI), off (command line), (execution, ROM), No
impact (RAM) |
Safety precaution | No recommendation |