| Version 5.2 (R2008b) Real-Time Workshop® Embedded Coder™ Software Release Notes | ![]() |
This table summarizes what's new in Version 5.2 (R2008b):
| 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
New Option to Generate Encapsulated C++ Class Interfaces for Model Data and Functions
New Processor-in-the-Loop (PIL) Model Block Simulation Mode and API
Flexible Configuration Options for Referenced Models in TLC-Based Custom Targets
New Code Interface Report Details Generated Code Architecture
Minimize Local Variables in Code Generation Using New Configuration Parameter
The Real-Time Workshop® language option C++, introduced in R14SP2, generates a C++ compatible interface to code generated from Simulink models. However, code generated using the C++ option has the limitation that model data and functions are not encapsulated into C++ class attributes and methods.
With the addition of the language option C++ (Encapsulated) in R2008b, the Real-Time Workshop® Embedded Coder™ software can generate a C++ class interface to model code, in which all required model data is encapsulated into C++ class attributes and all model entry point functions are encapsulated into C++ class methods. The benefits of encapsulation include
Greater control over access to model data
Ability to multiply instantiate model classes
Easier integration of Real-Time Workshop Embedded Coder generated model code into C++ programming environments
C++ encapsulation also can be applied to right-click builds of nonvirtual subsystems.
For more information, see Generating and Controlling C++ Encapsulation Interfaces in the Real-Time Workshop Embedded Coder documentation.
For a demonstration of the C++ encapsulation capability, see the demo model rtwdemo_cppencap.
In conjunction with the C++ encapsulation feature described in the previous section, this release introduces the CPPClassGenCompliant target configuration parameter. This parameter is set in the SelectCallback function for an ERT-based target to indicate whether the target supports the ability to generate and configure C++ encapsulation interfaces to model code. The default is off for custom and non-ERT targets and on for ERT (ert.tlc) targets.
To make an ERT-based target compliant, use the SelectCallback function to set CPPClassGenCompliant to on. This enables the feature infrastructure and user interface.
When the language option C++ (Encapsulated) is selected, code generation always generates an example main program, ert_main.cpp, demonstrating how the generated code can be deployed. The generated example main file has been updated to declare model data and call the C++ encapsulation interface configured model step method appropriately.
Real-Time Workshop Embedded Coder now provides Processor-in-the-Loop (PIL) Model block simulation mode and API for verification of embedded code on your target processor.
Model block PIL mode
Allows easy switching between Normal, Accelerator and PIL simulation modes.
You can test object code with no need to modify the original model.
You can reuse test suites, resulting in faster iteration between model development and generated code verification.
PIL Connectivity API
Allows you to access the power of PIL verification for your target processor.
You can integrate third party or custom tools for:
Building the PIL application
Downloading and running the application
Communicating with the application
For more information see Verifying Generated Code with Processor-in-the-Loop in the Real-Time Workshop Embedded Coder documentation.
See the following new demos for step-by-step examples:
This model shows you how to compare results from Normal mode simulation and PIL mode execution for the same referenced model. You simply run the simulation to compare the simulation behavior with the behavior of the corresponding generated code. This uses the default host-based PIL configuration, so the generated code is compiled for and executed on your host workstation.
This M-file demo shows you how to create a custom PIL configuration using the target connectivity APIs. You can examine the code that configures the PIL build process, a tool to use for downloading and execution, and a communication channel between host and target. Follow the steps to activate a full host-based PIL configuration.
This M-file demo shows you how to implement a communication channel to enable exchange of data between different processes. This is required for PIL, which requires exchange of data between the Simulink software (running on your host machine) and deployed code (executing on target hardware). A default TCP/IP implementation is provided.
AUTOSAR support has been enhanced to include the following functionality:
Multiple Runnable Entities
You can model multiple AUTOSAR runnable entities as function-call subsystems.
Calibration Parameters
You can import your calibration parameters into the Workspace and assign them to block parameters in your model.
Access to Basic Software
You can designate inports and outports as access points to AUTOSAR services and device drivers (basic software).
Error Status
You can designate inports to receive error status.
Enumerations
You can map MATLAB enumerated types to and from AUTOSAR enumerated types.
Absolute Time
You can now use blocks that depend on time, such as the Discrete-Time Integrator block, which you may need to use in a multiple runnable software component.
For information, see Generating Code That Complies with AUTOSAR Standards in the Real-Time Workshop Embedded Coder User's Guide documentation.
New functions also provide command-line access to all new AUTOSAR options. For more information, see Configuring AUTOSAR Options Programmatically in the Real-Time Workshop Embedded Coder User's Guide documentation.
Also, a new AUTOSAR demo is provided, rtwdemo_autosar_mutirunnables_script, and the existing two demos are updated.
In R2008b, you can specify that a configuration option for a TLC-based custom target need not have the same value in a referenced model that it has in the parent model. By default, the values must be the same in both models. See Controlling Configuration Option Value Agreement for information about overriding this default.
In R2008b, code generation is enhanced to:
Eliminate data copies for transposing matrices in code. Expression folding reduces the computation into the Transpose block, which improves stack consumption and memory access, and improving execution speed.
Compute constants for evenly spaced constant data, (for example, 1, 2, 3, ...), rather than defining them in model_data.c. This capability reduces ROM consumption and memory access, avoiding compiler stress due to large data sets.
Optimize inlining of code generated from Simulink blocks, Stateflow® charts, and Embedded MATLAB™ code.
Remove unnecessary saturation logic code, reducing RAM and ROM, improving code efficiency.
Provide bidirectional traceability for control ports, such as Trigger and Enable blocks.
Provide local and reusable input buffers for Model blocks. This capability reduces global data usage and data copying when interfacing with code from a referenced model, which can increase the efficiency of generated code.
This release adds pow, power, and memcpy to the list of functions that you can replace with custom or target-specific implementations using target function libraries (TFLs). This allows you to replace default implementations of pow, power, or memcpy that may be insufficient for your application or your target environment.
For a demonstration of pow, power, and memcpy function replacements, see the demo model rtwdemo_tflmath. For detailed information about TFLs, see Target Function Libraries in the Real-Time Workshop Embedded Coder documentation.
In previous releases, TFL support for fixed-point multiplication and division operator replacement did not provide a generalized net slope matching capability. This limited the ability to generate the same TFL replacement function for a range of different input slopes in the model. This release adds a new Net Slope TFL entry, which allows you to match fixed-point slope information between a multiplication or division operator and the TFL entry in a more general and intuitive way.
You can now configure emlc to use ERT target function libraries (TFLs) when generating C code. You enable this feature by defining a configuration object for C code generation using a new ert parameter at the MATLAB command prompt, as in this example:
rtwcfg = emlcoder.RTWConfig('ert')When you open the properties dialog box for the configuration object, the ERT TFLs will appear in the drop-down list for the Target function library field.
This feature requires a Real-Time Workshop Embedded Coder license.
This release introduces an API for registering custom embedded real-time (ERT) target function libraries (TFLs) for use with emlc. You register one or more custom TFLs in a file called rtwTargetInfo.m that emlc reads on the MATLAB path. This feature requires a Real-Time Workshop Embedded Coder license.
A new Code Interface Report section has been added to the standard Real-Time Workshop Embedded Coder HTML code generation report. The Code Interface Report section provides documentation of the generated code interface, including model entry point functions and interface data, for consumers of the generated code. The information in the report can help facilitate code review and code integration.
The Code Interface Report section is automatically included in every Real-Time Workshop Embedded Coder HTML code generation report, so to generate it, you need only select the model option Create code generation report. To view the code interface report for a model, build the model, go to the Contents pane of the code generation report, and click the Code Interface Report link.
For more information, see Using the Code Interface Report to Analyze the Generated Code Interface in the Real-Time Workshop Embedded Coder documentation.
In previous releases, algorithmic code and rate-monotonic scheduling code were interleaved in multirate model code generated by Real-Time Workshop Embedded Coder software. This could make it difficult to deploy multirate algorithmic code independently of the Real-Time Workshop Embedded Coder scheduling code.
In R2008b, scheduling code has been moved from the generated file model.c to the example main program, creating a clean separation of algorithmic code and scheduling code. This has the following benefits:
Simplifies deployment and integration of multirate algorithmic code
Improves efficiency of multirate algorithmic code (less code runs at the base rate)
Improves memory usage (may reduce or eliminate rtModel data)
Code generation assumes the same run-time environment, with a rate-monotonic scheduler in use, as in previous releases.
Note This change is for Real-Time Workshop Embedded Coder code generation only; Real-Time Workshop code generation and Simulink simulation are unaffected. Handling of rate transitions during simulation is unchanged. |
In R2008b, Real-Time Workshop Embedded Coder no longer generates rate-monotonic scheduling code that is interleaved with multirate algorithmic code in model.c. Code for controlling the execution of subrate tasks now resides exclusively in ert_main.
Multirate code generated using R2008b will be compatible with previously existing models, except when both of the following conditions are true:
You are using a static main program based on the R2008a version of ert_main.c or .cpp.
You are using a system target file based on the R2008a version of ert.tlc, and in that file, you have retained the following assignment, which specifies that the SetEvents function is inlined in the static main program:
%assign InlineSetEventsForThisBaseRateFcn = TLC_TRUE
If both of the listed conditions apply, and if you want to continue to work with your existing static main program and system target file, you must add an if statement to your static main program. In the section of your static main that updates event flags and checks for subrate overrun conditions, add the two lines shown in bold below:
for (i = FIRST_TID+1; i < NUMST; i++) {
if (rtmStepTask(RT_MDL,i) && eventFlags[i]++) {
OverrunFlags[0]--;
OverrunFlags[i]++;
/* Sampling too fast */
rtmSetErrorStatus(RT_MDL, "Overrun");
return;
}
if (++rtmTaskCounter(RT_MDL,i) == rtmCounterLimit(RT_MDL,i))
rtmTaskCounter(RT_MDL, i) = 0;
}Previously, nonreentrant code supported control of the model step function prototype. In R2008b, function prototype control includes control for initialization functions, simplifying code integration and testing, and reducing global RAM usage.
As part of this enhancement, the Model Interface dialog box has the following changes:
| Previous Model Interface Dialog Box | New Model Interface Dialog Box |
|---|---|
Function Specification parameter options:
| Function Specification parameter options:
|
| Preview subpane | Step function preview subpane |
| Configure function arguments subpane | Configure model initialize and step functions subpane |
| N/A | Initialize function name parameter |
| Function name parameter | Step function name parameter |
| Function argument table | Step function arguments table |
See Controlling Model Function Prototypes for more information.
Previously, if your model included a Stateflow chart that has the chart property Execute (enter) Chart At Initialization selected and the chart was connected to model inports or outports, during the build process a Stateflow diagnostic referenced this construct, but code was always generated.
In R2008b, if this construct is in your model and you are controlling the model function prototypes, the build process results in an error and code is not generated. To avoid this error, you can:
Place a Signal Conversion block between the root inport or outport and the Stateflow chart.
Select the Override optimizations and always copy signal parameter of the Signal Conversion block.
Previously, disabling test points set during debugging required you to disable each test point individually. Not disabling test points can lead to suboptimal generated code. In R2008b, the Real-Time Workshop software provides a single option to ignore all test points during code generation, facilitating transition from prototyping to deployment and avoiding accidental degradation of generated code due to workflow artifacts. See Ignore test point signals in the Real-Time Workshop documentation.
The enumerated type name BuiltinCSCAttributes_IncludeDelimeter has been renamed BuiltinCSCAttributes_IncludeDelimiter.
Up until R2007b, The MathWorks released built-in custom storage class definitions only in M-files. In R2008a and R2008b (the current release) The MathWorks released built-in custom storage class definitions in both M-files and P-files, creating a possible incompatibility. No R2008a release note appeared that described this change, but a note now appears in its correct location. See the R2008a release note Custom Storage Class File Type Changed for information about the change and the possible Compatibility Considerations that it introduced.
R2008b introduces a new configuration parameter to eliminate copies between local and global variables, reducing stack size and data copy operations. See Minimize data copies between local and global variables in the Simulink documentation for more information.
In R2008b, the following Simulink Configuration Parameters dialog box button label is updated:
| Location | Previous Parameter Label | New Parameter Label |
|---|---|---|
| Real-Time Workshop > Interface | Configure Step Function | Configure Model Functions |
The following demos have been added:
| Demo... | Shows How You Can... |
|---|---|
| rtwdemo_autosar_multirunnables_script | Configure and generate AUTOSAR-compliant code and export AUTOSAR software component description XML files for a Simulink model with multiple runnable entities. |
| rtwdemo_cppencap | Generate a customizable C++ encapsulation interface to code generated by the Real-Time Workshop Embedded Coder software. |
| rtwdemo_custom_pil | Create a custom processor-in-the-loop (PIL) configuration using target connectivity APIs. |
| rtwdemo_iec61508_script | Use Model Advisor checks to help you develop a model and code that comply with the IEC 61508 standard (uses Simulink® Verification and Validation™ software). |
| rtwdemo_pil | Compare results from Normal mode simulation and PIL mode execution for the same referenced model. |
The following demo has been enhanced in R2008b:
![]() | Real-Time Workshop Embedded Coder Release Notes | Version 5.1 (R2008a) Real-Time Workshop Embedded Coder Software | ![]() |
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |