Real-Time Workshop Embedded Coder | ![]() ![]() |
To access the basic code generation options, select the Real-Time Workshop tab of the Simulation Parameters dialog box. Then select ERT code generation options (1)
from the Category menu.
Figure 3-1 displays the basic code generation options (with default settings) for the Real-Time Workshop Embedded Coder.
Figure 3-1: Basic Code Generation Options
Setting the basic code generation options as follows will result in more highly optimized code:
However, be aware that if Initialize internal data is turned off, it is not guaranteed that memory will be in a known state each time the generated code begins execution. If you turn the option off, running a model (or a generated S-function) multiple times can result in different answers for each run.
This behavior is sometimes desirable. For example, you can turn off Initialize internal data if you want to test the behavior of your design during a warm boot (i.e., a restart without full system reinitializiation).
In cases where you have turned off Initialize internal data but still want to get the same answer on every run from a Real-Time Workshop Embedded Coder generated S-function, you can use either of the following MATLAB commands before each run:
A related option, Initialize floats and doubles to 0.0, lets you control the representation of zero used during initialization. See Initialize Floats and Doubles to 0.0.
Note that the code still initializes data structures whose value is not zero when Initialize internal data and Initialize external I/O data are selected.
Note also that data of ImportedExtern
or ImportedExternPointer
storage classes is never initialized, regardless of the settings of these options.
model
_step
call, which reduces overhead and allows Real-Time Workshop to use more local variables in the step function of the model.
model
_
step function does not check the current time against the stop time. Therefore the generated program runs indefinitely, regardless of the setting of the model's stop time. The ert_main
program displays a message notifying the user that the program will run indefinitely.
![]() | Controlling and Optimizing the Generated Code | Virtualized Output Ports Optimization | ![]() |