| Real-Time Workshop® | ![]() |

| On this page… |
|---|
Support: floating-point numbers Support: non-inlined S-functions Reusable code error diagnostic Suppress error status in real-time model data structure Create Simulink (S-Function) block |
Select the target software environment, output variable name modifier, and data exchange interface.
Specify a target-specific math library for your model.
Default: C89/C90 (ANSI)
Generates calls to the ISO/IEC 9899:1990 C standard math library for floating-point functions.
Generates calls to the ISO/IEC 9899:1999 C standard math library.
Generates calls to the GNU gcc math library, which provides C99 extensions as defined by compiler option -std=gnu99.
Note Additional Target function library values may be listed if you have created and registered target function libraries with the Real-Time Workshop® Embedded Coder™ software, or if you have licensed any Link or Target products. For more information on the Target function library values for Link or Target products, see your Link or Target product documentation. |
Before setting this parameter, verify that your compiler supports the library you want to use. If you select a parameter value that your compiler does not support, compiler errors can occur.
| Parameter: GenFloatMathFcnCalls |
| Type: string |
| Value: 'ANSI_C' | 'C99 (ISO)' | 'GNU99 (GNU)' |
| Default: 'ANSI_C' |
| Application | Setting |
|---|---|
| Debugging | No impact |
| Traceability | No impact |
| Efficiency | Any valid library |
| Safety precaution | No impact |
Specify the location for generating utility functions.
Default: Auto
Operates as follows:
When the model contains Model blocks, place utilities within the slprj/target/_sharedutils directory.
When the model does not contain Model blocks, place utilities in the build directory (generally, in model.c or model.cpp).
Directs code for utilities to be placed within the slprj directory in your working directory.
| Parameter: UtilityFuncGeneration |
| Type: string |
| Value: 'Auto' | 'Shared location' |
| Default: 'Auto' |
| Application | Setting |
|---|---|
| Debugging | Shared location (GRT) No impact (ERT) |
| Traceability | Shared location (GRT) No impact (ERT) |
| Efficiency | Shared location |
| Safety precaution | No impact |
Specify whether to generate floating-point data and operations.
Default: on
Generates floating-point data and operations.
Generates pure integer code. If you clear this option, an error occurs if the code generator encounters floating-point data or expressions. The error message reports offending blocks and parameters.
This parameter only appears for ERT-based targets.
Selecting this parameter enables Support: non-finite numbers and clearing this parameter disables Support: non-finite numbers.
This parameter must be the same for top-level and referenced models.
| Parameter: PurelyIntegerCode |
| Type: string |
| Value: 'on' | 'off' |
| Default: 'on' |
| Application | Setting |
|---|---|
| Debugging | No impact |
| Traceability | No impact |
| Efficiency | Off (for integer only) |
| Safety precaution | No impact |
Specify whether to generate and maintain integer counters for absolute and elapsed time values.
Default: on
Generates and maintains integer counters for blocks that require absolute or elapsed time values. Absolute time is the time from the start of program execution to the present time. An example of elapsed time is time elapsed between two trigger events.
If you select this option and the model does not include blocks that use time values, the target does not generate the counters.
Does not generate integer counters to represent absolute or elapsed time values. If you do not select this option and the model includes blocks that require absolute or elapsed time values, an error occurs during code generation.
This parameter only appears for ERT-based targets.
You must select this parameter if your model includes blocks that require absolute or elapsed time values.
| Parameter: SupportAbsoluteTime |
| Type: string |
| Value: 'on' | 'off' |
| Default: 'on' |
| Application | Setting |
|---|---|
| Debugging | No impact |
| Traceability | No impact |
| Efficiency | Off |
| Safety precaution | Off |
Specify whether to generate nonfinite data and operations.
Default: on
Generates nonfinite data (for example, NaN and Inf) and related operations.
Does not generate nonfinite data and operations. If you clear this option, an error occurs if the code generator encounters nonfinite data or expressions. The error message reports offending blocks and parameters.
This parameter only appears for ERT-based targets.
This parameter is enabled by Support: floating-point numbers.
This parameter must be the same for top-level and referenced models.
| Parameter: SupportNonFinite |
| Type: string |
| Value: 'on' | 'off' |
| Default: 'on' |
| Application | Setting |
|---|---|
| Debugging | No impact |
| Traceability | No impact |
| Efficiency | Off |
| Safety precaution | Off |
Specify whether to generate code for blocks that use continuous time.
Default: off
Generates code for blocks that use continuous time.
Does not generate code for blocks that use continuous time. If you do not select this option and the model includes blocks that use continuous time, an error occurs during code generation.
This parameter only appears for ERT-based targets.
This parameter must be on if your model includes blocks that require absolute or elapsed time values.
This parameter must be off when generating an S-function wrapper for an ERT target; the code generator does not support continuous time for this target scenario.
| Parameter: SupportContinuousTime |
| Type: string |
| Value: 'on' | 'off' |
| Default: 'off' |
| Application | Setting |
|---|---|
| Debugging | No impact |
| Traceability | No impact |
| Efficiency | Off |
| Safety precaution | Off |
Specify whether to generate complex data and operations.
Default: on
Generates complex numbers and related operations.
Does not generate complex data and related operations. If you clear this option, an error occurs if the code generator encounters complex data or expressions. The error message reports offending blocks and parameters.
This parameter only appears for ERT-based targets.
This parameter must be the same for top-level and referenced models.
| Parameter: SupportComplex |
| Type: string |
| Value: 'on' | 'off' |
| Default: 'off' |
| Application | Setting |
|---|---|
| Debugging | No impact |
| Traceability | No impact |
| Efficiency | Off (for real only) |
| Safety precaution | No impact |
Specify whether to generate code for noninlined S-functions.
Default: Off
Generates code for noninlined S-functions.
Does not generate code for noninlined S-functions. If this parameter is off and the model includes a noninlined S-function, an error occurs during the build process.
Inlining S-functions is highly advantageous in production code generation, for example, for implementing device drivers. In such cases, clear this option to enforce use of inlined S-functions for code generation.
Noninlined S-functions require additional memory and computation resources, and can result in significant performance issues. Consider using an inlined S-function when efficiency is a concern.
This parameter only appears for ERT-based targets.
Selecting this parameter also selects Support: floating-point numbers and Support: non-finite numbers. If you clear Support: floating-point numbers or Support: non-finite numbers, a warning is displayed during code generation because these parameters are required by the S-function interface.
| Parameter: SupportNonInlinedSFcns |
| Type: string |
| Value: 'on' | 'off' |
| Default: 'off' |
| Application | Setting |
|---|---|
| Debugging | No impact |
| Traceability | No impact |
| Efficiency | Off |
| Safety precaution | Off |
Specify whether to generate model function calls compatible with the main program module of the GRT target.
Default: off
Generates model function calls that are compatible with the main program module of the GRT target (grt_main.c or grt_main.cpp).
This option provides a quick way to use ERT target features with a GRT-based custom target that has a main program module based on grt_main.c or grt_main.cpp.
Disables the GRT compatible call interface.
The following are unsupported:
Data type replacement
Nonvirtual subsystem option Function with separate data
This parameter only appears for ERT-based targets.
Selecting this parameter also selects the required option Support: floating-point numbers. If you subsequently clear Support: floating-point numbers, an error is displayed during code generation.
Selecting this parameter disables the incompatible option Single output/update function. Clearing this parameter enables Single output/update function.
| Parameter: GRTInterface |
| Type: string |
| Value: 'on' | 'off' |
| Default: 'off' |
| Application | Setting |
|---|---|
| Debugging | No impact |
| Traceability | Off |
| Efficiency | Off |
| Safety precaution | Off |
Support for Continuous Time Blocks, Continuous Solvers, and Stop Time
Specify whether to generate the model_step function.
Default: on
Generates the model_step function for a model. This function contains the output and update function code for all blocks in the model and is called by rt_OneStep to execute processing for one clock period of the model at interrupt level.
Does not combine output and update function code for model blocks in a single function. Generates the code in model.output and model.update.
Errors or unexpected behavior can occur if a Model block is part of a cycle, the Model block is a direct feedthrough block, and an algebraic loop results. See Model Blocks and Direct Feedthrough for details.
This parameter only appears for ERT-based targets.
This parameter and GRT compatible call interface are mutually incompatible and cannot both be selected through the GUI. Selecting GRT compatible call interface disables this parameter and clearing GRT compatible call interface enables this parameter.
When you use this parameter, you must clear the option Minimize algebraic loop occurrences on the Model Referencing pane.
| Parameter: CombineOutputUpdateFcns |
| Type: string |
| Value: 'on' | 'off' |
| Default: 'on' |
| Application | Setting |
|---|---|
| Debugging | On |
| Traceability | On |
| Efficiency | On |
| Safety precaution | On |
Specify whether to generate the model_terminate function.
Default: on
Generates a model_terminate function. This function contains all model termination code and should be called as part of system shutdown.
Does not generate a model.terminate function. Suppresses the generation of this function if you designed your application to run indefinitely and does not require a terminate function.
This parameter only appears for ERT-based targets.
This parameter must be the same for top-level and referenced models.
| Parameter: IncludeMdlTerminateFcn |
| Type: string |
| Value: 'on' | 'off' |
| Default: 'on' |
| Application | Setting |
|---|---|
| Debugging | No impact |
| Traceability | No impact |
| Efficiency | Off |
| Safety precaution | Off |
Specify whether to generate reusable, reentrant code.
Default: off
Generates reusable, multi-instance code that is reentrant. The code generator passes model data structures (root-level inputs and outputs, block states, parameters, and external outputs) in, by reference, as arguments to model_step and other the model entry point functions. The data structures are also exported with model.h. For efficiency, the code generator passes in only data structures that are used. Therefore, when you select this option, the argument lists generated for the entry point functions vary according to model requirements.
Does not generate reusable code. Model data structures are statically allocated and accessed by model entry point functions directly in the model code.
Entry points are exported with model.h. To call the entry-point functions from hand-written code, add an #include model.h directive to the code. If this option is selected, you must examine the generated code to determine the calling interface required for these functions.
When this option is selected, the code generator generates a pointer to the real-time model object (model_M).
In some cases, when this option is selected, the code generator might generate code that compiles but is not reentrant. For example, if any signal, DWork structure, or parameter data has a storage class other than Auto, global data structures are generated.
This parameter only appears for ERT-based targets.
This parameter enables Reusable code error diagnostic and Pass root-level I/O as.
You must clear this option if you are using:
The static ert_main.c module, rather than generating a main program
The model_step function prototype control capability
The subsystem parameter Function with separate data
A subsystem that
Has multiple ports that share the same source
Has a port used by multiple instances has different sample times, data types, complexity, frame status, or dimension across the instances
Has output marked as a global signal
For each instance contains identical blocks with different names or parameter settings
This parameter has no effect on code generated for function-call subsystems.
| Parameter: MultiInstanceERTCode |
| Type: string |
| Value: 'on' | 'off' |
| Default: 'on' |
| Application | Setting |
|---|---|
| Debugging | No impact |
| Traceability | No impact |
| Efficiency | On (for single instance) |
| Safety precaution | No impact |
Select the severity level for diagnostics displayed when a model violates requirements for generating reusable code.
Default: Error
Proceed with build without displaying a diagnostic message.
Proceed with build after displaying a warning message.
Abort build after displaying an error message.
Under certain conditions, the Real-Time Workshop Embedded Coder software might
Generate code that compiles but is not reentrant. For example, if signal, DWork structure, or parameter data has a storage class other than Auto, global data structures are generated.
Be unable to generate valid and compilable code. For example, if the model contains an S-function that is not code-reuse compliant or a subsystem triggered by a wide function-call trigger, the coder generates invalid code, displays an error message, and terminates the build.
This parameter only appears for ERT-based targets.
This parameter is enabled by Generate reusable code.
| Parameter: MultiInstanceErrorCode |
| Type: string |
| Value: 'None' | 'Warning' | 'Error' |
| Default: 'Error' |
| Application | Setting |
|---|---|
| Debugging | Warning or Error |
| Traceability | No impact |
| Efficiency | None |
| Safety precaution | No impact |
Control how root-level model input and output are passed to the model_step function.
Default: Individual arguments
Passes each root-level model input and output value to model_step as a separate argument.
Packs all root-level model input into a struct and passes struct to model_step as an argument. Similarly, packs root-level model output into a second struct and passes it to model_step.
This parameter only appears for ERT-based targets.
This parameter is enabled by Generate reusable code.
| Parameter: RootIOFormat |
| Type: string |
| Value: 'Individual arguments' | 'Structure reference' |
| Default: 'Individual arguments' |
| Application | Setting |
|---|---|
| Debugging | No impact |
| Traceability | No impact |
| Efficiency | No impact |
| Safety precaution | No impact |
Specify whether to log or monitor error status.
Default: off
Omits the error status field from the generated real-time model data structure rtModel. This option reduces memory usage.
Selecting this option can cause the code generator to completely omit the rtModel data structure from generated code.
Includes an error status field in the generated real-time model data structure rtModel. You can use available macros to monitor the field for or set it with error message data.
This parameter only appears for ERT-based targets.
This parameter is cleared if you select the incompatible option MAT-file logging. If you subsequently select this parameter, an error is displayed during code generation.
Selecting this parameter clears Support: continuous time.
Setting of this parameter for multiple integrated models must match to avoid unexpected application behavior. For example, if you select the option for one model but not in another, an error status might not get registered by the integrated application.
| Parameter: SuppressErrorStatus |
| Type: string |
| Value: 'on' | 'off' |
| Default: 'off' |
| Application | Setting |
|---|---|
| Debugging | Off |
| Traceability | No impact |
| Efficiency | On |
| Safety precaution | On |
Use the Configure Step Function button to open the Model Interface dialog box. This dialog box provides a way for you to specify whether the code generator is to use a default model_step function prototype or a model-specific C prototype. Based on your selection, you can preview and modify the function prototype.
This parameter only appears for ERT-based targets.
Specify whether to generate an S-function block.
Default: off
Generates an S-function block to represent the model or subsystem. The coder generates an inlined C or C++ MEX S-function wrapper that calls existing hand-written code or code previously generated by the Real-Time Workshop software from within the Simulink® product. S-function wrappers provide a standard interface between the Simulink product and externally written code, allowing you to integrate your code into a model with minimal modification.
When this option is selected, the Real-Time Workshop software:
Generates the S-function wrapper file model_sf.c (or .cpp) and places it in the build directory.
Builds the MEX-file model_sf.mexext and places it in your working directory.
Creates and opens an untitled model containing the generated S-Function block.
Does not generate an S-function block.
This parameter only appears for ERT-based targets.
| Parameter: GenerateErtSFunction |
| Type: string |
| Value: 'on' | 'off' |
| Default: 'off' |
| Application | Setting |
|---|---|
| Debugging | On |
| Traceability | No impact |
| Efficiency | No impact |
| Safety precaution | No impact |
Specify whether to allow portability across host and target processors that support different word sizes.
Default: off
Generates conditional processing macros that support compilation of generated code on a processor that supports a different word size than the target processor on which production code is intended to run (for example, a 32-bit host and a 16-bit target. This allows you to use the same generated code for both software-in-the-loop (SIL) testing on the host platform and production deployment on the target platform.
Does not generate portable code.
This parameter only appears for ERT-based targets.
When you use this parameter, you should:
Select Create Simulink (S-Function) block
Set Emulation hardware on the Hardware Implementation pane to None
| Parameter: PortableWordSizes |
| Type: string |
| Value: 'on' | 'off' |
| Default: 'off' |
| Application | Setting |
|---|---|
| Debugging | On |
| Traceability | On |
| Efficiency | Off |
| Safety precaution | No impact |
Specify whether to enable MAT-file logging.
Default: off
Enables MAT-file logging. When you select this option, the code generator saves system states, output, and simulation time at each model execution time step. The data is written to a MAT-file, named (by default) model.mat, where model is the name of your model.
Disables MAT-file logging. Clearing this option has the following benefits:
Eliminates overhead associated with supporting a file system, which typically is not needed for embedded applications
Eliminates extra code and memory usage required to initialize, update, and clean up logging variables
Under certain conditions, eliminates code and storage associated with root output ports
Omits the comparison between the current time and stop time in the model_step, allowing the generated program to run indefinitely, regardless of the stop time setting
This parameter only appears for ERT-based targets and the Tornado target.
Selecting this parameter also selects the required options Support: floating-point numbers, Support: non-finite numbers, and Terminate function required. If you subsequently clear Support: floating-point numbers, Support: non-finite numbers, or Terminate function required, an error is displayed during code generation.
Selecting this parameter clears the incompatible option Suppress error status in real-time model data structure. If you subsequently select Suppress error status in real-time model data structure, an error is displayed during code generation.
Selecting this parameter enables MAT-file variable name modifier.
Clear this option if you are using exported function calls.
| Parameter: MatFileLogging |
| Type: string |
| Value: 'on' | 'off' |
| Default: 'off' |
| Application | Setting |
|---|---|
| Debugging | On |
| Traceability | No impact |
| Efficiency | Off |
| Safety precaution | Off |
Select the string to add to MAT-file variable names.
Default: rt_
Adds a prefix string.
Adds a suffix string.
Does not add a string.
| Parameter: LogVarNameModifier |
| Type: string |
| Value: 'none' | 'rt_' | '_rt' |
| Default: 'rt_' |
| Application | Setting |
|---|---|
| Debugging | No impact |
| Traceability | No impact |
| Efficiency | No impact |
| Safety precaution | No impact |
Specify the data exchange interface (API) to include.
Default: None
Does not include an API in the generated code.
Uses the C-API data interface.
Uses an external data interface.
Uses the ASAP2 data interface.
Selecting C-API enables the following parameters:
Signals in C API
Parameters in C API
Selecting External mode enables the following parameters:
Transport layer
MEX-file arguments
Static memory allocation
| Parameter: see table |
| Type: string |
| Value: 'on' | 'off' |
| Default: 'off' |
| To enable... | Set this parameter... | To this value... |
|---|---|---|
| none | RTWCAPIParams, RTWCAPISignals, ExtMode, GenerateASAP2 | 'off' |
| C API | RTWCAPIParams | RTWCAPISignals | 'on' |
| External mode | ExtMode | 'on' |
| ASAP2 | GenerateASAP2 | 'on' |
| Application | Setting |
|---|---|
| Debugging | No impact |
| Traceability | No impact |
| Efficiency | No impact |
| Safety precaution | No impact during development None for production code generation |
Generate a C API signal structure.
Default: on
Generates C API for global block outputs.
Does not generate C API signals.
This parameter is enabled by selecting Interface > C-API.
| Parameter: RTWCAPISignals |
| Type: string |
| Value: 'on' | 'off' |
| Default: 'off' |
| Application | Setting |
|---|---|
| Debugging | No impact |
| Traceability | No impact |
| Efficiency | No impact |
| Safety precaution | No impact |
C-API for Interfacing with Signals and Parameters
Generate C API parameter tuning structures.
Default: on
Generates C API for global block and model parameters.
Does not generate C API parameters.
This parameter is enabled by selecting Interface > C-API.
| Parameter: RTWCAPIParams |
| Type: string |
| Value: 'on' | 'off' |
| Default: 'off' |
| Application | Setting |
|---|---|
| Debugging | No impact |
| Traceability | No impact |
| Efficiency | No impact |
| Safety precaution | No impact |
C-API for Interfacing with Signals and Parameters
Specify the transport protocol for external mode communications.
Default: tcpip
Applies a TCP/IP transport mechanism. The MEX-file name is ext_comm.
Applies a serial transport mechanism. The MEX-file name is ext_serial_win32_comm.
The MEX-file name displayed next to Transport layer cannot be edited in the Configuration Parameters dialog box. The value is specified either in matlabroot/toolbox/simulink/simulink/extmode_transports.m, for targets provided by The MathWorks, or in an sl_customization.m file, for custom targets and/or custom external mode transports.
This parameter is enabled by selecting External mode in the Interface parameter.
| Parameter: ExtModeTransport |
| Type: integer |
| Value: 0 | 1 |
| Default: 0 |
| Application | Setting |
|---|---|
| Debugging | No impact |
| Traceability | No impact |
| Efficiency | No impact |
| Safety precaution | No impact |
Specify arguments to pass to an external mode interface MEX-file for communicating with executing targets.
Default: ""
For TCP/IP interfaces, ext_comm allows three optional arguments:
Network name of your target (for example, 'myPuter' or '148.27.151.12')
Verbosity level (0 for no information or 1 for detailed information)
TCP/IP server port number (an integer value between 256 and 65535, with a default of 17725)
For a serial transport, ext_serial_win32_comm allows three optional arguments:
Verbosity level (0 for no information or 1 for detailed information)
Serial port ID (for example, 1 for COM1, and so on)
Baud rate (selected from the set 1200, 2400, 4800, 9600, 14400, 19200, 38400, 57600, 115200, with a default baud rate of 57600)
Depending on the specified target, this parameter is enabled by Data Exchange > Interface > External mode or by External Mode.
| Parameter: ExtModeMexArgs |
| Type: string |
| Value: any valid arguments |
| Default: "" |
| Application | Setting |
|---|---|
| Debugging | No impact |
| Traceability | No impact |
| Efficiency | No impact |
| Safety precaution | No impact |
Control memory buffer for external mode communication.
Default: off
Enables the Static memory buffer size parameter for allocating dynamic memory.
Uses a static memory buffer for external mode instead of allocating dynamic memory (calls to malloc).
To determine how much memory you need to allocate, select verbose mode on the target to display the amount of memory it tries to allocate and the amount of memory available.
Depending on the specified target, this parameter is enabled by Data Exchange > Interface > External mode or by External Mode.
This parameter enables Static memory buffer size.
| Parameter: ExtModeStaticAlloc |
| Type: string |
| Value: 'on' | 'off' |
| Default: 'off' |
| Application | Setting |
|---|---|
| Debugging | No impact |
| Traceability | No impact |
| Efficiency | No impact |
| Safety precaution | No impact |
External Mode Interface Options
Specify the memory buffer size for external mode communication.
Default: 1000000
Enter the number of bytes to preallocate for external mode communications buffers in the target.
If you enter too small a value for your application, external mode issues an out-of-memory error.
To determine how much memory you need to allocate, select verbose mode on the target to display the amount of memory it tries to allocate and the amount of memory available.
This parameter is enabled by Static memory allocation.
| Parameter: ExtModeStaticAllocSize |
| Type: integer |
| Value: any valid value |
| Default: 1000000 |
| Application | Setting |
|---|---|
| Debugging | No impact |
| Traceability | No impact |
| Efficiency | No impact |
| Safety precaution | No impact |
External Mode Interface Options
![]() | Real-Time Workshop Pane: Debug | Real-Time Workshop Pane: RSim Target | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |