Products & Services Solutions Academia Support User Community Company

Learn more about Real-Time Workshop Embedded Coder   

Version 5.4 (R2009b) Real-Time Workshop Embedded Coder Software

This table summarizes what is new in Version 5.4 (R2009b):

New Features and ChangesVersion Compatibility ConsiderationsFixed Bugs and Known ProblemsRelated Documentation at Web Site
Yes
Details below
Yes—Details labeled as Compatibility Considerations, below. See also SummaryBug Reports
Includes fixes

Printable Release Notes: PDF

Current product documentation

New features and changes introduced in this version are

Improved User Guide Documentation

The Real-Time Workshop Embedded Coder User's Guide has been reorganized and consolidated to better support user workflows.

Code Generation Objectives Now Customizable

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:

For details, see Creating Custom Objectives.

Code Generation Objectives Limitation Removed

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.

Verify Numerical Equivalence of Results

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.

Automatically Verify a SIL or PIL Configuration

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 Top-Model Processor-in-the-Loop (PIL) Simulation Mode

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 Enhancements

Bus Support

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.

Data Stores and Imported Data Definition

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.

PIL Block Behavior with Goto/From Blocks

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.

Ability to Generate Switch-Case Statements for Embedded MATLAB Function Blocks and Stateflow Charts

You can choose to generate switch-case statements during code generation when you have if-elseif-else decision logic in one of the following:

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:

Target Function Library Enhancements

TFLs Now Support Function Replacement for Nonscalar Operators

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.

Ability to Use BLAS Functions for Matrix Multiplication

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.

Support for Data Type Conversion (Cast) Replacement

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.

Support for Fixed-Point Shift Left Replacement

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.

Support for Replacing Additional Math Functions

TFLs now support function replacement for the following math functions.

acoshfixminsaturate
asinhhypotmod/fmodsign
atan2ldexprem 
atanhlnround 
exactrSqrtmaxrSqrt 

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.

C++ Encapsulation Enhancements

Control Visibility and Access for Data Members In C++ Model Class Using New Configuration Parameters

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,

Select Dynamic Memory Allocation for Registering Referenced C++ Encapsulation Models Using New Configuration Option

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.

Function Subsystems and Charts Now Generated as Private Member Functions in C++ Encapsulation Model Class

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.

Limitations.  

Mismatched System Code Options for Nested Subsystems or Charts Now Error Out During C++ Encapsulation Code Generation

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:

AUTOSAR Enhancements

Multi-Argument Client-Server Communication

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.

Merging Inter-Runnable Variables

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.

Updating Model Configuration Set

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.

Limitations

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.

Pack Boolean Data Into Bitfields in the Generated Code Using New Configuration Parameter

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.

Generate Preprocessor Conditional Directives Using New Configuration Parameter

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.

Specify Function Argument Names Using New Configuration Parameter

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.

Remove or Preserve extern Keyword In Generated Code Function Declarations Using New Configuration Parameter

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.

New Function Banner Customization and Code Generation Template Improvements

R2009b introduces a unified approach to customizing and sharing file and function banner templates in the Code Generation Template (CGT) Files:

HTML Code Generation Report Provides Hyperlink to Requirements Document

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.

Code Traceability Improvement

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.

Tunable Iteration Limit for the For Iterator block

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.

Generated Code Enhancements

In R2009b, code generation is enhanced to:

Removed Limitations for Reusable Subsystem Optimization

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.

Generated rtwtypes.h Header File Now Omits Unnecessary Type Definitions

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.

Duplicate Block Comments No Longer Appear in the Generated Code

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.

Block Comments for Custom Blocks are Now Configurable

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.

Name Improvement for Block Parameter Structure in Generated Code

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.

Generate Code for Variable-Size Signals Using New Configuration Parameter

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.

New and Enhanced Demos

The following demos have been added in R2009b:

Demo...Shows How You Can...
rtwdemo_autosar_clientserver_scriptConfigure and generate AUTOSAR-compliant code and export AUTOSAR-compliant XML files for a Simulink model with an AUTOSAR client-server interface.
rtwdemo_preprocessor_scriptConfigure model variants and generate preprocessor conditionals to control which code is linked to the embedded executable.
rtwdemo_sil_pilCarry 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_commentsIncludes 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_scriptIncludes 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

  


Related Products & Applications

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