| Version 4.0 (R14) Real-Time Workshop® Embedded Coder™ Software Release Notes | ![]() |
This table summarizes what's new in Version 4.0 (R14):
| New Features and Changes | Version Compatibility Considerations | Fixed Bugs and Known Problems | Related Documentation at Web Site |
|---|---|---|---|
| Yes Details below | Yes—See Upgrading from R13SP1+ or R13SP2 and Generating R13SP1+ or R13SP2 Code From ERT-Based Simulink Models Created In R14 or Later. See also Summary. | Fixed bugs | No |
New features and changes introduced in this version are
The Real-Time Workshop Embedded Coder documentation collection has been expanded and includes following documents:
| User's Guide | Describes Embedded Real-Time (ERT) model execution, timing, and task management; the rtModel data structure; how to interface to and call model code; ERT code generation options and optimization tips; custom storage classes; and advanced code generation techniques. |
| Module Packaging Features | Describes features teams of engineers can apply to generate ANSI/ISO C production code and executables for large-scale, multimodel control system applications. |
| Developing Embedded Targets | Describes requirements and implementation details for creating custom embedded targets based on the ERT target. It includes detailed information on the structure and organization of target directories, system target files, and template makefiles; how to support the Real-Time Workshop model referencing feature; how to implement device drivers; and operation of the build process and how to customize it. |
You can configure ERT target code generation options in the new Simulink Model Explorer and Configuration Parameters dialog box. Before working with the ERT target in this new environment, you should become familiar with
Configuration sets and how to view and edit them in Model Explorer and the Configuration Parameters dialog box. See Using Simulink for details.
The general Real-Time Workshop code generation options and use of the System Target File Browser. See the Real-Time Workshop documentation for details.
Some panes of the new Configuration Parameters dialog box (for example, the Templates and Interface panes) contain only ERT-specific options. Others, such as the Real-Time Workshop pane, display a combination of general Real-Time Workshop options and ERT target options.
Note If you have developed a custom target based on the ERT target (or any other Real-Time Workshop target) see Defining and Displaying Custom Target Options for a discussion of compatibility issues that may affect the appearance and operation of your target. |
The following table summarizes new and revised ERT target code generation options.
Pane and Subpane | Option | Usage |
|---|---|---|
Real-Time Workshop | Include hyperlinks to model | Include or suppress hyperlinks from generated code to the source blocks in the model. |
Launch report after code generation completes | Automatically display the HTML report in a MATLAB web browser window after code generation. | |
Real-Time Workshop: Comments | Simulink block descriptions | Include text specified in the Description field of Block Properties dialogs as comments in the generated code for the corresponding blocks. |
Stateflow object descriptions | Include text specified in the Description field of state object Properties dialogs as comments in the generated code for the corresponding objects. | |
Simulink data object descriptions | Include text specified in the Description field of object properties defined in the Simulink Model Explorer as comments in the generated code for the corresponding objects. | |
Custom comments (mpt objects only) | Include comments just above signals and parameter identifiers in the generated code as specified in an M-code or TLC function. | |
Real-Time Workshop: Symbols | Symbol format | Customize generated symbols for signals, parameters, and other objects in a model based on a macro string that specifies whether and in what order substrings are to be included in the symbols. |
Minimum mangle length | Specify the minimum number of characters to be used for name mangling strings generated and applied to symbols to avoid name collisions. | |
Maximum identifier length | Specify the maximum number of characters that can be used in generated function, typedef, and variable names. | |
Generate scalar inline parameters as | Control how scalar inlined parameter values are expressed in generated code. | |
#define naming | Define rules that change the names of a model's parameters that have a storage class of Define. | |
Parameter naming | Define rules that change the names of all of a model's parameters. | |
Signal naming | Define rules that change the names of a model's signals. | |
Real-Time Workshop: Interface | Target floating-point math environment | Specify the math library to be used. Support for the GNU C math library was added as an option. |
Support floating-point numbers | Enable or suppress the generation of floating-point numbers. To generate pure integer code, clear this option. | |
Support complex numbers | Enable or suppress the generation of complex numbers. | |
Support non-finite numbers | Enable or suppress the generation of nonfinite numbers. | |
Support absolute time | Generate integer counters that provide absolute or elapsed time values for blocks in the model. | |
Support continuous time | Generate code for continuous time blocks. | |
Pass root-level I/O as | Control how input and output values at the root level of the model are passed to the model_step function. Enable only if you select Generate reusable code. | |
GRT compatible call interface | Use ERT features with a GRT-based custom target that has a main program based on grt_main.c. | |
Data Exchange: Interface | Generate external mode support code, ASAP2 data files, or C API code for monitoring signals and parameters. | |
Real-Time Workshop: Templates | Source file (*.c) template | Create or edit a code template. |
Source file (*.h) template | Create or edit a data template. | |
File customization template | Specify a custom file processing (CFP) template, which organizes generated code into sections -- includes, typedefs, functions, and so on. | |
Generate an example main program | Control whether ert_main.c is generated. | |
Target operating system | Generate a bareboard main program designed to run under control of a real-time clock without a real-time operation system or a fully commented example showing how to deploy the code under the VxWorks real-time operating system. | |
Real-Time Workshop: Data Placement | Data definition | Specify whether data is to be defined in the generated source file or in a single separate header file. |
Data reference | Specify whether data is to be declared in the generated source file or in a single separate header file | |
Module naming | Name the generated module using the same name as the model or a user-specified name. | |
Signal display level | Specify whether to declare signal data objects as global data in the generated code. | |
Parameter tune level | Declare a parameter data object as tunable global data in the generated code. | |
#include file delimiter | Specify the #include file delimiter to be used in generated files that contain the #include preprocessor directive for MPF data objects. | |
Source of initial values | Specify the source that initializes the model's signals in the generated code. | |
Optimization | Application lifespan (days) | Minimize the allocation of memory for absolute and elapsed time counters generated for blocks that require an absolute or elapsed time value. The word size of the counters is allocated optimally to accommodate the maximum value that you specify for this parameter. |
Remove root-level I/O zero initialization | Specify whether initialization code for root-level inports and outports with a value of zero are to be generated. Previously labeled Initialize external data. Default is now cleared rather than set. | |
Remove internal state zero initialization | Specify whether initialization code for work structures, such as block states and block outputs, are to be generated. Previously labeled Initialize internal data. Default is now cleared rather than set. | |
Use memset to initialize floats and doubles | Specify whether internal storage, regardless of type, is to be cleared to the integer bit pattern 0 or the memset function is to set float and double storage to 0.0. Previously labeled Initialize Floats and Doubles to 0.0. Default is now cleared rather than set. | |
Optimize initialization code for memory reference | Specify whether a model contains an enabled subsystem and will be referred to by another model with a Model block. If these conditions exist, the option should be cleared. | |
Remove code that protects against division arithmetic exceptions | Suppress generation of code that guards against fixed-point division by zero exceptions. |
Note The Symbol format option supports all functions previously implemented by the Prefix model name to global identifiers, Include system Hierarchy Number in Identifiers, and Include data type acronym in identifier options in a more compact form. The Symbol format option replaces all these options. However, existing models will continue to generate code that respects the settings of the previous options. |
Detailed descriptions of options specific to the ERT target are provided in:
The Code Generation Options and Optimizations chapter of the Real-Time Workshop Embedded Coder documentation.
The Module Packaging Features document.
Release 14 introduced Generic Real-Time (GRT) and Embedded Real-Time (ERT) target unification enhancements. The enhancements include the following changes to the underlying technology for Real-Time Workshop and Real-Time Workshop Embedded Coder.
Both products use a common format for backend generated code.
The feature list common to both products is expanded.
Some features and efficiencies formerly exclusive to the ERT target are now available to the GRT target. Conversely, the ERT target now supports some features that were previously available only with the GRT target.
Conversion from GRT-based targets to ERT-based targets is greatly simplified.
See the Version 6.0 (R14) Real-Time Workshop Release Notes for a high-level overview and comparison of feature enhancements and compatibility issues that result from target unification in Real-Time Workshop 6.0 and Real-Time Workshop Embedded Coder 4.0.
The ERT target now supports code generation for continuous time blocks. If you select the Support continuous time option in the Interface subpane under Real-Time Workshop on the Configuration Parameters dialog box, you can use any such blocks in your models, without restriction.
Note that use of certain continuous time blocks is not recommended for production code generation for embedded systems. The Simulink Block Data Type Support table summarizes characteristics of blocks in the Simulink and Fixed-Point block libraries, including whether or not they are recommended for use in production code generation. To view this table, execute the following MATLAB command:
showblockdatatypetable
Then, refer to the "Recommended for Production Code?" column of the table.
The ERT target now supports continuous solvers. You can select any solver from the Solver menu on the Solver pane of the Configuration Parameters dialog box. However, note that the solver Type must be fixed-step for use with the ERT target, as in previous releases.
Note Custom targets must be modified to support continuous time. The required modifications are described in Supporting Continuous Time in Custom Targets. |
In previous releases, the ERT target required that all S-functions in a model be inlined with a corresponding TLC file for code generation. This restriction has been removed. Models can now include noninlined S-functions.
To enable support for noninlined S-functions, select the Support non-inlined S-functions option in the Interface subpane under Real-Time Workshop on the Configuration Parameters dialog box.
Note that inlining S-functions is often advantageous in production code generation, for example in implementing device drivers. See Tradeoffs in Device Driver Development in the Developing Embedded Targets document for a discussion of the pros and cons.
Module Packaging Features (MPF) are a major subcomponent of the Real-Time Workshop Embedded Coder. These features enable teams of engineers to apply the Real-Time Workshop Embedded Coder for generating ANSI/ISO production code and executables for large-scale, multimodel control system applications.
The Module Packaging Features document describes these features in detail. This note summarizes the capabilities of MPF.
With MPF, you can
Package the generated code into the desired number of .c and .h files.
Control the internal organization of each of the generated files. For example, for readability, your company may have software standards that define where to place comments and sections of code within files.
Control whether or not the generated files contain definitions for a model's global identifiers. If such definitions exist, you determine the files in which the code generator places them. Also, you can specify the generated files where the code generator places global data (extern) declarations.
In addition to meeting the preceding packaging needs, you can use MPF to
Register user-defined data types.
Customize comments.
Locate variables in target memory where desired.
You implement these features with available dialogs, user-definable templates, and M-scripts.
This section summarizes the module packaging features introduced in Real-Time Workshop Embedded Coder Version 4.0. MPF allows you to
Select or define MPF template files. You can generate the desired .c and .h files and organize them the way you want. Also, these templates include template symbols whose locations in a template file determine where comments and code is located in the individual generated files.
Manage the code generation data dictionary. This allows
Registering user-defined data types
Importing data objects into the code generation data dictionary from a .mat file of a previous Simulink session or from an external data dictionary (such as an Excel file)
Adding Simulink data objects using the Data Object Wizard
Changing the alphabetical case and spellings that identifier names have in the generated code
Select additional miscellaneous and advanced options. These include
Instructing the code generator to use the angle-bracket delimiter (for multiple data objects), instead of the double-quotation delimiter.
Selecting the source that initializes each of the model's signals in the generated code.
Adding a selected data object's property values as a comment in a generated file above that data object's identifier.
Adding a comment to the model using the Simulink DocBlock so that this comment appears in the generated file where desired.
Manage file placement of data declarations. You can determine whether or not the generated files contain defining declarations for a model's global identifiers. If defining declarations exist, you can determine the files in which the code generator places them. Also, you can determine the files where the code generator places global data reference (extern) declarations.
ASAP2 file generation is now available to all Real-Time Workshop targets. The documentation for this feature has been relocated to Generating an ASAP2 File in the Real-Time Workshop documentation.
Real-Time Workshop Embedded Coder now supports user-defined data type objects in code generation. Supported objects include objects of the following classes:
Simulink.NumericType
Simulink.StructType
Simulink.Bus
Simulink.Aliastype
In code generation, you can use user-defined data type objects to map your own data type definitions to Simulink built-in data types, and to generate #include directives specifying your own header files, containing your data type definitions.
See the Advanced Code Generation Techniques chapter of the Real-Time Workshop Embedded Coder documentation for details.
The Real-Time Workshop Embedded Coder has extended the built-in storage classes provided by Real-Time Workshop. The Real-Time Workshop Embedded Coder now includes:
A set of custom storage classes (CSCs). CSCs are designed to be useful in code generation for embedded systems development. The new enhanced and expanded CSC functionality has been incorporated into the Simulink.Signal and Simulink.Parameter classes. This simplifies code generation with CSCs, since you can use familiar signal and parameter objects for this purpose.
The new Custom Storage Class Designer (cscdesigner) tool. The Custom Storage Class Designer lets you define additional CSCs that are tailored to your code generation requirements. The Custom Storage Class Designer provides a graphical user interface that lets you implement CSCs quickly and easily. You can use your CSCs in code generation immediately, without any TLC or other programming.
CSCs give you extended control over the constructs required to represent data in an embedded algorithm. For example, you can use CSCs to
Define structures for storage of parameter or signal data.
Conserve memory by storing Boolean data in bit fields.
Integrate generated code with legacy software whose interfaces cannot be modified.
Generate data structures and definitions that comply with your organization's software engineering guidelines for safety-critical code.
See the Custom Storage Classes chapter of the Real-Time Workshop Embedded Coder User's Guide for a detailed description of CSCs and the Custom Storage Class Designer.
In prior releases, CSCs were implemented via special Simulink.CustomSignal and Simulink.CustomParameter classes. We recommend that you consider replacing Simulink.CustomSignal and Simulink.CustomParameter objects in your models with equivalent Simulink.Signal and Simulink.Parameter objects.
Minor changes have been made in the Simulink.CustomSignal and Simulink.CustomParameter classes. See Custom Storage Class Compatibility Issues for information on these changes.
Real-Time Workshop Embedded Coder now generates significantly faster code for multirate multitasking models.
For multirate multitasking models, Real-Time Workshop Embedded Coder uses a strategy called rate grouping. Rate grouping generates separate model_step functions for the base rate task and each subrate task in the model. The function naming convention for these functions is
model_stepN
where N is a task identifier. For example, for a model named my_model that has three rates, the following functions are generated:
void my_model_step0 (void); void my_model_step1 (void); void my_model_step2 (void);
Each model_stepN function executes all blocks sharing tid N; in other words, all block code that executes within task N is grouped into the associated model_stepN function.
For other cases, Real-Time Workshop Embedded Coder generates a single model_step function. This model_step function uses the same scheduling technique (called rate guarding) as in previous versions of the product. When rate guarding is used, a task identifier is passed in to the model_step function.
To take advantage of rate grouping for existing multirate multitasking models, you must regenerate code, including the main program, ert_main.c.
See the Data Structures, Code Modules, and Program Execution chapter of the Real-Time Workshop Embedded Coder documentation for a complete discussion of rate grouping.
Using a new rtmStepTask macro, targets that employ the task management mechanisms of an RTOS can eliminate certain redundant scheduling calls during the execution of tasks in a multirate, multitasking model, thereby improving performance of the generated code.
The redundant scheduling calls are still generated by default for backward compatibility. However, you can suppress them by adding the following TLC variable definition to your system target file before the %include "codegenentry.tlc" statement:
%assign SuppressSetEventsForThisBaseRateFcn = 1
For more details on this feature, see Optimizing Task Scheduling for Multirate Multitasking Models on RTOS Targets in the Real-Time Workshop Embedded Coder documentation.
The Release 14 API for system target file callbacks provides three new callback functions for use in system target files. Unlike rtwoptions callbacks, these functions are associated with the target, not with its individual options. The callbacks are installed as fields in the rtwgensettings structure of the system target file. The callbacks, summarized in the next table, are fully described in the System Target Files chapter of Developing Embedded Targets.
Callback Function... | Is Triggered... |
|---|---|
rtwgensettings.SelectCallback | During model loading and when you select a target with the System Target File browser. |
rtwgensettings.ActivateCallback | When the active configuration set of the model changes. This could happen during model loading and when you change the active configuration set. |
rtwgensettings.postapplyCallback | When you click Apply or OK after editing options in the Configuration Parameters dialog box. The function is called after the changes have been applied to the configuration set. |
Note If you have developed a custom target and you want it to be compatible with model referencing, you must implement a SelectCallback function to declare model reference compatibility. See the Supporting Optional Features chapter of Developing Embedded Targets. |
A new template makefile option lets you control whether or not template makefile output is displayed during the build process. To enable makefile output display at all times (regardless of the setting of the Verbose build option in the Real-Time Workshop Debugging pane) add the following macro to your template makefile:
VERBOSE_BUILD_OFF_TREATMENT = PRINT_OUTPUT_ALWAYS
When you configure your template makefile this way, the Verbose build option controls the display of other build process output (such as TLC messages), but template makefile output is always displayed.
You should add this macro in the template makefile section that includes other macros, such as BUILD_SUCCESS.
This release includes a major update and reorganization of the Real-Time Workshop and Real-Time Workshop Embedded Coder demo collection. If you are reading this document online in the MATLAB Help browser, you can open the demo suite by clicking this link: rtwdemos.
Alternatively, you can access the demo suite by typing the name of the demo library at the MATLAB command prompt:
rtwdemos
This section discusses the following issues pertaining to upgrades from Real-Time Workshop Embedded Coder V3.2 (R13SP1+) or V3.2.1 (R13SP2) to V4.0 (R14):
TMF File Update Required for Use with Release 14 or Higher If Supporting ERT S-Function Generation
Real-Time Object Structure Obsoleted by Real-Time Model Structure
To use a Release 13 based TMF that supports ERT S-function generation with Release 14 or higher, you must update the TMF to include the following definitions:
LIBFIXPT=$(MATLAB_ROOT)\extern\lib\win32\microsoft\msvc50\libfixedpoint.lib LIBS = $(LIBS) $(LIBFIXPT)
For example:
Search for an if statement similar to the following:
!if $(B_ERTSFCN) == 1 ERT_SFUN = ..\$(MODEL)_sf.$(MEXEXT) ERT_SFUN_SRC = $(MODEL)_sf.c MEX = $(MATLAB_BIN)\mex !endif
The lines of code in the if statement may vary slightly depending on the make utility you are using.
Add the LIBFIXPT and LIBS definitions between the MEX definition and the !endif as follows:
!if $(B_ERTSFCN) == 1 ERT_SFUN = ..\$(MODEL)_sf.$(MEXEXT) ERT_SFUN_SRC = $(MODEL)_sf.c MEX = $(MATLAB_BIN)\mex LIBFIXPT =$(MATLAB_ROOT)\extern\lib\win32\microsoft\msvc50\libfixedpoint.lib LIBS = $(LIBS) $(LIBFIXPT) !endif
For more examples, see the supplied Real-Time Workshop TMFs.
Prior to 4.0, custom storage classes were implemented with special Simulink.CustomSignal and Simulink.CustomParameter classes.
In 4.0 and higher, the full functionality of the Simulink.CustomSignal and Simulink.CustomParameter classes is included in the Simulink.Signal and Simulink.Parameter classes. Consider replacing Simulink.CustomSignal and Simulink.CustomParameter objects in your models with equivalent Simulink.Signal and Simulink.Parameter objects.
If you prefer, you can continue to use the Simulink.CustomSignal and Simulink.CustomParameter classes in the current release. However, note that the following changes have been implemented in these classes:
The Internal storage class has been removed from the enumerated values of the RTWInfo.CustomStorageClass property. Internal storage class is no longer supported.
For the ExportToFile and ImportFromFile storage classes, the RTWInfo.CustomAttributes.FileName and RTWInfo.CustomAttributes.IncludeDelimeter properties have been combined into a single property, RTWInfo.CustomAttributes.HeaderFile. When specifying a header file, include both the filename and the required delimiter as you want them to appear in generated code, as in the following example:
myobj.RTWInfo.CustomAttributes.HeaderFile = '<myheader.h>';
Prior to 4.0, you created user-defined CSCs by designing custom packages that included the CSC definitions (as described in the cscdesignintro tutorial demo). This technique for creating CSCs is obsolete. For a description of the current procedure, which is much simpler, see Creating Packages with CSC Definitions in the "Custom Storage Classes" chapter of the Real-Time Workshop Embedded Coder documentation.
If you designed your own custom packages containing CSCs prior to 4.0, The MathWorks strongly recommends that you convert them to 4.0 CSCs. The conversion procedure is described in Converting Older Packages to Use CSC Registration Files in the "Custom Storage Classes" chapter of the Real-Time Workshop Embedded Coder documentation.
For Release 14, extensive improvements and revisions have been made in the appearance and layout of code generation options and other target-specific options for Real-Time Workshop targets. If you have developed a custom target, you should take advantage of the Model Explorer and Configuration Parameters dialogs to present target options to end users. If you choose not to, a mechanism for using the old-style Simulation Parameters dialog box is available for backwards compatibility.
The System Target Files chapter of Developing Embedded Targets discusses compatibility issues and solutions related to the definition and display of target-specific options for custom targets.
Callback compatibility: If the rtwoptions array in your custom system target file contains callbacks, you must convert your callbacks to use the callback compatibility API provided in this release. See Using rtwoptions Callbacks in Release 14 or Later in the "System Target Files" chapter of Developing Embedded Targets.
Target options inheritance: If your custom target is derived from another target and inherits options, you need change your system target file to use a new inheritance mechanism. See Target Options Inheritance in Release 14 or Later in the "System Target Files" chapter of Developing Embedded Targets.
Display of target options: Your target options are displayed differently, and you might want to reorganize them. See Target Options Display in Release 14 or Later in the "System Target Files" chapter of Developing Embedded Targets for information on how custom target options are displayed.
Existing custom targets require a number of modifications for code generation compatibility with the model reference features introduced in Release 14. The Supporting Optional Features chapter of Developing Embedded Targets provides the information you need to adapt your target to support model referencing. Most of the guidelines concern required modifications to the system target file and template makefile.
The list below summarizes general requirements and issues for model reference compatibility that are discussed in the Supporting Optional Features chapter:
A model reference compatible target must be derived from the ERT or GRT targets.
Your system target file must declare model reference compatibility.
Your template makefile must define a number of makefile tokens, variables and rules specifically for model referencing support.
To support model reference builds, your template makefile must support use of the shared utilities directory.
When generating code from a model that references another model, both the top-level model and the referenced models must be configured for the same code generation target.
Note that the External mode option is not supported in model reference Real-Time Workshop target builds. If the user has selected this option, it is ignored during code generation.
For general information about model referencing, see the Real-Time Workshop documentation.
As of Release 14, the ERT target supports continuous time. If you want your custom ERT-based target to take advantage of this feature, you must update your template makefile (TMF) and the static main program module (for example, mytarget_main.c) for your target.
Template Makefile Modifications. Add the NCSTATES token expansion after the NUMST token expansion, as follows:
NUMST = |>NUMST<| NCSTATES = |>NCSTATES<|
In addition, add NCSTATES to the CPP_REQ_DEFINES macro, as in the following example:
CPP_REQ_DEFINES = -DMODEL=$(MODEL) -DNUMST=$(NUMST) -DNCSTATES=$(NCSTATES) \ -DMAT_FILE=$(MAT_FILE) -DINTEGER_CODE=$(INTEGER_CODE) \ -DONESTEPFCN=$(ONESTEPFCN) -DTERMFCN=$(TERMFCN) \ -DHAVESTDIO -DMULTI_INSTANCE_CODE=$(MULTI_INSTANCE_CODE) \ -DADD_MDL_NAME_TO_GLOBALS=$(ADD_MDL_NAME_TO_GLOBALS)
Modifications to Main Program Module. The main program module defines a static main function that manages task scheduling for all supported tasking modes of single- and multiple-rate models. NUMST (the number of sample times in the model) determines whether the main function calls multirate or single-rate code.
However, when the model has continuous time, it is incorrect to rely on NUMST directly.
When the model has continuous time and the flag TID01EQ is true, both continuous time and the fastest discrete time are treated as one rate in generated code. The code associated with the fastest discrete rate is guarded by a major time step check. When the model has only two rates, and TID01EQ is true, the generated code has a single-rate call interface.
To support models that have continuous time, update the static main module to take TID01EQ into account, as follows:
Before NUMST is referenced in the file, add the following code:
#if defined(TID01EQ) && TID01EQ == 1 && NCSTATES == 0 #define DISC_NUMST (NUMST - 1) #else #define DISC_NUMST NUMST #endif
The ERT target now generates an optimized rtwtypes.h header file, which includes only the necessary definitions required by the target. Most generated code modules require these definitions. This header file replaces the static tmwtypes.h header file. Note that non-ERT targets still use the tmwtypes.h header file.
If you are upgrading and your application uses a customized version of the static main program module ert_main.c, open the module and make the following changes:
Search for RT_MDL. This search brings you to the "Required defines" section.
#define RT_MDL CONCAT(MODEL,_rt0)
with
#define RT_MDL CONCAT(MODEL,_M)
Search for tmwtypes.h. This search brings you to the "Includes" section.
Add the following include statement.
#include "rtwtypes.h"
Delete the following include statements.
#include "tmwtypes.h" #include "simstruc_types.h"
Just below the #include section, add the following preprocessor conditional code, which determines whether to set up multitasking mode. Previously, this code resided in simstruc_types.h.
/*========================* * Setup for multitasking * *========================*/ #if defined(MT) # if MT == 0 # undef MT # else # define MULTITASKING 1 # endif #endif
For more information about ert_main.c, see Static Main Program Module in the Real-Time Workshop Embedded Coder documentation.
The MathWorks recommends that you generate a target-specific main program module rather than use a customized version of the static module, ert_main.c. For details, see Generating the Main Program Module and Custom File Processing in the Real-Time Workshop Embedded Coder documentation.
The Support floating-point numbers option replaces, and inverts the logic of, the Integer code only option that was supported in previous releases. To generate pure integer code in new models, deselect the Support floating-point numbers option.
Note that for compatibility, models that were configured for Integer code only prior to Release 14 are automatically configured with Support floating-point numbers deselected, and generate pure integer code.
To take full advantage of the efficiency of rate grouping:
Your multirate inlined S-functions must be upgraded to be fully rate grouping compliant. Existing S-functions continue to operate correctly without change, but we strongly recommend that you upgrade your TLC S-function implementations. See Rate Grouping Compliance and Compatibility Issues in the "Data Structures and Program Execution" chapter of the Real-Time Workshop Embedded Coder documentation.
If you have previously generated and modified ert_main.c (as is typical of many ERT-based custom targets) take care to preserve your modifications and make equivalent changes to the regenerated ert_main.c. After you have done so, set the TLC variable RateBasedStepFcn to 1, as described in Rate Grouping and the Static Main Program in the "Data Structures and Program Execution" chapter of the Real-Time Workshop Embedded Coder documentation.
In MATLAB Release 13, the real-time model (model_M) data structure replaced the real-time object (model_rtO) data structure. However, use of use of the older structure was still supported for backward compatibility.
Real-Time Workshop Embedded Coder 4.0 requires use of the real-time model data structure. If you have developed a custom target that references model_rtO (for example, in a customizedert_main.c module) you must replace them with references to model_M.
See the Data Structures, Code Modules, and Program Execution chapter of the Real-Time Workshop Embedded Coder documentation for further information about the real-time model data structure.
The following macros are now obsolete and should not be used with the ERT target:
rtmIsSampleHit
rtmIsSpecialSampleHit
This does not cause a problem unless you have coded these macros directly into your TLC files. The recommended practice is to use the following TLC library functions:
%<LibIsSFcnSampleHit(tid)>
%<LibIsSFcnSpecialSampleHit(tid)>
If you have used these functions, they operate transparently.
This note describes a minor change in behavior when the RTWInfo properties of a data object are assigned incorrectly.
You can assign a custom storage class to a data object either by using Simulink Model Explorer, or by setting the RTWInfo properties via MATLAB commands. (See also the Custom Storage Classes chapter in the Real-Time Workshop Embedded Coder documentation.) If you use MATLAB commands to assign a custom storage class, you must set both the RTWInfo.CustomStorageClass and RTWInfo.StorageClass fields. Make sure that the RTWInfo.StorageClass property is set to 'Custom', as in the following example.
aa = Simulink.Signal; aa.RTWInfo.StorageClass = 'Custom'; aa.RTWInfo.CustomStorageClass = 'Struct'; aa.RTWInfo.CustomAttributes.StructName = 'mySignals';
If the RTWInfo.StorageClass is not set correctly as shown above, the assigned custom storage class (RTWInfo.CustomStorageClass) are ignored during code generation. In such cases, a warning is displayed at the time RTWInfo.CustomStorageClass is assigned, for example
foo = Simulink.Signal foo.RTWInfo.CustomStorageClass = 'Struct' Warning: The 'CustomStorageClass' property of RTWInfo will have no effect unless the 'StorageClass' property is set to 'Custom'.
Previously, the warning was displayed at the time RTWInfo.StorageClass was assigned.
Due to a design change made in V4.0 (R14) Real-Time Workshop Embedded Coder, a Real-Time Workshop error occurs when generating R13SP1+ or R13SP2 code from an ERT-based Simulink model created in R14 or later.
If you use R14 or later to save an ERT-based Simulink model into R13SP1 format (using Simulink File > Save As > Save as type), and then try to generate code for the model under R13SP1+ or R13SP2, the following error is displayed:
Error executing build command: Error using ==> make_rtw Error using ==> tlc_c Error using ==> tlc_c (InvokeTLC) Error: Real-Time Workshop Error: Unable to locate ERT header file banner template: ert_code_template.cgt.
To work around this problem in R13SP1+ or R13SP2, download and install a replacement version of the file matlabroot/rtw/c/tlc/mw/setuplib.tlc, as follows:
Go to the directory matlabroot/rtw/c/tlc/mw and rename the file setuplib.tlc to setuplib.tlc.old.
Click the appropriate link below to download a replacement version of setuplib.tlc. Place the file in the same directory as the file you renamed.
Rename the downloaded file to setuplib.tlc.
![]() | Version 4.1 (R14SP1) Real-Time Workshop Embedded Coder Software | Version 3.2.1 (R13SP2) Real-Time Workshop Embedded Coder Software | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |