| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → Real-Time Workshop Embedded Coder |
| Contents | Index |
| Learn more about Real-Time Workshop Embedded Coder |
This table summarizes what is new in Version 5.4 (R2009b):
| New Features and Changes | Version Compatibility Considerations | Fixed Bugs and Known Problems | Related Documentation at Web Site |
|---|---|---|---|
| Yes Details below | Yes—Details labeled as Compatibility Considerations, below. See also Summary | Bug
Reports Includes fixes | Printable Release Notes: PDF |
New features and changes introduced in this version are
Ability to Generate Switch-Case Statements for Embedded MATLAB Function Blocks and Stateflow Charts
Pack Boolean Data Into Bitfields in the Generated Code Using New Configuration Parameter
Generate Preprocessor Conditional Directives Using New Configuration Parameter
Specify Function Argument Names Using New Configuration Parameter
New Function Banner Customization and Code Generation Template Improvements
HTML Code Generation Report Provides Hyperlink to Requirements Document
Duplicate Block Comments No Longer Appear in the Generated Code
Name Improvement for Block Parameter Structure in Generated Code
Generate Code for Variable-Size Signals Using New Configuration Parameter
The Real-Time Workshop Embedded Coder User's Guide has been reorganized and consolidated to better support user workflows.
Previously, you could run the Code Generation Advisor based on four predefined objectives: efficiency, traceability, safety precaution, and debugging. In R2009b, you can create customized objectives and use the Code Generation Advisor to review models against the custom objectives.
You can use the Code Generation Objective API to create custom objectives by:
Creating a new objective and adding parameters and checks to a new objective.
Creating a new objective based on an existing objective, then adding, modifying and removing the parameters and checks within the new objective.
For details, see Creating Custom Objectives.
Previously, the code generator did not support reviewing referenced models during the build process. In R2009b, The MathWorks removes this limitation. In the Configuration Parameters dialog box, on the Real-Time Workshop pane, select Check model before build to review the top model and referenced models during the build process.
For details, see Reviewing Objectives in Referenced Models.
In R2009b, you can use Code Generation Verification (CGV) to verify the numerical equivalence of results when you execute a model in different modes of execution. CGV supports executing the model in simulation, Software-In-the-Loop (SIL), and Processor-In-the-Loop (PIL).
For details, see Verifying Numerical Equivalence of Results with Code Generation Verification in the Real-Time Workshop® Embedded Coder™ documentation.
You might need to change model settings to configure the model correctly for SIL or PIL. To find out what settings you must change, you can use the cgv.Config class. Using the cgv.Config class, you can review your model configuration and determine which settings you must change to configure the model correctly for SIL or PIL.
For details, see Verifying a SIL or PIL Configuration in the Real-Time Workshop Embedded Coder documentation.
New Processor-in-the-Loop (PIL) simulation mode allows you to run a complete model as a PIL simulation on your target processor, debugger, or instruction set simulator. With this mode, you can verify the object code that is generated and compiled from a complete model without creating a separate test harness model. This provides an alternative to block-based approaches where the PIL simulation is performed using a test harness model that contains a block executing in PIL mode (e.g. Model block PIL).
Additionally, by selecting your host machine as the target hardware, you can use the PIL simulation mode to perform Software-in-the-Loop (SIL) verification. Again, this provides an alternative to block-based approaches for SIL.
For more information on this new mode (and how it differs from the block-based PIL and SIL), see Verifying Compiled Object Code with Processor-in-the-Loop Simulation and Choosing a PIL Simulation Approach in the Real-Time Workshop Embedded Coder documentation.
For examples of SIL and PIL verification, see the new demo rtwdemo_sil_pil.
Processor-in-the-loop (PIL) now provides support for buses.
For more information on PIL bus support, see I/O Support in the PIL support tables in the Real-Time Workshop Embedded Coder documentation.
PIL now provides support for global data stores and grouped custom storage classes.
PIL support for imported data definition is improved. You can use signals, parameters, data stores, etc., that specify storage classes with imported data definitions. For exceptions, see Imported Data Definitions in the PIL support tables.
For more information on PIL support, see PIL Simulation Support and Limitations in the Real-Time Workshop Embedded Coder documentation.
You will now see an error if your PIL component includes any Goto / From blocks that cross the boundary of the PIL component.
Previously it was possible but not recommended to use Goto/From blocks for I/O data that crosses the boundary of the PIL block component. For virtual (nonatomic) subsystems, the right-click PIL build transformed boundary-crossing Goto blocks into outports and From blocks into inports. The resulting PIL block had extra I/O ports and you had to rework the model to connect it. This behavior has changed to an error if your PIL component includes any Goto / From blocks that cross the boundary of the PIL component.
You can choose to generate switch-case statements during code generation when you have if-elseif-else decision logic in one of the following:
An Embedded MATLAB™ Function block in a Simulink model
A flow graph or an Embedded MATLAB function in a Stateflow® chart
Switch-case statements provide more readable and efficient code than if-elseif-else statements when multiple decision branches are possible.
When you load models created in R2009a and earlier, this optimization is off to maintain backward compatibility. In previous versions, if-elseif-else logic appeared unchanged in generated code. For more information, see:
Real-Time Workshop Pane: Code Style in the Real-Time Workshop Embedded Coder documentation
Enhancing Readability of Generated Code for Embedded MATLAB Function Blocks in the Simulink documentation
Enhancing Readability of Generated Code for Flow Graphs in the Stateflow documentation
Target function libraries (TFLs) now support the following nonscalar operators for replacement with custom library functions:
| + (addition) |
| − (subtraction) |
| * (matrix multiplication) |
| .* (array multiplication) |
| ' (matrix transposition) |
| .' (array transposition) |
For more information, see Mapping Nonscalar Operators to Target-Specific Implementations in the Real-Time Workshop Embedded Coder documentation and the TFL demos page rtwdemo_tfl_script.
TFLs now support the ability to map matrix multiplication operations to Basic Linear Algebra Subroutine (BLAS) functions.
For more information, see the BLAS examples in Mapping Nonscalar Operators to Target-Specific Implementations in the Real-Time Workshop Embedded Coder documentation and the TFL demos page rtwdemo_tfl_script.
TFLs now support function replacement for data type conversion (cast) operations.
For more information, see Mapping Data Type Conversion (Cast) Operations to Target-Specific Implementations in the Real-Time Workshop Embedded Coder documentation.
TFLs now support function replacement for fixed-point << (shift left) operations.
For more information, see Mapping Fixed-Point Shift Left Operations to Target-Specific Implementations in the Real-Time Workshop Embedded Coder documentation.
TFLs now support function replacement for the following math functions.
| acosh | fix | min | saturate |
| asinh | hypot | mod/fmod | sign |
| atan2 | ldexp | rem | |
| atanh | ln | round | |
| exactrSqrt | max | rSqrt |
Additionally, replacement of the abs function now works with integer arguments as well as floating-point arguments.
For more information, see Example: Mapping Math Functions to Target-Specific Implementations in the Real-Time Workshop Embedded Coder documentation.
R2009b adds five model configuration parameters that provide enhanced control over visibility and access for data members in a generated C++ model class. If you select the ert.tlc target and the C++ (Encapsulated) language for your model, the following new parameters appear on the Interface pane of the Simulink Configuration Parameters dialog box:
| Block parameter visibility |
| Internal data visibility |
| Block parameter access |
| Internal data access |
| External I/O access |
Compatibility Considerations. The new parameters replace the following obsolete model configuration parameters, which were supported in R2008b and R2009a, and which have been removed from the Interface pane:
| Private parameter and state members |
| Parameter and state access methods |
| I/O access methods |
| Inline access methods |
To support forward and backward compatibility,
If you open a model created in R2008b or R2009a with R2009b, the obsolete parameters are automatically converted to the new parameters.
If you open a model in R2009b and use Save As to save the model in R2008b or R2009a format, the new parameters are converted to the R2008b/R2009a parameters.
R2009b adds the model configuration option Use operator new for referenced model object registration. This option specifies whether generated code should use the operator new, during model object registration, to instantiate objects for referenced models configured with a C++ encapsulation interface.
If you select the ert.tlc target and the C++ (Encapsulated) language for your model, Use operator new for referenced model object registration appears on the Interface pane of the Simulink Configuration Parameters dialog box. If you select this option, the model build process generates code that uses dynamic memory allocation to instantiate objects for referenced models configured with a C++ encapsulation interface. Specifically, during instantiation of an object for the top model in a model reference hierarchy, the generated code uses new to instantiate objects for referenced models.
Selecting this option frees a parent model from having to maintain information about submodels beyond its direct children. Clearing this option means that a parent model maintains information about all of its submodels, including its indirect children as well as its direct children.
For more information, see Use operator new for referenced model object registration in the Real-Time Workshop Embedded Coder reference documentation.
R2009b enhances the C++ encapsulation code generated for Simulink subsystems and Stateflow charts that are not required or configured to be reusable — that is, subsystems or charts for which the Real-Time Workshop system code parameter is set to Function.
In previous releases, the build process generated subsystem or chart functions as global reusable functions outside of the class structure, regardless of whether the Real-Time Workshop system code parameter was set to Function or Reusable function. If your coding standard required subsystem or chart functions to be encapsulated in a class interface, the generated code would not meet the requirement. Additionally, if the model required only a single instance of the subsystem or chart, generating a global reusable function added unnecessary memory and processing overhead.
Beginning in R2009b, the build process generates Function subsystems and charts as private member functions in the C++ encapsulation model class.
Compatibility Considerations. Beginning in R2009b, if C++ (Encapsulated) is selected as the Language option for your model, and if your model contains a Simulink subsystem or Stateflow chart for which the Real-Time Workshop system code parameter is set to Function, the build process generates the subsystem or chart function as a private member function in the C++ encapsulation model class, rather than as a global reusable function outside of the class structure. If you want the subsystem or chart function to be generated as a global reusable function outside of the class structure, go to the subsystem or chart parameters dialog box and set the Real-Time Workshop system code parameter to Reusable function.
This enhancement only applies to Function subsystems and charts in the top model, not in referenced models.
If a chart contains a subfunction, the chart is generated as a global reusable function outside of the class structure rather than as a private member function in the C++ encapsulation model class.
When generating C++ encapsulation code for a model, the build process now flags an error if a Simulink subsystem or Stateflow chart for which the Real-Time Workshop system code parameter is set to Function is nested in a subsystem or chart for which the Real-Time Workshop system code parameter is set to Reusable function.
Compatibility Considerations. In previous releases, mismatched Real-Time Workshop system code parameter values between a nested subsystem or chart and its containing subsystem or chart did not generate an error, because C++ encapsulation code generation would generate both Function and Reusable function subsystems or charts as global reusable functions outside of the model class structure.
Beginning in R2009b, C++ encapsulation code generation generates Function subsystems and charts as private member functions in the model class, so you can no longer nest a Function subsystem or chart in a Reusable function subsystem or chart.
To resolve the conflict, do one of the following:
Set Real-Time Workshop system code to Reusable function for the nested subsystem or chart. The subsystems or charts will generate global reusable functions outside of the class structure.
Set Real-Time Workshop system code to Function for the containing subsystem or chart. The subsystems or charts will generate private member functions in the model class.
Support is now provided for multi-argument AUTOSAR client-server communication. You can generate AUTOSAR-compliant code, and import and export AUTOSAR description XML files for Application Software Components and Basic Software. For more information, see Configuring Client-Server Communication in the Real-Time Workshop Embedded Coder documentation.
The new demo rtwdemo_autosar_clientserver_script shows how you can generate and export AUTOSAR-compliant code and XML files for a Simulink model with an AUTOSAR client-server interface.
You can now use the Merge block to merge inter-runnable variables. However, there are constraints on the signal names for the Merge block and the destination of its output. For more information on these constraints, see Using the Merge Block for Inter-Runnable Variables in the Real-Time Workshop Embedded Coder documentation.
If you saved an AUTOSAR model configuration set as a MAT-file using a previous release of Real-Time Workshop Embedded Coder, then you must run slupdate on the model to update the referenced configuration set. After this, resave the configuration set (as a MAT-file). For more information, see Setting Up Configuration Sets, Referencing Configuration Sets, and slupdate in the Simulink documentation.
You cannot use the new Invoke AUTOSAR Server Operation block within a referenced model. If a referenced model has this block, the software produces a warning when you build the top model. You can only use the Invoke AUTOSAR Server Operation block in the top model.
R2009b introduces a new configuration parameter to pack Boolean data into bitfields in the generated code. Choosing this option reduces global RAM usage. For details, see Pack Boolean data into bitfields in the Simulink documentation.
Previously, there was no built-in solution for implementing variants in the generated code. In R2009b, you can generate preprocessor conditional directives using model reference variants. The new configuration parameter Generate preprocessor conditionals provides the capability to implement variants globally for a model or locally for each referenced model. For details, see Generate preprocessor conditionals in the Real-Time Workshop® documentation and Generating Code Variants for Variant Models in the Real-Time Workshop Embedded Coder documentation.
R2009b adds a new Identifier format control parameter, Subsystem method arguments on the Real-Time Workshop > Symbols pane of the Configuration Parameters dialog box. This parameter provides finer control over the naming rules for function argument names in reusable subsystems. To be able to use the new parameter, your model must use an ERT-based system target file (requires a Real-Time Workshop Embedded Coder license). For a description of the Identifier format control parameters and their use, see Specifying Identifier Formats in the Real-Time Workshop Embedded Coder documentation.
Previously, the Real-Time Workshop software automatically included the extern keyword in function declarations in the generated code. In R2009b, a new configuration parameter provides you with the flexibility to remove the extern keyword from function declarations. For details, see Preserve extern keyword in function declarations in the Real-Time Workshop Embedded Coder documentation.
R2009b introduces a unified approach to customizing and sharing file and function banner templates in the Code Generation Template (CGT) Files:
Custom function banner generation provides consistency in banner comments for functions and shared utility functions.
Tag format to more easily create file and function banners.
Predefined tokens include specific information about each function in the function banner.
Predefined styles provide a consistent format for the boundary of file and function banners throughout your code.
Previously, to trace requirements descriptions in the generated code to the requirements document for that block, you had to perform multiple steps. In R2009b, the code generation report provides hyperlinks directly to the corresponding requirements document. To include requirements descriptions in the generated code, you need a Simulink Verification and Validation™ software license. For details, see Including Requirements Information with Generated Code in the Simulink Verification and Validation documentation.
Previously, hyperlinks in the HTML code generation report might not work if a model contains international characters and is open on a machine with different character encoding. In R2009b, traceability in the code generation report is enhanced to remove this limitation.
Previously, the Iteration limit parameter of the For Iterator block appeared only as a number in the generated code. The Iteration limit parameter now supports storage classes. The named constant representing the iteration limit appears in the generated code when you define it as a Simulink.Parameter object in the base workspace. This capability improves the readability and reusability of the generated code. For details, see the Iteration limit parameter description in the For Iterator block.
In R2009b, code generation is enhanced to:
Eliminate unnecessary data copies for the Bus Creator block in referenced models. This optimization reduces RAM usage and improves execution speed of the generated code.
Eliminate unnecessary data copies from a subsystem output port to the root Outport block for the following subsystems:
Nonreusable
Function call
Conditional
Triggered
This optimization reduces RAM usage and improves execution speed of the generated code.
Combine similar loops for loops containing structure member read-only references. This optimization improves execution speed and likely reduces RAM and ROM usage of the generated code.
Copy data between two structure data types using the assignment operator. Previously, the generated code copied data between two structure data types member by member. This optimization generates less code and improves execution speed for block I/O.
Reduce global data copies by using local variables for the Vector Concatenate and Matrix Concatenate block outputs whenever possible. This optimization reduces RAM usage and improves execution speed of the generated code.
Remove unreachable code from nested if statements containing the same test condition. This optimization generates less code and improves execution speed of the generated code.
Eliminate If or Switch statements when the condition expression is side-effect free and all branches are identical. This optimization improves code readability, reduces code size, and reduces execution time.
Previously, the Pass reusable subsystem outputs as parameter on the Optimization pane of the Configuration Parameters dialog box had several limitations for the Individual arguments option. In R2009b, all limitations have been addressed, except for signals with variable dimensions.
Real-Time Workshop Embedded Coder generated production code for the header file rtwtypes.h is now optimized to remove unnecessary type definitions. The build process now conditionally generates type definitions and defines based on built-in integer data types, which are needed only when you select MAT-file logging or the C API data exchange interface for your model.
Previously, if a block includes a description or a requirement, duplicate block comments might appear in the generated code for certain blocks. In R2009b, the Real-Time Workshop Embedded Coder software no longer generates duplicate block comments. See Adding Custom Comments to Generated Code for more information on how to include block comments into the generated code.
Previously, block comments for custom blocks were inserted in the generated code by manually inserting comments into the associated TLC files. In R2009b, the code generation process automatically inserts block comments into the generated code for custom blocks. See Adding Custom Comments to Generated Code for more information. Note that the code generation process continues to emit manually inserted comments instead of the automatically generated comments. Consider removing existing block comments from your TLC files. Manually inserted comments might be poorly formatted in the generated code and code-to-model traceability might not work.
Previously, if you add a Model block to your model, the Real-Time Workshop software changes the name of the instance of a block parameter structure in the generated code to a generic name, for example, rtP. In R2009b, naming of the block parameter structure follows the global variable naming rule. See Identifier Format Control Parameter Values in the Real-Time Workshop Embedded Coder documentation for more information.
R2009b supports code generation for variable-size signals. You can turn on/off this capability from a new parameter support variable-size signals on the Real-Time Workshop > Interface pane of the Configuration Parameters dialog box. This parameter only appears if you select the ert.tlc system target file.
The following demos have been added in R2009b:
| Demo... | Shows How You Can... |
|---|---|
| rtwdemo_autosar_clientserver_script | Configure and generate AUTOSAR-compliant code and export AUTOSAR-compliant XML files for a Simulink model with an AUTOSAR client-server interface. |
| rtwdemo_preprocessor_script | Configure model variants and generate preprocessor conditionals to control which code is linked to the embedded executable. |
| rtwdemo_sil_pil | Carry out software-in-the-loop (SIL) or processor-in-the-loop (PIL) code verification. |
The following demos have been enhanced in R2009b:
| Demo... | Now... |
|---|---|
| rtwdemo_comments | Includes a code generation template file to illustrate how to customize file banner, function banner, and file trailer comments in the generated code. |
| rtwdemo_international (see Character Set Limitation in the Real-Time Workshop documentation) | Includes a code generation template file to illustrate how to customize file banner, function banner, and file trailer comments in the generated code. |
| rtwdemo_tfl_script | Includes models that illustrate how to use target function libraries (TFLs) to replace nonscalar operators and utilize Basic Linear Algebra Subroutine (BLAS) library functions in generated code |
![]() | Real-Time Workshop Embedded Coder Release Notes | Version 5.3 (R2009a) Real-Time Workshop Embedded Coder Software | ![]() |

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |