Mathworks REAL-TIME WORKSHOP RELEASE NOTES

Real-Time Workshop Notes
®
Release
How to Contact The MathWorks
www.mathworks. comp.soft-sys.matlab Newsgroup www.mathworks.com/contact_TS.html T echnical Support
suggest@mathworks.com Product enhancement suggestions bugs@mathwo doc@mathworks.com Documentation error reports service@mathworks.com Order status, license renewals, passcodes info@mathwo
com
rks.com
rks.com
Web
Bug reports
Sales, prici
ng, and general information
508-647-7000 (Phone)
508-647-7001 (Fax)
The MathWorks, Inc. 3 Apple Hill Drive Natick, MA 01760-2098
For contact information about worldwide offices, see the MathWorks Web site.
®
Real-Time Workshop
© COPYRIGHT 2000–20 10 by The MathWorks, Inc.
The software described in this document is furnished under a license agreement. The software may be used or copied only under the terms of the license agreement. No part of this manual may be photocopied or reproduced in any form without prior written consent from The MathW orks, Inc.
FEDERAL ACQUISITION: This provision applies to all acquisitions of the Program and Documentation by, for, or through the federal government of the United States. By accepting delivery of the Program or Documentation, the government hereby agrees that this software or documentation qualifies as commercial computer software or commercial computer software documentation as such terms are used or defined in FAR 12.212, DFARS Part 227.72, and DFARS 252.227-7014. Accordingly, the terms and conditions of this Agreement and only those rights specified in this Agreement, shall pertain to and govern theuse,modification,reproduction,release,performance,display,anddisclosureoftheProgramand Documentation by the federal government (or other entity acquiring for or through the federal government) and shall supersede any conflicting contractual terms or conditions. If this License fails to meet the government’s needs or is inconsistent in any respect with federal procurement law, the government agrees to return the Program and Docu mentation, unused, to The MathWorks, Inc.
Trademarks
MATLAB and Simulink are registered trademarks of The MathWorks, Inc. See
www.mathworks.com/trademarks for a list of additional trademarks. Other product or brand
names may be trademarks or registered trademarks of their respective holders.
Patents
The MathWorks products are protected by one or more U.S. patents. Please see
www.mathworks.com/patents for more information.
Release Notes
Summary by Version ............................... 1
Contents
Version 7.5 (R2010a) Real-Time Workshop Software
Version 7.4 (R2009b) Real-Time Workshop Software
Version 7.3 (R2009a) Real-Time Workshop Software
Version 7.2 (R2008b) Real-Time Workshop Software
Version 7.1.1 (R2008a+) Real-Time Workshop
Software
Version 7.1 (R2008a) Real-Time Workshop Software
Version 7.0.1 (R2007b+) Real-Time Workshop
Software
Version 7.0 (R2007b) Real-Time Workshop Software
Version 6.6.1 (R2007a+) Real-Time Workshop
Software
........................................ 43
........................................ 52
........................................ 66
.. 5
.. 15
.. 26
.. 34
.. 44
.. 53
Version 6.6 (R2007a) Real-Time Workshop Software
Version 6.5 (R2006b) Real-Time Workshop Software
Version 6.4.1 (R2006a+) Real-Time Workshop
Software
Version 6.4 (R2006a) Real-Time Workshop Software
Version 6.3 (R14SP3) Real-Time Workshop Software
........................................ 82
.. 67
.. 74
.. 83
.. 95
iii
Version 6 .2.1 (R14S P 2 + ) Real-Time Workshop
Software
........................................ 102
Version 6.2 (R14SP2) Real-Time Workshop Software
Version 6.1 (R14SP1) Real-Time Workshop Software
Version 6.0 (R14) Real-Time Workshop Software
Version 5.2 (R13SP2) Real-Time Workshop Software
Version 5 .1.1 (R13S P 1 + ) Real-Time Workshop
Software
Version 5.1 (R13SP1) Real-Time Workshop Software
Version 5.0.1 (R13+) Real-Time Workshop Software
Version 5.0 (R13) Real-Time Workshop Software
Version 4.1 (R12.1) Real-Time Workshop Software
Version 4.0 (R12) Real-Time Workshop Software
........................................ 166
...... 114
...... 172
...... 217
.. 103
.. 113
.. 165
.. 168
... 169
.... 203
iv Contents
Compatibility Summary for Real-Time Workshop
Software
........................................ 233
SummarybyVersion
This table provides quick access to what’s new in each version. For clarification, see “Using Release Notes” on page 3 .
Real-Time Workshop®Release Notes
Version (Release)
Latest Versi V7.5 (R2010a
V7.4 (R2009b)
V7.3 (R2009a)
V7.2 (R2
V7.1.1 (R2008a+)
V7.1 (R2008a)
1 (R2007b+)
V7.0.
V7.0 (R2007b)
on
)
008b)
New Features and Changes
Yes Details
Yes Details
Yes Details
Yes Details
No No Bug Reports
Yes
ls
Detai
No No Bug Reports
Yes Details
Version Compatibilit Consideratio
Yes Summary
No Bug Reports
Yes Summary
Yes Summary
Yes Summa
Yes Summary
ry
Fixed Bugs
y
and Known
ns
Problems
Bug Reports Includes fix
Includes fixes
Bug Repor Includes
Bug Reports Includes fixes
Includes fixes
Bug Rep Inclu
Includes fixes
Bug Reports Includes fixes
ts
fixes
orts
des fixes
es
Related Documentation at Web Site
Printable Release Notes: PDF
Current product documentation
No
No
No
No
No
No
No
V6.6.1 (R2007a+)
.6 (R2007a)
V6
V6.5 (R2006b)
No No Bug
Inc
Yes Details
Yes Details
Yes Summary
Yes Summary
Bug Reports Includes fixes
Bug Reports Includes fixes
Reports
ludes fixes
No
No
No
1
Real-Time Workshop®Release Notes
Version (Release)
V6.4.1 (R2006a+)
V6.4 (R2006a)
V6.3 (R14SP3)
V6.2.1 (R14SP2+)
V6.2 (R14SP2)
V6.1 (R14SP1)
V6.0 (R14)
V5.2 (R13SP2)
V5.1.1 (R13SP1+)
New Features and Changes
Version Compatibility Considerations
Fixed Bugs and Known Problems
No No Bug Reports
Includes fixes
Yes Details
Yes Details
Yes Summary
Yes Summary
Bug Reports Includes fixes
Bug Reports Includes fixes
No No Bug Reports
Includes fixes
Yes Details
Yes
No Bug Reports
Includes fixes
No
Fixed bugs
Details
Yes Details
No No
Yes Details
Yes Summary
Yes Summary
Fixed bugs
Fixed bugs V5.2 product
Fixed bugs
Related Documentation at Web Site
No
No
No
No
No
No
No
documentation
No
V5.1 (R13SP1)
V5.0.1 (R13+ )
V5.0 (R13)
V4.1 (R12.1)
V4.0 (R12)
2
No No
Yes
No
Details
Yes Details
Yes Details
Yes Details
Yes Summary
Yes Summary
Yes Summary
Fixed bugs
Fixed bugs
Fixed bugs
Fixed bugs
No bug fixes
No
No
No
No
No
SummarybyVersion
Using Release No
Use release note
New features
Changes
Potential imp
Review the re product (for bugs, or comp
If you are up review the c you upgrad
What Is in t
New Featu
New func
Changes
s when upgrading to a new er version to learn about:
act o n your existing files and practices
lease notes for other M athWorks™ products required for this
example, MATLAB
atibility considerations in other products impact you.
grading from a softw are version other than the most recent one,
urrent release notes and all interim versions. For example, when
e from V1.0 to V1.2, review the release notes for V1.1 and V1.2.
he Release Notes
res and Changes
tionality
to existing functionality
tes
®
or Simulink®). Determine if enhancements,
Versio
When a n versi impac
Comp Repo in in comp
Fix
The vi
n Compatibility Considerations
ew feature or change introduces a reported incompatibil ity between
ons, the Compatibility Considerations subsection explains the
t.
atibility issues reported after the product release appear under Bug rts at The MathWorks™ Web site. Bug fixes can sometimes result compatibilities, so review the fixed bugs in Bug Reports for any
atibility impact.
ed Bugs and Known Problems
MathWorks offers a user-searchable Bug Reports database so you can
ew Bug Reports. The development team updates this database at release
3
Real-Time Workshop®Release Notes
time and as more information becomes available. Bug Reports include provisions for any known workarounds or file replacem ents. Information is available for bugs existing in or fixed in Release 14SP2 or later. Information is not avail able for all bugs in earlier releases.
Access Bug Reports using y our MathWorks Account.
4
Version 7.5 (R2010a) Real-Time Workshop™ Software
Version 7.5 (R2010a) Real-Time Workshop Software
This table summarizes what’s new in V7.5 (R2010a):
New Features and Changes
Yes Details below
Version Compatibility Considerations
Yes—Details labeled as Compatibility
Considerations
below. See also Summary
New features and changes introduced in this version are
“Improved Stack Analysis and Control” on page 6
“Embedded MATLAB Code Generation Enhancements” on page 6
“Code Optimizations for Multiple Blocks” on page 7
“New C++ (ISO) Math Library” on page 8
“C API Supports Programmatic Access to States in Target Applications”
on page 9
“Improved To File and From File MAT-File Loading and Logging for Rapid
Simulation Target” on page 10
“External Mode Support for Variable-Size Signals” on page 11
“HTML Code Generation Report Improvements” on page 11
Fixed Bugs an d Known Problems
Bug Reports Includes fixes
Related Documentation at Web Site
Printable Release Notes: PDF
Current product documentation
“Increased Efficiency of Division by Constant Power of 2” on page 11
“Legacy Code Tool Enhanced to Support Enumerated Data Types and
Structured Tunable Parameters” on page 12
“Configuration Parameter Ignore integer downcasts in folded expressions
Removed from Optimization Pane” on page 12
“Removing Launch old simprm dialog Bu tto n from Real-Time Workshop
Pane in Future Release” on page 13
5
Real-Time Workshop®Release Notes
“Removing Support for SimStruct with GRT-Based Targets in Future
Release” on page 13
“Model Advisor Check Being Removed in Future Release” on page 14
“Reserved Keywords Updated” on page 14
“Enhanced Demos” on page 14
Improved Stack Analysis and Control
R2010a introduces a new configuration parameter to specify the maximum stack size for a model. For details, see “Maximum stack size (bytes)” on the Optimization pane of the Configuration Parameters dialog box.
Improvements to the stack analysis during compilation of your model include:
Removing unnecessary global variables for large signals
Reducing RAM and ROM consumption and improving execution speed
Better accuracy in determining stack size to prevent stack overflow
Embedded MATLAB Code Generation Enhancements
Support for Generating C++ Code Interfaces
emlc now produces code interfaces that let you call the generated code from a
C++ environment. See .
Support for Multiple Entry Points for emlc
You can now simultaneously compile more than one entry-point MATLAB file with
emlc, enabling you to create C libraries that contain multiple compiled
MATLAB files. This enhancement provides these benefits:
Efficient sharing of code between library functions.
Ability to communicate between library functions using shared memory.
For m ore information, see “Compiling More Than One Entry-Point MATLAB Function” in the Real-Time Workshop
6
®
documentation.
Version 7.5 (R2010a) Real-Time Workshop™ Software
Support for Global Data
emlc now supports global data. With this feature, you can define and use
global data in Embedded MATLAB porting existing MATLAB code that uses global variables to Embedded MATLAB.
For more information, see “Generating C/C++ Code from MATLAB Code That Uses Global Data” in the Real-Time Workshop documentation.
®
compliant code. This feature facilitates
New Code Style Options for ERT-based Targets
The Real-Time Workshop Dialog Box for Embedded MATLAB Coder has a ne w Code Style tab that provides the following options for ERT-based targets.
Option Description
Parentheses level
Specify parenthesization style for generated code. The default
Convert if-elseif-else patterns to switch-case statements
level is
readability)
Specify whether to generate code for if-elseif-else decision logic as
Nominal(Optimize for
.
switch-case statements. By default, this option is not selected.
Preserve extern keyword in function declarations
Specify whether to include the extern keyword in function declarations in the generated code. By default, this option is selected.
For details, see “Code Style Tab” in the Real-Time Workshop Reference.
Code Optimizations for Multiple Blocks
The Real-Time Workshop build process uses a new technique to provide more efficient code for the following blocks:
Backlash
Quantizer
7
Real-Time Workshop®Release Notes
Signal Generator
Benefits include:
Reuse of variables
Dead code elimination
Constant folding
Expression folding
For example, in previous releases, temporary buffers were created to carry concatenated signals for these blocks. In R2010a, the Real-Time Workshop build process eliminates unnecessary temporary buffers and writes the concatenated signal to the downstream global buffer directly. This enhancement reduces the stack size and improves code execution speed.
New C++ (ISO) Math Library
R2010a adds a C++ (ISO) math library to the set of target-specific math libraries you can select using the Target function library parameter on the Real-Time Workshop > Interface pane of the Configuration Parameters dialog box.
If you select the C++ (ISO) math library for your model, the build process generates calls to the ISO
®
/IEC 14882:2003 C++ standard math library where
appropriate for math functions and operators in your m odel.
8
Version 7.5 (R2010a) Real-Time Workshop™ Software
Note The C++ (ISO) math library is available for use only if you select a compatible value for the Language parameter on the Real-Time Workshop pane of the Configuration Parameters dialog box:
For the GRT target, select
For an ERT-based target, select
Using the ERT target and the requires a Real-Time Workshop
C++.
C++ or C++ (Encapsulated).
C++ (Encapsulated) value for code generation
®
Embedded Coder™ license.
For more information, see the “Target function library” parameter. F or an illustration of math library selection and use, see the demo
rtwdemo_clibsup.
C API Supports Programmatic Access to States in Target Applications
The C API allows your application to interact with signals and parameters in a model’s generated code. In R2010a, the C API adds support for interacting with states. This change allows applications to monitor, log, or modify states in the generated code .
To generate model code with the necessary information to support programmatic acces s to states, select the model option Generate C API for: states on the Interface pane of the Configuration Parameters dialog box. This model option is a vailable only if you selected the value model parameter Interface in the Data exchange group.
C API for the
our C or C++ application, you can interact with states using macros
In y
vided in the file
pro
resents the root of your MATLAB ins tallation directory).
rep
matlabroot/rtw/c/src/rtw_capi.h (where matlabroot
9
Real-Time Workshop®Release Notes
For more information, see “Example: Using the C API to Access Model Signals and States”. For an illustration of generating a C API interface to signals, states, and parameters in a target application, see
Improved To File and From File MAT-File Loading and Logging for Rapid Simulation Target
In previous releases, you could use the To File and From File blocks to log and load MAT-file data, but restrictions on Rapid Simulation (RSim) code generationforToFileandFromFilecould p revent the results of executing RSim generated code from matching the results of Simulink simulations. RSim generated code for To File and From File blocks was subject to limitations, including the following:
You could log or load only real, one-dimensional data of type double in
array format. Fixed-point objects were converted to
FromFileblocksloadedtheentireMAT-fileintomemoryatonce.
To File blocks could not log more than 10
8
elements.
rtwdemo_capi.
double.
10
R2010a enhances the RSim generated code for To File and From File blocks to remove those limitations. In the generated code, To File and From File blocks now incrementally log and load MAT-file data regardless of dimension, complexity, or type. The p otential benefits include the following:
Incremental logging and loading reduces memory consumption.
Ability to read and write into
visualization capabilities.
Directly log and load fixed-point objects without conversion to
Executing RSim generated code now p roduces identical results to Simulink simulationforToFileandFromFileblocks.
timeseries objects expands debugging and
double.
To File and From File Limitations for RSim Code Generation
To File and From File blocks cannot log and load multiword (33+ bit)
fixed-point data types.
To File and From File blocks do not support buses.
Version 7.5 (R2010a) Real-Time Workshop™ Software
UsingToFileandFromFileblockswithtimeseries objectsissupported
only for Version 7.3 or later MAT-files.
From File block cannot load enumerated data types.
From File block incremental loading is supported only for Version 7.3 or
later MAT-files.
External Mode Support for Variable-Size Signals
R2010a adds support for uploading and viewing variable-size signals during External mode and Rapid Accelerator mode simulations.
HTML Code Generation Report Improvements
In R2010a, the Generated Files list on the Code Generation Report now organizes files by category. In addition, the Code Generation Report now includes shared utility files in the Shared Utility files category. By expanding or collapsing each category, you can more easily find generated files. Som e categories might not appear if they are empty. See “HTML Code Generation Reports”, for more information.
Increased Efficiency of Division by Constant Power of 2
In R2010a, theReal-Time Workshop software no longer unconditionally replaces divisions by constant power of 2 with casts. The software now replaces division by constant power of 2 with a cast only if this replacement results in less generated code. This enhancement relies on the target compiler to optimiz e the division appropriate to the target processor.
The decision whether to replace the division is based on these guidelines:
If the replacement by a cast results in extra rou n ding code, Real-Time
Workshop does not replace the division.
If the division requires a helper function, Real-Time Workshop replaces the
division with a cast even if the cast requires extra rounding code.
For more information, see “Improving Efficiency of Code That Uses Division by Constant Power of 2”.
11
Real-Time Workshop®Release Notes
Legacy Code Tool Data Types and St
The Legacy Code T
Enumerated da
Structured tu
For more info see “Support Tool, see
“Integrati
Code Tool” i
“Automati
Legacy Cod
Simulink
ng Existing C Functions into Simulink Models with the Legacy
l
ool has been enhanced to support
ta types for input, output, parameters, and work vectors
nable parameters
rmation about data types that the Legacy Code Tool supports,
ed Data Types”. For more information a bo ut the Legacy Code
n the Writing S-Functions documentation
ng Generation of Files for Fully Inlined S-Functions Using
e T ool” in the Real-Time Workshop documentation
egacy_code
Enhanced to Support Enumerated
ructured Tunable Parameters
function reference page
Compatibility Considerations
For enum
If you up
can con compil
erated data type support:
grade from a release that is greater than or equal to R 2008b, you
tinue to compile the S-function source code and continue to use the
ed output from an earlier release without recompiling the code.
12
If you u
enume simul
You ca arel
Conf in f Pan
The
pressions, is no longer available on the Optimization pane of the
ex
pgrade from a release that is less than R2008b, you cannot use
rated types; the Simulink engine will display an e rror during
ation.
nnot use tunable structured parameters with Legacy Code Tool in
ease less than R2010a.
iguration Parameter Ignore integer downcasts
olded expressions Removed from Optimization
e
expression folding option, Ignore integer downcasts in folded
Version 7.5 (R2010a) Real-Time Workshop™ Software
Configuration Parameter dialog box. In R2010a, the code generation process continues to evaluate this parameter.
Compatibility Considerations
The equivalent command line parameter, EnforceIntegerDowncast,isstill available for this optimization. However, a warning message displays if it is set to
off. It is recommended that you set EnforceIntegerDowncast to on.
EnforceIntegerDowncast will be removed in a future release.
Removing Launch old simprm dialog Button from Real-TimeWorkshopPaneinFutureRelease
Support for th e old Simulation Parameters dialog box will be removed in a future release. Selecting the Launch old simprm dialog... buttononthe Real-Time Workshop pane displays a warning message. It is recommended that you update the Configuration Parameter dialog box format.
rtwoptions callbacks for your target to support the
Removing Support for SimStruct with GRT-Based Targets in Future Release
Support for using the SimStruct data structure and access macros with GRT-based targets will be removed in a future release. Attempting to use
SimStruct with a GRT target generates a w a rning message. If you receive
this warning, you should transition your target to using the structure and access macros. For more information about updating your target, see ”Converting Your TargettoUsertModel”intheReal-Time Workshop documentation.
rtModel data
13
Real-Time Workshop®Release Notes
Model Advisor Ch
eck Being Removed in Future
Release
Check Name What Happens
When You Use the Check?
Disable signa logging
l
Still runs “Identify
Use This Instead
questionable code instrumentation (data I/O)”
Compatibility Considerations
Disable signa logging is no
recommended Use “Identif
questionab code instrument (data I/O)
instead.
le
ation
Reserved Keywords Updated
In R2010a, the Real-Time Workshop software adds the following reserved keywords to the Real-Time W orkshop C keywords list.
localB localP localXd
localC localX localZ
DWork
local
For details, see “Reserved Keywords”.
local
Xdis
local
ot
CSV
ZCE
l
t .
y
Enhanced Demos
The following demos have been enhanced in R2010a:
Demo... Now...
rtwdemo_capi
rtwdemo_clibsup
14
Illustrates generating a C API interface to states in the target application.
Illustrates sele ction of th e C++ (ISO) math library.
Version 7.4 (R2009b) Real-Time Workshop™ Software
Version 7.4 (R2009b) Real-Time Workshop Software
This table summarizes what’s new in V7.4 (R2009b):
New Features and Changes
Yes Details below
Version Compatibility Considerations
No Bug Reports
New features and changes introduced in this version are
“Improved User Guide Documentation” on page 16
“Support for Variable-Size Signals” on page 16
“ASAP2 File Generation Enhancements” on page 16
“More Efficient Generated Code for Rate Transition Blocks” on page 17
“Enhanced Generated Code for G RT malloc Target” on page 17
“More Efficient Generated Code for Enabling Subsystems” on page 17
“More Efficient Generated Code for Vector Initialization” on page 18
“Lookup Table (n-D) Block Supports Parameter Data Types Different from
Signal Data Types” on page 18
“Reduced Memory Use and More Efficient Code for Evenly Spaced
Breakpoints in Prelookup and Lookup T able (n-D) Blocks” on page 19
Fixed Bugs an d Known Problems
Includes fixes
Related Documentation at Web Site
No
“Math Function Block Enhancements for Code Generation” on page 19
“Code for Multiport Switch Block Shows Enumerated Values” on page 20
“Code Optimizations for Multiple Blocks” on page 20
“Embedded MATLAB Code Generation Enhancements” on page 21
“Enhanced Model Advisor Check Identifies Opportunities to Improve Code
Efficiency” on page 22
“Removing Compiler Options Configuration Object in a Future Release”
on page 23
15
Real-Time Workshop®Release Notes
“Removing Ignore integer downcasts in folded expre ssions in Future
Release” on page 25
“Reserved Keywords Updated” on page 25
Improved User Guide Documentation
The Real-Time Workshop User’s Guide has been reorganized and consolidated to better support user workflows.
Support for Variable-Size Signals
R2009b supports code generation for all Simulink blocks that support variable-size signals. See “Simulink Block Support for Variable-Size Signals”.
ASAP2 File Generation Enhancements
ASAP2 Files Now Generated for Each Referenced Model In Model Reference Hierarchy
In previous releases, ASAP2 file generation for a model reference hierarchy did not provide any visibility into the signals and states inside referen ced models.
16
Beginning with R2009b, the build process can generate an referenced model in a model reference hierarchy. In the generated ASAP2 file, MEASUREMENT objects represent signals and states inside the referenced model.
To generate ASAP2 files for referenced models, select ASAP2 file generation for the top model and for each referenced model in the reference hierarchy. To do this, select the value pane of the Simulink Configuration Parameters dialog box.
ASAP2 for the Interface parameter on the Interface
.a2l file for each
Enhanced ASAP2 File Generation for Two-Dimensional Lookup Table Blocks
In previous releases, the build process supported ASAP2 file generation for Lookup Table (2-D) blocks, but not for other forms of two-dimensional lookup
Version 7.4 (R2009b) Real-Time Workshop™ Software
table blocks, such as Lookup Table (n-D) and Interpolation Using Prelookup blocks when table dimensions equal 2.
R2009b supports ASAP2 file generation for Lookup Table (n-D) and Interpolation Using Prelookup blocks when table dimensions equal 2. This provides more consis tent generated ASAP2 data across multiple types of two-dimensional lookup table blocks. For example, if you are using A SAP2 data for calibration, you can use either the Lookup Table (2-D) block or the Lookup Table (n-D) block in your models.
More Efficient Generated Code for Rate Transition Blocks
R2009b improves the generated code for Rate Transition blocks in the following ways:
Removes redundant code that protects data integrity if the data type is
int8 or uint8. The Rate Transition block algorithm assumes that int8
or uint8 access is atomic.
Removes redundant initialization code that executes when the IC (initial
signal value) is 0.
Enhanced Generated Code for GRT malloc Target
Generated code for the grt_malloc.tlc target (Generic Real-Time Target with dynamic memory allocation) has been refactored for consistency with the
grt.tlc (Generic Real-Time Target) and ert.tlc (Real-Time Workshop
Embedded Coder) targets.
More Efficient Generated Code for Enabling Subsystems
R2009b optimizes the generated code for enabling a subsystem by removing redundant mode-checking logic for the case where the enable signal is single-rate.
17
Real-Time Workshop®Release Notes
More Efficient Generated Code for Vector Initialization
The generated code for vector initialization now uses the C standard library function memset to initialize floats and doubles to 0.0” on the Optimization pane of the Configuration Parameters dialog box controls whether this optimization is applied to a vector of type this optimization is dependent on your compiler, target platform, and size of the vector.
Lookup Table (n-D) Block Supports Parameter Data Types D ifferent from Signal Data Types
The Lookup Table (n-D) block supports breakpoint data types that differ from input data types. This enhancement provides these benefits:
Lower memory requirement for storing breakpoint data that uses a smaller
type than the input signal
Sharing of prescaled breakpoint data between two Lookup Table (n-D)
blocks with different input data types
memset instead o f a for loop. The configuration parameter, “Use
float or double. Efficiency improvement for
18
Sharing of custom storage breakp oint data in Real-Time Work sh op
generated code for blocks with different i nput data types
The Lookup Table (n-D) block supports table data types that differ from output data types. This enhancement provides these benefits:
Lower memory requirement for storing table data that uses a smaller type
than the output signal
Sharing of prescaled table data between two Lookup Table (n-D) blocks
with different output data types
Sharing of custom storage table data in Real-Time Workshop generated
code for blocks with different output data types
The Lookup Table (n-D) block also supports separate data type specification for intermediate results. This enhancement enables use of a higher precision for internal computations than for table data or output data.
Version 7.4 (R2009b) Real-Time Workshop™ Software
Reduced Memory Use and More Efficient Code for Evenly Spaced Breakpoints in Prelookup and Lookup Table (n-D) Blocks
For the Prelookup and Lookup Table (n-D) blocks, Real-Time Workshop generated code now stores only the first breakpoint, spacing, and number of breakpoints when:
The breakpoint data is n ot tunable.
The index search method is
This enhancement reduces memory use and provides faster code execution. Previously, the code stored all breakpoint values in a set, regardless of the tunability or spacing of the breakpoints.
The following enhancements also provide more efficient code for the two blocks:
Block
Lookup Table (n-D) Removal of unnecessary bit shifts for
Prelookup and Lookup Table (n-D) Use of simple division instead of
Evenly spaced points.
Enhancement for Code Efficiency
calculating the fraction
computationally expensive function calls for calculating the index and fraction
Math Function Block Enhancements for Code Generation
The Math Function b lock now supports Real-Time Workshop code generation in these cases:
Complex input and output signals for the
floating-point data types
Fixed-point data types with fractional slope and nonzero bias for the
magnitude^2, square,andreciprocal functions
pow function, for use with
19
Real-Time Workshop®Release Notes
Code for Multiport Switch Block Shows Enumerated Values
In previous releases, generated code for a Multiport Switch block that uses enumerated data contains the underlying integer for each enumerated value rather than its name. In R2009b, the code contains the name of each enumerated value rather than the underlying integer. This change adds readability and facilitates comparing the code with the model, but has no effect on the behavior of the code.
For more information, see “Using Enumerated Data” in the Simulink documentation and “Enumerated Data Type Considerations” in the Real-Time Workshop documentation.
Code Optimizations for Multiple Blocks
The Real-Time Workshop build process uses a new technique to provide more efficient code for the following blocks:
Direct Lookup Table (n-D)
20
Dot Product
Integer Delay
Math Function
Rate Limiter
Rounding Function
Shift Arithmetic
Tapped Delay
Trigonometric Function
Weighted Sample Time
Weighted Sample Time Math
Benefits include:
Reuse of variables
Dead code elimination
Version 7.4 (R2009b) Real-Time Workshop™ Software
Constant folding
Expression folding
For example, in previous releases, temporary buffers were created to carry concatenated signals for these blocks. In R2009b, the Real-Time Workshop build process eliminates unnecessary temporary buffers and writes the concatenated signal to the downstream global buffer directly. This enhancement reduces the stack size and improves code execution speed.
Embedded MATLAB Code Generation Enhancements
emlc Generates Code for Variable-Size Arrays and Matrices
emlc now generates MEX and C code for variable-size arrays and matrices
with known upper bounds. With this capability, you can define inputs, outputs, and local variables in Embedded MATLAB compliant code to represent data that varies in size at runtime.
New C MEX Configuration Options for Controlling Runtime ChecksforFasterPerformance
In simulation, emlc generates code that includes runtime checks and external calls. To reduce the size of the generated code, and potentially improve performance, you can use new C-MEX compilation options to control whether your generated code performs:
Integrity checks that detect violations of memory integrity in the generated
code
Responsiveness checks that periodically check for Ctrl+C breaks and
refresh graphics
Extrinsic calls to MAT LAB functions
For more information, see “Automatic C MEX Generation Dialog Box for Embedded MATLAB Coder” in the Real-Time Workshop Reference.
21
Real-Time Workshop®Release Notes
emlc Eliminates Redundant Copies of Top-Level Function Inputs
emlc now optimizes generated C code by passing a top-level argument by
reference without a copy whenever the argument is used as both an input and an output. For example, for passed by reference.
Ability to Control File Partitioning
You can now control file partitioning when generating C code from Embedded MATLAB compliant code with you can specify whether to generate all code in a single C file, or to generate code for each MATLAB file in a corresponding C file. For more information, see “How emlc Generates Code” in the Real-Time Workshop User’s Guide.
New Runtime Stack for Embedded MATLAB Functions
New runtime stack to help you determine the source of runtime errors in your Embedded MATLAB functions. The runtime s tack provides information about the function that generated the error and the sequence of function calls that led up to the execution of this function. For more information, see Debugging Runtime Errors in the Real-Time Workshop User’s Guide.
[a b c] = foo(x,b,z),argumentb will be
emlc. Using a new file partition method option,
22
Enhanced Model Advisor Check Identifies Opportunities to Improve Code Efficiency
The Model Advisor Identify questionable fixed-point operations check can:
ProvideadviceonwhentousethenewUse integer division to handle
netslopesthatarereciprocalsofintegersoptimization parameter
For more information, see “Use integer division to h andle net slopes that are reciprocals of integers” in the Simulink Graphical User Interface.
Identify opportunities to improve efficiency of generated code for Lookup
Table(n-D)blocksinthefollowingcases:
Breakpoint Spacing Index Search Method
Uneven Not Evenly spaced points
Not
Even, power of 2
Evenly spaced points
Version 7.4 (R2009b) Real-Time Workshop™ Software
Breakpoint Spacing Index Search Method
Even, not power of 2
For more information, see “Identify questionable fixed-point operations” in the Real-Time Workshop Reference.
Not Evenly spaced points
Evenly spaced points
Removing Compiler Options Configuration Object in a Future Release
In R2009b, Embedded MATLAB Coder still accepts the Compiler Options configuration object. In future versions of the Real-Time Workshop software, Embedded MATLAB Coder will no longer accept the Compiler Options configuration object.
Compiler options parameters are now available from the C MEX configuration object, the Automatic C MEX Generation dialog box, the Real-Time Workshop configuration object or the Real-Time Workshop dialog box for Embedded MATLAB Coder. To access the Compiler options parameters, use
The C MEX configuration object or the Automatic C MEX Generation
dialog box to specify all parameters for C MEX generation using Embedded MATLAB Coder
The Real-Time Workshop configuration object or the Real-Time Workshop
dialog box for Embedded MATLAB Coder to specify all parameters fo r embeddable C code generation using Embedded MATLAB Coder
Changes to Automatic C MEX Generation Dialog Box
Changes to General Tab. These parameters now appear on the General
tab:
Use BLAS library if possible
Saturate on integer overflow
For more information, see “General Tab” in the “Automatic C MEX Generation Dialog Box for Embedded MATL AB Coder” documentation.
23
Real-Time Workshop®Release Notes
New Advanced Tab. These parame ters now appear on the Advanced Tab:
Inline Threshold
Inline Threshold Max
Inline Stack Limit
Stack Usage Max
Constant Folding Timeout
For more information, see Advanced Tab in the “Automatic C MEX Generation Dialog Box for Embedded MATL AB Coder” documentation.
Changes to Real-Time Workshop Dialog Box for Embedded MATLAB Coder
Changes to the General Tab. The Saturate on integer overflow
parameter now appears on the General tab.
24
For more information, s ee “General Tab” in the “Real-Time Workshop Dialog Box for Embedded MATLAB Coder” documentation.
New Advanced Tab. These parameters now appear on the new Advanced Tab:
Inline Threshold
Inline Threshold Max
Inline Stack Limit
Stack Usage Max
Constant Folding Timeout
For more information, see Advanced Tab in the “Real-Time Workshop Dialog Box for Embedded MATLAB Coder” documentation.
Version 7.4 (R2009b) Real-Time Workshop™ Software
Removing Ignore integer downcasts in folded expressions in Future Release
The expression folding option, Ignore integer downcasts in folded expressions, is being removed in a future release. In R2009b, the code
generation process continues to evaluate the option.
Reserved Keywords Updated
In R2009b, the Real-Time Workshop software adds the following reserved keywords to the Real-Time Workshop Target Function Library language keywords list.
ldexpf muIntScalarMin_sint16 rt_mod_sint32
muDoubleScalarSinCos muIntScalarMin_sint32 rt_mod_uint8
muIntScalarAbs_sint8 muIntScalarMin_uint8 rt_mod_uint16
muIntScalarAbs_sint16 muIntScalarMin_uint16 rt_mod_uint32
muIntScalarAbs_sint32 muIntScalarMin_uint32 rt_mod32
muIntScalarAbs_uint8 muIntScalarSign_sint8 rt_rem_boolean
muIntScalarAbs_uint16 muIntScalarSign_sint16rt_rem_sint8
muIntScalarAbs_uint32 muIntScalarSign_sint32rt_rem_sint16
muIntScalarMax_sint8 muIntScalarSign_uint8 rt_rem_sint32
muIntScalarMax_sint16 muIntScalarSign_uint16rt_rem_uint8
muIntScalarMax_sint32 muIntScalarSign_uint32rt_rem_uint16
muIntScalarMax_uint8 rt_mod rt_rem_uint32
muIntScalarMax_uint16 rt_mod_boolean rtStopExecution
muIntScalarMax_uint32 rt_mod_sint8 sf_SREM
muIntScalarMin_sint8 rt_mod_sint16
For details, see “Reserved Keywords” in the Real-Time Workshop documentation.
25
Real-Time Workshop®Release Notes
Version 7.3 (R2009a) Real-Time Workshop Software
This table summarizes what’s new in V7.3 (R2009a):
New Features and Changes
Yes Details below
Version Compatibility Considerations
Yes—Details labeled as Compatibility Considerations, below. See also Summary.
“Parallel Builds Accelerate Code Generation and Compilation for Large
Model Reference Hierarchies” on page 27
“External Mode Simulation Now Supports Parameter and Signal Values
with Data Types Larger Than 32 Bits” on page 27
“Ability to Multiplex C ompatible Asynchronous Function Calls” on page 28
“Ability to Control Safe Cast Code Generated for Enumerate d Types” on
page 28
“Open Watcom C/C++ Compiler Support for Model Reference Builds” on
page 28
“New Compilation Report for emlc” on page 28
“emlc Support for Emulation Code Generation Target” on page 29
Fixed Bugs an d Known Problems
Bug Reports Includes fixes
Related Documentation at Web Site
No
26
“Code Optimizations for Multiple Blocks” on page 29
“Changes to the Signal Properties Dialog Box” on page 30
“New Reference Pages” on page 32
“New Real-Time Worksho p Reserved Keywords” on page 33
“New and Enhanced Demos” on page 33
Version 7.3 (R2009a) Real-Time Workshop®Software
Parallel Builds Compilation for
R2009a provides models contain models in para code generati multicore hos Referenced Mo
For informat parallel bui Workshop Us
External M and S ignal
the ability to accelerate code ge neration and compilation for ing large model reference hierarchies by building referenced llel whenever possible. For example, you can distribute
on and compilation for each model block across the cores of a
t computer. For more information, see “Reducing Build Time for
dels” in the Real-Time Workshop User’s Guide.
ion on how to configure a custom embedded target to support
lds, see “Supporting Model Referencing” in the R eal-Time
er’s Guide.
ode Simulation Now Supports Parameter
Values with Data Types Larger Than 32
Bits
External paramete bits, inc
Multiwo
system
mode simulation now supports the ability to upload and download
r values and upload signal values with data types larger than 32
luding
rd data types, such as a 128-bit fixed-point integer on a 32-bit
Accelerate Code Generation and
LargeModelReferenceHierarchies
64-bit
Extern and ta For ex using of tw
Befo Work
s, but external mode simulation did not.
bit
long on a 64-bit system
al mode simulatio n seamlessly supports interaction between host
rget platforms with different native sizes and different endianness. ample, you can upload a 64-bit quantity from a 64-bit target system, a 64-bit long, to a 32-bit host system, using a multiword comprised
o 32-bit integers.
re this release, Simulink normal mode simulation and Real-Time
shop code generation supported fixed-point data types larger than 32
27
Real-Time Workshop®Release Notes
Ability to Multi Function Calls
R2009a provides calls, provide enhancement a algorithmic c inserting b lo
Before this c to multiplex code, but req each asynch no interven
R2009a rem an asynchr direct and base rate
timer.
Ability Enumera
In previ block a type. I
intege
for mor
ous releases, code generated for a Simulink Data Type Conversion
lways used a safe cast function when casting data to an enumerated
n R2009a, such code uses safe casting only if the block’s Saturate on
r overflow option is selected. See “Enumerated Type Safe Casting”
e information.
the ability to more flexibly multiplex asynchronous function
d they have equal priority and use the base rate timer. This
llows you to model asynchronous events that need to share
ode in a natural way, without resorting to workarounds such as
cks that do not intuitively contribute to your design.
hange, the Real-Time Workshop software supported the ability
compatible asynchronous function calls for sharing algorithmic uired that each caller was at the top level of its task. That is,
ronous function call had to connect directly to the Mux block, with
ing calls to other blocks.
oves the requirement that each caller must be at the top level o f
onous task, so that you can freely multiplex any combination of
cascaded asynchronous function calls of equal priority that use the
to Control Safe Cast Code Generated for
ted Types
plex Compatible Asynchronous
28
Open W Refe
The R
+ compiler for builds of m odels with model reference hierarchies on 32-bit
C/C+
ows platforms. Previously, model reference builds were not supported.
Wind
New
new compilation report provides compile-tim e type information for the
The
riables and expressions in your MATLAB code. This information simplifies
va
atcom C/C++ Compiler Support for Model
rence Builds
eal-Time Workshop software now supports use of the Open Watcom
Compilation Report for emlc
Version 7.3 (R2009a) Real-Time Workshop®Software
finding sources of error messages and aids understanding of type propagation rules. For more information, see “Working with Compilation Reports” in the Real-Time Workshop User’s Guide.
Compatibility Considerations
The following internal and external browsers do not support the new compilation report:
MATLAB internal browser (on 64-bit UNIX
MACI internal browser
®
Microsoft Internet Explorer
To view the compilation report, yo u must have your MATLAB Web preferences configured to use an external browser, for example, Mozilla Firefox. To learn how to configure your MATLAB Web preferences, see “Specifying the System Browser for UNIX Platforms” in the MATLAB documentation.
6
®
platforms only)
emlc Support for Emulation Code Generation Target
emlc now supports both productio n and emulation code generation targets.
For more information, see “Hardware Implementation Dialog Box for Embedded MATLAB Coder” in the Real-Time Workshop Reference.
Code Optimizations for Multiple Blocks
The Real-Time Workshop build process uses a new technique to provide more efficient code for the following blocks:
Abs
Pulse Generator
Random Number
Relay
Uniform Random Number
Benefits include:
29
Real-Time Workshop®Release Notes
Reuse of variables
Dead code elimination
Constant folding
Expression folding
Changes to the Signal Properties Dialog Box
The appearance of the Real-Time Workshop tab of the Signal Properties dialog box has changed in R2009a. The Real-Time W orkshop tab previously looked like this by default:
30
In R2009a, the tab looks like this by default:
Version 7.3 (R2009a) Real-Time Workshop®Software
The changes between R2008b and R2009a are:
A new property, Package, exists at the top of the tab. When the value of
Package is
The RTW storage class property has been renamed Storage class.Itis
functionally unchanged and has the same API as in R2008b.
The RTW storage type qualifier property has been renamed Storage
type qualifier. It is functionally unchanged and has the same API, but its
GUI behavior is different:
--- None ---, the rest of the tab behaves as it did in R2008b.
- RT W storage type qualifier was always visible, but was active only
when it was applicable.
- Storage type qualifier is visible only when it is applicable, and is
hidden otherwise.
ThenextfigureshowstheStorage type qualifier property, which is visible because it is applicable when the Storage class is
ImportedExternPointer.
31
Real-Time Workshop®Release Notes
For information about using Storage class and Storage type qualifier with GRT targets, see “Signal Considerations” and “Simulink Data Object Considerations”.
32
For information about using Package, Storage class,andStorage type qualifier with ERT targets, see “Applying CSCs to Parameters and Signals”
in the Real-Time Workshop Embedded Coder documentation.
New Reference Pages
Existing Real-Time Workshop functions shown in the following table, are now documented in reference pages.
Function Description
rtwbuild
rtwrebuild
tlc
Initiate the build process
Rebuild generated code
Invoke the Target Language Compiler
Version 7.3 (R2009a) Real-Time Workshop®Software
Demo...
rtwdemo_usingrtw
New Real-Time Wo
Matrix and vecto list. For more in
New and Enhanc
Beginning wit format to disp Coder demos.
Indentation
Indentatio Embedded Co
If a demo req
demo namin
The follow
ing demo has been added in R2009a:
r are now on the Real-Time Workshop Language Keywords
formation, see “Reserved Keywords”.
ed Demos
h R2009a, the Real-Time Workshop Demos page uses a new lay Real-Time Workshop and Real-Time Workshop Embedded
The differences include:
now is used to designate a functionally-related group of demos.
n no longer identifies demos for which the Real-Time Workshop
der software is required.
uires Real-Time Workshop Embedded Coder software, the
g or text identifies the requirement.
Shows Ho w You Can...
Quickly g enerate C code for real-time simulation, rapid prototyping, or hardware-in-the-loop (HIL) testing applications. You sele ct a Real-Time W orkshop target for a model, generate code, and view the resulting files.
rkshop Reserved Keywords
33
Real-Time Workshop®Release Notes
Version 7.2 (R2008b) Real-Time Workshop Software
This table summarizes what’s new in V7.2 (R2008b):
New Features and Changes
Yes Details below
Version Compatibility Considerations
Yes—Details labeled as Compatibility Considerations, below. See also Summary.
New features and changes introduced in this version are
“Support for Enumerated Data Types in Generated C Code” on page 35
“Support for Simulink Legacy Code Tool Enhancement” on page 35
“emlc Support for Fixed-P oint Data Types Greater Than 32 Bits (Up to
128 Bits)” on page 36
“File Structure of C Code Generated by emlc Now Matches MATLAB F ile
Structure” on page 36
“emlc Uses Same Trigonometric FunctionsasMATLAB”onpage37
“Improperly-Scaled Fixed-Point Relational Operators Now Match MATLAB
Results” on page 37
“emlc Now Prevents Default fimath Mismatches for MEX Functions” on
page 37
Fixed Bugs an d Known Problems
Bug Reports Includes fixes
Related Documentation at Web Site
No
34
“Ability to Op timize Code for Vector Assignments by Replacing for-Loops
with memcpy” on page 37
“Rate Transition Support Enhanced for Signal Line Branching and Direct
Connections Between Asynchronous Rates” on page 38
“Generated Code Includes Standard C Static Files (stddef.h and stdlib.h)
Only When Necessary” on page 39
“MISRA C Code Initialization Enhancements” on page 39
Version 7.2 (R2008b) Real-Time Workshop®Software
“Ability to Register Keywords to Avoid Conflicts with External Code” on
page 40
“Use Same Custom Code Settings for Model Simulation and Real-Time
Workshop Code Generation” on page 40
“Configure Unique Custom Code Settings for Library Models in the
Configuration Parameters Dialog Box” on page 41
“Flexible Configuration Options for Referenced Models in TLC-Based
Custom Targets” on page 41
“Optimize Floating-Point to Integer Data Type Conversions Using New
Configuration Parameter” on page 42
“New and Enhanced Demos” on page 42
Support for Enumerated Data Types in G enerated C Code
Real-Time Workshop software now supports enumerated data types in code generated for Simulink models and Stateflow
®
charts. For details, see:
“Using Enumerated Data” in the Simulink documentation
“Using Enumerated Data in Stateflow Charts”
“Enumerated Data Type Considerations”
Support for Simulink Legacy Code Tool Enhancement
The Real-Time Workshop software supports the new Legacy Code Tool S-function options field,
Requires you to generate and manage an inlined S-function as only one file
(
.cpp)insteadoftwo(.c and .tlc)
Maintains model code style — level of parentheses usage and preservation
of operand order in e xpressions and condition expressions in statements—as specified by model configuration parameters
When you choose not to use this option, code generated by the Legacy Code Tool does not reflect code style configuration settings and requires you to manage C MEX and TLC files.
singleCPPMexFile.Whenset(1), this option
if
35
Real-Time Workshop®Release Notes
For more information, see
“Integrating Existing C Functions into Simulink Models with the Legacy
Code Tool” in the Writing S-Functions documentation
“Automating Generation of Files for Fully Inlined S-Functions Using
Legacy Code Tool” in the Real-Time Workshop documentation
legacy_code function reference page
Compatibility Considerations
If you upgrade from an earlier release, you can continue to use S-functions
generated from the Legacy Code Tool available in earlier releases. You can continue to compile the S-function source code and you can continue to use the compiled out pu t from an earlier release without recompiling the code.
If you set the new
an S-function, you cannot use that S-function, in source or compiled form, with versions of Simulink earlier than Version 7.2 (R2008b).
singleCPPMexFile options field to true (1) when creating
emlc Support for Fixed-Point Data Types Greater Than 32 Bits (Up to 128 Bits)
emlc now supports fixed-point word lengths up to 128 bits for C code
production. This increase in maximum precision to 128 bits supports generating efficient code for targets with nonstandard word sizes.
File Structure of C Code Generated by emlc Now Matches MATLAB File Structure
In previous releases emlc generated code in a single C file, no matter how many source MATLAB files were compiled. Now, the generated C file structure matches the original MATLAB file structure. one C file for every MATLAB file for which a separate top-level function is generated. This association makes it easier to correlate the generated C code with the compiled MATLAB code. For more information, see “Partitioning Generated Files” in the Real-Time Workshop documentation.
emlc generates
36
Version 7.2 (R2008b) Real-Time Workshop®Software
emlc Uses Same Tr
emlc now uses the
operations in ME compiler imple different resu and independe
Improperly-
same library as M ATL AB for implementing trigonometric
X function targets. In previous releases,
mentation of trigonometric functions, sometimes producing
lts from MATLAB. Now, results are consistent with MATLAB
nt of compiler choice.
Scaled Fixed-Point Relational Operators
Now Match MAT
When evaluat encompasse required mo answers f ro
ing relational operators,
s both input operands. In previous releases, if the common type
re than 32 bits, code generated by
m MATLAB. Now, the answers are consistent.
igonometric Functions as MATLAB
LAB Results
emlc computes a common type that
Compatibility Consideration
Some rela fixed-po cast both method a
emlc Now MEX Fun
MEX fun at com p the funct compi
tional operators generate multi-word code even if one of the
int operands is not a multi-word v alue. To work around this issue,
operands to the same fixed-point type (using the same scaling
nd properties).
Prevents Default fimath Mismatches for
ctions
ctions generated with
ile time. If you do not specify a default
option, emlc uses the MATLAB default fimath value. If your MEX
-F
ion uses the MATLAB default
le-time value does not match the runtime value.
emlc use the default fimath value in effect
fimath, emlmex generates an error if the
emlc used the C
emlc may have given different
fimath value explicitly using
ity to Optimize Code for Vector Assignments by
Abil
acing for-Loops with memcpy
Repl
s release provides two new model parame ters, Use memcpy for vector
Thi
ignment and Memcpy threshold (bytes), which allow you to optimize
ass
l-Time Workshop generated code for vector assignments by replacing
Rea
-loops with memcpy function calls. The new parameters appear on the
for
37
Real-Time Workshop®Release Notes
Optimization pane of the Configuration Parameters dialog box, immediately under the Loop unrolling threshold parameter.
The memcpy function can be more efficient than for-loop controlled element assignment for l arge data sets. W here speed, you can use the new model options to specify that generated code should use
Selecting the Use memcpy for vector assignment option enables the associated parameter Memcpy threshold (bytes),whichallowsyouto specify the array size in bytes at or above which
for-loops in the generated code for vector assignments. For more information,
see “Use memcpy for vector assignment” and “Memcpy threshold (bytes)” in the Simulink Graphical User Interface documentation.
memcpy offers improved execution
memcpy when assigning a vector signal.
memcpy should replace
38
Rate Transition Support Enhanced for Signal Line Branching and Direct Connections Between Asynchronous Rates
Branching Supported on Output Port of Asynchronous Rate Transition Block
In previous releases, if a signal branched in order to drive multiple asynchronous subsystems, each branch of the signal required a separate Rate Transition block. In this release, you can place a single Rate Transition block on the signal line ahead of the branch, and then branch on the Rate Transition block output signal line. Eliminating the need for multiple Rate Transition blocks simplifies the m odel diagram and can improve code efficiency.
Asynchronous Subsystems Can Directly Connect When Rate Transition Protection Not Required
In previous releases, Rate Transition blocks were required at each port of an asynchronous subsystem, even when rate transition protection was not
Version 7.2 (R2008b) Real-Time Workshop®Software
required. Generally, rate transition protection is not required when the sample times f or a signal’s source and destination blocks have the same priority.
In this release, Rate Transition blocks can be omitted where rate transition protection is unnecessary, allowing direct connection between asynchronous subsystems. Specifically,
Two asynchronous function-call subsystems with the same priority now can
be directly connected
An asynchronous function-call subsystem can have a direct feedback loop
with no Rate Transition block in the loop
Eliminating Rate Transition blocks where rate transition protection is not required simplifies the model diagram and can improve code efficiency.
Generated Code Includes Standard C Static Files (stddef.h and stdlib.h) Only When Necessary
In previous releases, code generated by the Real-Time Workshop software always included the
stdlib.h header file, regardless of the specific needs of the application or the
target environment. In this release, generated code does not automatically include that requires it.
stddef.h or stdlib.h unless your model contains a utility function
stddef.h header file, and for Stateflow content, the
MISRA C Code Initialization Enhancements
Previously, the Real-Time Workshop build process occasionally generated initialization code that was not compliant with MISRA C R2008b, using the Use memset to initialize floats and doubles to 0.0 optimization generates initializationcodethatisalwaysMISRACcompliant, resulting in safer, more efficient code. For details, see “Use memset to initialize floats and doubles to 0.0” in the Simulink documentation.
Compatibility Considerations
For models you created previo us ly that have the Use memset to initialize
floats and doubles to 0.0 check box cleared, if you rebuild using R2008b
®
standards. In
39
Real-Time Workshop®Release Notes
Real-Time Workshop software, the generated code size might increase. To generate smaller code, select the Use memset to initialize floats and doubles to 0.0 check box. The “Check optimization settings” Model Advisor check is available to help you determine if the current setting of the parameter is correct.
If your hardware does not represent numerical zero for floating-point data
as bit pattern 0 (all bits 0), you must clear the Use memset to initialize floats and doubles to 0.0 check b ox .
The Use m emset to initialize floats and doubles to 0.0 check box is
selected by default for new models.
Ability to Register Keywords to Avoid Conflicts with External Code
Previously, external environments could use keywords that the Real-Time Workshop code generation process created in the generated code, resulting in clashes between the external environment and the generated code. In R2008b, you can register the set of keywords that the code generation process should not use, facilitating code integration where outside functions and global variables are unknown in the Simulink model.
40
The Reserved names parameter is located on the Real-Time Workshop > Symbols pane in the Configuration Parameters dialog box. For
more info rm ation, see “Real-Time Work shop Pane: Symbols” in the Real -Ti me Workshop Reference and in the Real-Time Worksh op U s er’s Guide.
Use Same Custom Code Settings for Model Simulation and Real-Time Workshop Code Generation
Previously, for models that contained Embedded MATLAB Function blocks, Stateflow charts, or Truth Table blocks, custom code settings for simulation and Real-Time Workshop code generation were entered separately. In R2008b, you can choose to use the same custom code settings in both cases to avoid entering information twice.
The Use the same custom code settings as Simulation Target parameter is located on the Real-Time Workshop > Custom Code pane in the Configuration Parameters dialog b ox. For more information, see “Real-Time Workshop Pane: Custom Code” in the Real-Time Workshop Reference and
Version 7.2 (R2008b) Real-Time Workshop®Software
“Preparing Models for Code Generation” in the Real-Time Workshop User’s Guide.
Configure Unique Custom Code Settings for Library Models in the Configuration Parameters Dialog Box
In general, library models use custom code settings of the parent model during the Real-Time Workshop build process. However, libraries that contain Embedded MATLAB Function blocks, Stateflow charts, or Truth T able blocks can use custom code settings unique from the parent model. These libraries can have their own set of Real-Time W orks hop configuration parameters separate from the parameters of the parent model. Select Tools > Open RTW Target in the Embedded M ATLA B Editor or Stateflow Editor for your library model.
For information about custom code parameters, see “Real-Time Workshop Pane: Custom Code” in the Real-Time Workshop Reference and “Preparing Models for Code G eneratio n” in the Real-Time Wo rkshop User’s Guide.
Compatibility Considerations
Previously, you could configure custom code for a Stateflow library model on the Custom Code pane in the RTW Target dialog box. In R2008b, these custom code parameters are migrated to the Configuration Parameters dialog box. Therefore, if you have scripts that use the Stateflow API to configure the Target object ( the
get_param and set_param commands instead.
For details, see “Library Models: Mapping of GUI O ptions from the RTW Target Dialog Box to the Configuration Parameters Dialog Box” and “Updating Scripts That Set Options Programmatically for Simulation and Embeddable Code Generation” in the Stateflow and Stateflow
rtw) for library models, you must update your scripts to use
®
Coder™ Release Notes.
Flexible Configuration Options for Referenced Models in TLC-Based Custom Targets
In R2008b, you can specify that a configuration optio n 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 valuesmustbethesameinbothmodels. For
41
Real-Time Workshop®Release Notes
information about overriding this default, see “Controlling Configuration Option Value Agreement” in the Real-Time Workshop User’s Guide.
Optimize Floating-Point to Integer Data Type Conversions Using New Configuration Parameter
R2008b introduces a new configuration parameter to remove code that maps
NaN values to integer zero, increasing efficiency of generated code fo r
floating-point to integer or fixed-point data type conversions. See “Remove code from floating-point to integer conversions with saturation that maps NaN to zero” in the Simulink documentation for m ore information.
New and Enhanced Demos
The following demo has been added:
Demo...
rtwdemo_rtiostream
Shows Ho w You Can...
Implement a communication channel to enable exchange of data between different processes (for example, for host/target communication during Processor-in-the-Loop or External Mode simulation).
42
Version 7.1.1 ( R 2008a+) Real-Time Work s h op®Software
Version 7.1.1 (R2008a+) Real-Time Workshop Software
This table summarizes what’s new in V7.1.1 (R2008a+):
New Features and Changes
No No Bug Reports
Version Compatibility Considerations
Fixed Bugs an d Known Problems
Includes fixes
Related Documentation at Web Site
No
43
Real-Time Workshop®Release Notes
Version 7.1 (R2008a) Real-Time Workshop Software
This table summarizes what’s new in V7.1 (R2008a):
New Features and Changes
Yes Details below
Version Compatibility Considerations
Yes—Details labeled as Compatibility Considerations, below. See also Summary.
New features and changes introduced in this version are
“Removed Static Libraries rtwlib_* to Simplify Code Integration” on page
45
“New API for Registering Hardware Device Vendor and Type” on page 45
“More Cases Supported for Rate Transition Block Automatic Insertion”
on page 46
“Removed Limitations for Number of Referenced Models Built” on page 46
“BuildInfo API Now Provides Composite Model Reference Description”
on page 46
“BuildInfo API Better Supports Non-Compiled Dependencies” on page 46
“MATLAB Editor Syntax Highlighting for Target Language Compiler
(TLC) Code” on page 47
Fixed Bugs an d Known Problems
Bug Reports Includes fixes
Related Documentation at Web Site
No
44
“New Configuration Option “Include custom source code” for S-Function
Target” on page 47
“New Configuration Objects for Specifying Constant Function Inputs to
emlc” on page 47
“emlc Searches Directories in Different Order” on page 47
“Generated Code N o Longer Automatically Includes math.h Header File”
on page 48
Version 7.1 (R2008a) Real-Time Workshop®Software
“Default TCP/IP Transport for External Mode Uses New Server (Target)
Side Communication Interface” on page 49
“Model Referencing Not Supported with ASAM-ASAP2 Data Definition
Target” on page 50
““What’s T his?” Context-Sensitive Help Available for Simulink
Configuration Parameters Dialog” on page 50
“New and Enhanced Demos” on page 50
Removed Static Libraries rtwlib_* to Simplify Code Integration
In previous releases, the Real-Time Workshop software provided additional source files and functions for use in building your code in the
matlabroot/rtw/c/libsrc directory. During code generation, these
files were added to the build process. Continuing reductions of static file dependencies that began in R2007a, this release completely removes static libraries
matlabroot/rtw/c/libsrc. Instead, these functions and files are generated
only when needed. This reduces the number of additional source files required to compile and build the code, which improves compile time and can simplify code integration and verification.
rtwlib_*.lib/a from the product, leaving no C source files under
New API for Registering Hardware Device Vendor and Type
This release provides a hardware device registration API that allows you to add “Device vendor” and “Device type” values to the default set that is displayed on the “Hardware Implementation Pane” of the C onfiguration Parameters dialog box.
TousethisAPI,youcreatean MATLAB path, that invokes the in a hardware device registry entry with device information. The device information will be registered with Simulink software for each subsequent Simulink session.
For m ore information, s ee “Registering Additional Device Vendor and Device Type Values” in the Real-Time Workshop documentation.
sl_customization.m file, located in your
registerTargetInfo function and fills
45
Real-Time Workshop®Release Notes
More Cases Supported for Rate Transition Block Automatic Insertion
Auto-insertion of Rate Transition blocks is now supported for additional rate transitions, such as sample times with nonzero offset, and between non-integer-multiple sample times.
Additionally, as described in “Rate Transition Enhancements” in the Simulink Release Notes, this release allows you to
Control the level of data transfer determinism when auto-insertion of Rate
Transition blocks is selected for your model
Specify Rate Transition block output port sample time as a multiple of
input port sample time
Removed Limitations for Number of Referenced Models Built
In previous releases, Microsoft®Windows®imposed a limit on the number of models that could be referenced in a model hierarchy. Th is limitation is removed in R2008a. Under Microsoft Windows, as on all other platforms, the number of referenced models that can appear in a model hierarchy is effectively unlimited. See “Creating Model Components” for information about model referencing.
46
BuildInfo API Now Provides Composite Model Reference Description
In previous releases, the model build information set up and managed using the
RTW.BuildInfo API did not include source files for referenced models. In
this release, the and zip files created using models.
packNGo function supports a full model reference hierarchy,
packNGo now include source files for referenced
BuildInfo API Better Supports Non-Compiled Dependencies
In this release, the RTW.BuildInfo API adds the following functions for handling non-compiled files, such as DLL files required for a final executable, or a README file:
Version 7.1 (R2008a) Real-Time Workshop®Software
addNonBuildFiles
getNonBuildFiles
Add nonbuild-related files to model’s build information
Nonbuild-related files from model’s build information
MATLAB Editor Syntax Highlighting for Target Language Compiler (TLC) Code
In R2008a, syntax highlighting is available for TLC code. For details, see “Setting TLC Language Preferences” in the MATLAB documentation.
New Configuration Option “Include custom source code” for S-Function Target
This release adds the model configuration option Include custom source code, w hich allows you to include custom source code in the code generated
for the Real-Time Workshop S-function target ( is located on the Real-Time Workshop S-Function Code Generation Options pane of the Configuration Parameters dialog box. See “Real-Time Workshop Pane: Real-Time Workshop S-Function Code Generation Options” in the Real-Time Workshop reference documentation for more information.
rtwsfcn.tlc). This option
New Configuration Objects for Specifying Constant Function Inputs to emlc
When you know primary inputs will not change at runtime, you can specify them as constant values using eliminate overhead in generated code. See “Specifying Constant Inputs Using the - eg Option” in the Real-Time Workshop documentation.
emlcoder.Example and emlcoder.egc to
emlc Searches Directories in Different Order
When you use the -I option to add directories to the Embedded MATLAB path,
emlc now searches directories from left to right. This behavior matches
C compilers such as
gcc and the MATLAB compiler mcc.
47
Real-Time Workshop®Release Notes
Compatibility Considerations
In previo us releases, the search orderwasfromrighttoleft. Thechangemay produce unexpected results if you use example, suppose you specify two directories on the each directory contains a file named
emlc -I 'dir1;dir2' myFcn.m
In this release, emlc adds myFcn.m from dir1 to the Embedded MATLAB path. In previous releases,
Generated Code No Longer Automatically Includes math.h Header File
In previous releases, code generated by the Real-Time Workshop software automatically included the functions, regardless of the math requirements of the target environment. In this release, selecting a target function library (TFL) for your model controls which heade r files are included, and the generated code does not automatically include math function that requires it. For more information about selecting TFLs, see “Selecting and Viewing Target Fu n c tion Libraries” in the Real-Time Workshop documentation.
emlc -I w ith overloaded functions. For
-I argument list, w here
myFcn.m,asfollows:
dir2 took precedence.
math.h header file, defining C standard math
math.h unless your model contains a floating-point
48
Compatibility Considerations
If you have created an inlined S-function that implicitly relies on the
math.h provided by The MathWorks, and if the generated code for your
model no longer includes your S-function to explicitly include the following line to a function in your S-function TLC file:
%<LibAddToCommonIncludes("math.h")>
For more information, see LibAddToCommonIncludes(incFileName) and “Block Target File Methods” in the Real-Time Workshop Target Language Compiler documentation.
math.h, you will need to update the TLC file for
math.h. For example, you can add
BlockInstanceSetup, BlockTypeSetup,orOutputs
Version 7.1 (R2008a) Real-Time Workshop®Software
DefaultTCP/IPTransportforExternalModeUses New Server (Target) Side Communication Interface
In prev io us releases, the server (target) side of the default TCP/IP transport layer for external mode communication was defined by the following files in theserversidedirectory
common/ext_svr_transport.h
tcpip/ext_svr_tcpip_transport.c
tcpip/ext_tcpip_utils.c
In R2008a, the default TCP/IP transport has been revised to use a new server (target) side communication interface. The server side of the TCP/IP transport layer is now de f ined by the following files in
matlabroot/rtw/c/src/ext_mode/:
common/rtiostream.h
common/rtiostream_interface.c
matlabroot/rtw/c/src/ext_mode/:
tcpip/rtiostream_tcpip.c
The file tcpip/ext_svr_tcpip_transport.c has been removed from the software and the file side directory
matlabroot/rtw/ext_mode/tcpip/.
ext_tcpip_utils.c has been moved to the client (host)
For details, see “Creating a TCP/IP Transport Layer for External Communication” in the Real-Time Workshop User’s Guide and see the files in
matlabroot/rtw/c/src/ext_mode/.
Compatibility Considerations
If you have custom template makefiles (TMFs) that use the default external mode TCP/IP transport layer, you m ust locate the and replace "
rtiostream_tcpip.c
EXT_SRC = ext_svr.c updown.c ext_work.c ext_svr_tcpip_transport.c
ext_svr_tcpip_transport.c"with"rtiostream_interface.c
". For example, given the following line:
Change it to:
EXT_SRC line in each TMF
49
Real-Time Workshop®Release Notes
EXT_SRC = ext_svr.c updown.c ext_work.c rtiostream_interface.c rtiostream_tcpip.c
Model Referencing Not Supported with ASAM-ASAP2 Data Definition Target
The ASAM-ASAP2 Data Definition Target in Real-Time Workshop 7.1 (R2008a) does not support model referencing.
“What’s This?” Context-Sensitive Help Available for Simulink Configuration Parameters Dialog
R2008a introduces “What’s This?” context-sensitive help for parameters that appear in the Simulink Configuration Parameters dialog. This feature provides quick access to a detailed description of the parameters, saving you the time it would take to find the information in the Help browser.
To use the "What’s This?" help, do the following:
1 Placeyourcursoroverthelabelofaparameter.
50
2 Right-click. A What’s This? context menu appears.
For example, the following figure shows the What’s This? context menu appearing after a right-click on the Start time parameter in the Solver pane.
3 Click What’s This? A context-sensitive help window appears showing a
description of the parameter.
New and Enhanced Demos
The following demo has been added:
Version 7.1 (R2008a) Real-Time Workshop®Software
Demo...
rtwdemo_configuration_set
Shows How You Can...
Work with configuration parameters to configure a model for code generation. The demo also links to d ocumentation of model options and provides tools and scripts to help automate model configuration.
51
Real-Time Workshop®Release Notes
Version 7.0.1 (R2007b+) Real-Time Workshop Software
This table summarizes what’s new in V7.0.1 (R2007b+):
New Features and Changes
No No Bug Reports
Version Compatibility Considerations
Fixed Bugs an d Known Problems
Includes fixes
Related Documentation at Web Site
No
52
Version 7.0 (R2007b) Real-Time Workshop®Software
Version 7.0 (R2007b) Real-Time Workshop Software
This table summarizes what’s new in V7.0 (R2007b):
New Features and Changes
Yes Details below
Version Compatibility Considerations
Yes—Details labeled as Compatibility Considerations, below. See also Summary.
New features and changes introduced in this version are
“New emlc Command-Line Function for Generating C Code from Embedded
MATLAB” on page 54
“Code Generation from Embedded MATLAB Algorithms That Span
Multiple MATLAB Files” on pag e 54
“Support f or Stateflow Animation with Simu l ink External Mode” on page 55
“Enhanced Auto-Insertion of Asynchronous Rate Transition Blocks” on
page 55
“Redundant Buffers Removed Between Asynchronous Rates with Same
Priority” on page 55
“New Configuration Parameters for Controlling Compiler Optimization
Level and Specifying Custom Optimization Settings” on page 55
Fixed Bugs an d Known Problems
Bug Reports Includes fixes
Related Documentation at Web Site
No
“Additional Microprocessors and Enhanced Graphical Interface for
Selecting Code Generation Target Hardware” on page 58
“Enhanced Efficiency in Generated Code of Iterator-Selector-Assignment
Patterns” on page 59
“Code Optimization s for Conca ten a te,Conjugate,DotProduct,and
Transpose Blocks” on page 60
“Negative Expressions Enhanced Efficiency in Generated Code” on page 60
“Expression Folding Enhancement” on page 60
53
Real-Time Workshop®Release Notes
“Static File Dependencies Reduced for Improved Integration and Builds”
on page 61
“Support for Selecting and Viewing a Target Function Library (TFL)” on
page 61
“Real-Time Workshop Reserved Keyw ords Listed in Documentation” on
page 62
“Template Makefile Token ADD_MDL_NAME_TO_GLOBALS Removed”
on page 62
“Nonzero Start Time Behavior Change” on page 62
“TLC Custom Code Library Function Behavior Changes” on page 63
“Template Makefile MAKECMD Path Change for g make on Microsoft
Windows” on page 64
“New and Enhanced Demos” on page 65
New emlc Command-Line Function for Generating C Code from Embedded MATLAB
Embedded MATLAB introduces a new function, Embedded MATLAB Coder (
emlc), that generates C code from MATLAB code that is compliant with
the Embedded MATLAB language subset. The generated C code can be packaged as an executable, library, or MEX function. For more information, see “Converting MATLAB Code to C/C++ Code” in the Real-Time Workshop documentation.
54
Code Generation from Embedded MATLAB Algorithms That Span Multiple MATLAB Files
You can now generate embeddable code for external MATLAB functions from Embedded MATLAB. This feature allows you to call external functions from multiple locations in a MATLAB file or model and include these functions in the generated code .
Compatibility Considerations
In pr ev ious rel eases, Embedded MATLAB did not com pi le external MATLAB functions, but instead dispatched them to MATLAB for execution (after warning). Now, the default behavior is to compile and generate code for
Version 7.0 (R2007b) Real-Time Workshop®Software
external MATLAB functions called from Embedded MATLAB. If you do not want Embedded MATLAB to compile external MATLAB functions, you must explicitly declare them to be extrinsic, as described in “Calling MATLAB Functions” in the Embedded MATLAB documentation.
Support for Stateflow Animation with Simulink External Mode
When running Simulink models in external mode, you can now animate states and view Stateflow test points in floating scopes and signal viewers. For more information on Stateflow animation, see “Animating Stateflow Charts” in the Stateflow documentation.
Enhanced Auto-Insertion of Asynchronous Rate Transition Blocks
In previous releases, Rate Transition blocks were required to be inserted at each port of an asynchronous function call subsystem, even when unnecessary. This release provides improved auto-insertion of Rate Transition blocks for asynchronous subsystems.
Redundant Buffers Removed Between Asynchronous Rates with Same Priority
In previou s releases, Rat e Transition blocks between asynchronous rates with the same priority introduced superfluous buffers. This release removes the redundant buffers and allows direct signal connection between asynchronous rates with the same priority.
New Configuration Parameters for Controlling Compiler Optimization Level and Specifying Custom Optimization Settings
In previous releases, users controlled compiler optimizations for building generated code by editing compiler flags into template makefiles (TMFs) or by supplying compiler flags to the Real-Time Workshop make command.
This release adds a Compiler optimization level parameter that allows users more flexible and generalized control over the compiler optimization
55
Real-Time Workshop®Release Notes
level for building generated code. For example, you can use this parameter to trade off compilation time against run time for your model code without having to supply compiler-specific flags to other levels of the Real-Time Workshop build process.
The Compiler optimization level parameter appears in the Build process subpane of the Real-Time Workshop pane of the Configuration Parameters dialog box, as shown below:
The available values for the Compiler optimization level parameter are
56
Optimizations off (faster builds)
Optimizations on (faster runs)
Custom — Optimize based on user-specified compiler optimization flags
The default setting is
Optimizations off (faster builds) (see
“Compatibility Considerations” on page 57).
Selecting the value
Custom enables the Custom compiler optimization
flags field, in which you can enter custom compiler optimization flags (for
example,
-O2).
For more information about the Compiler optimization level parameter and its values, see “Controlling Compiler Optimization Level and Specifying Custom Optimization Settings” in the Real-Time Workshop User’s Guide and “Compiler optimization level” and “Custom compiler optimization flags” in the Real-Time Workshop reference documentation.
This release also provides:
Version 7.0 (R2007b) Real-Time Workshop®Software
Compiler optimization level control for Simulink simulation (see the
Optimization pane of the Configuration Parameters dialog box)
Command-line parameters
RTWCustomCompilerOptimizations for controlling compiler optimization
RTWCompilerOptimization and
level from MA TLAB code
For Real-Time Workshop Embedded Coder product users , target
configuration parameter
CompOptLevelCompliant, which allow s custom
embedded targets to declare whether they support compiler optimization level control
Compatibility Considerations
The default setting of the new Compiler optimization level parameter introduces a performance-related compatibility consideration. Whe n building and running your model code with the default setting, you may notice shorter compilation times, but longer execution times, compared to previous releases. The degree of difference can depend on model characteristics such as model (code) size and number of time steps taken.
Note If you specified custom compiler optimization flags for your model using
OPT_OPTS, your existing optimization settings are honored and your
model behavior should not change.
In previous releases, the compiler optimization level for building Real-Time Workshop generated code was controlled for each target by c ompiler flags supplied in TMFs or through other Real-Time Workshop build process mechanisms. The effective compiler optimization level setting varied from target to target.
In this release, the compiler optimization level can be controlled through the Compiler optimization level parameter in the Configuration Parameters dialog box, which by default is set to the value
builds)
. T his setting trades off code execution speed for faster code
Optimizations off (faster
compilation.
57
Real-Time Workshop®Release Notes
To change the compiler optimization level for code generated from your model, change the value of the Compiler optimization level parameter to
Optimizations on (faster runs) or Custom.
Additional Microprocessors and Enhanced Graphical Interface for Selecting Code Generation Target Hardware
In previous releases, hardware listings on the Hardware Implementation pane of the Configuration Parameters dialog box did not follow a consistent convention based on device vendor and type. This release introduces a two-step hardware selection process based on device vendor and device type parameters on the Hardware Implementation pane. To select a device in either the Embedded hardware subpane or the Emulation hardware subpane,
1 Select a value from the Device vendor list. Your selection of vendor will
determine the available device v alu es in the Device type list.
58
ct a value from the Device type list. Your selection will populate the
2 Sele
ice characteristics fields on the Hardware Implementation pane
dev
ropriately.
app
Version 7.0 (R2007b) Real-Time Workshop®Software
For more inf see “Descr Workshop d Simulink
Enhanced Iterato
New feat and stac
Previo
block o Width b in a Fo block
In th
assi in th
ormation about selecting code generation target hardware,
ibing the Emulation and Embedded Targets” in the Real-Time
ocumentation and “Device vendor” and “Device type” in the
reference documentation.
Efficiency in Generated Code of
r-Selector-Assignment Patterns
ures of the Iterator-Selector-Assignment pattern reduce the global
kdatasizesandimprovethecodestructure and execution speed.
usly, a global variable was used to pass information from a Width
utside of a For Iterator subsystem into the subsystem. In R2007b, a
lock can be directly connected to a For Iterator block and embedded
r Iterator subsystem. In this configuration, the output of the Width
is a local variable.
e co de generated for the For Iterator block, the
gnment occurs before entering the loop, avoiding an extra
e generated code.
for loop initialization
if condition
59
Real-Time Workshop®Release Notes
Code Optimizations for Concatenate, Conjugate, Dot Product, and Transpose Blocks
The Real-Time Workshopbuild proce ss uses a new technique to handle matrix data, resulting in generating shorter, better performing code for the Concatenate, Conjugate, Dot Product, and Transpose blocks.
Previously, temporary buffers were created to carry concatenated signals. In R2007b, the Real-Time Workshop build process eliminates unnecessary temporary buffers and writes the concatenated signal to the downstream global buffer directly, reducing the stack size and i mproving code execution speed.
Negative Expressions Enhanced Efficiency in Generated Code
Previously, the Real-Time Workshop build process generated the negative expression:
expr * (-1)
60
In R2007b, the Real-Time Workshop build process generates a simpler expression to provide a solution that is closer to handwritten code.
-expr
Expression Folding Enhancement
Expression folding is enhanced to reduce the size of co de and improve code execution speed. In R2007a, the expression folding code generation process created te m po rary variables, as shown in bold in the following example:
real_T rtb_Merge[12];
int32_T i; for (i = 0; i < 12; i++) {
if (folding_U.In3 > 0.0) {
rtb_Merge[i] = 2.0 * In1[i];
}else{
rtb_Merge[i] = 3.0 * In2[i];
}
folding_Y.Out1[i] = rtb_Merge[i];
}
Version 7.0 (R2007b) Real-Time Workshop®Software
In R2007b, temporary variable are no longer present in the generated code and the global buffer is directly written to, as shown in bold in the following example:
int32_T i; for (i = 0; i < 12; i++) {
if (folding_U.In3 > 0.0) {
folding_Y.Out1[i] = 2.0 * In1[i];
}else{
folding_Y.Out1[i] = 3.0 * In2[i];
}
}
Static File Dependencies Reduced for Improved Integration and Builds
The Real-Time Workshop software provides additional source files and functions for use in building your code in the directory. During code generation, these files are added to the build process. Continuing reductions of static file dependencies that began in R2007a, this release removes additional source files from the these functions and files are generated only when needed. This reduces the number of additional source files required to compile and build the code, which improves compile time and can simplify code integration and verification.
matlabroot/rtw/c/libsrc
libsrc directory. Instead,
Support for Selecting and Viewing a Target Function Library (TFL)
In this release, the Real-Time Workshop Embedded Coder software introduces the Target Function Library (TFL) API for mapping math functions and operators to target-specific code. The Real-Time Workshop software supports the abilities to
Select an existing math library to use with your mode l. To select a math
library, go to the Interface pane of the Configuration Parameters dialog box and select an appropriate value from the Target function library drop-down list.
View the content of target function library tables that were created using
the Real-Time Workshop Embedded Coder software. To bring up the
61
Real-Time Workshop®Release Notes
TFL Viewer with all available math libraries listed, issue the MATLAB command
For more information, see “Selecting and Viewing Target Function Libraries”.
Real-Time Workshop Reserved Keywords Listed in Documentation
The complete list of Real-Time Workshop reserved keywords is available at “Reserved Keywords” in the Real-Time Workshop documentation.
Compatibility Considerations
Real-Time Workshop keywords a re reserved for use internal to the Real-Time Workshop software or C programming, and should not be used in your model as identifiers or function names. If your model uses these keywords, you should modify your model to use words that are not reserved. If your model contains any reserve d keywords, the Real-Time Workshop build does not complete and an error message is displayed.
RTW.viewTfl.
62
Template Makefile Token ADD_MDL_NAME_TO_GLOBALS Removed
The ADD_MDL_NAME_TO_GLOBALS token is no longer available for use in template makefiles.
Compatibility Considerations
If you have the ADD_MDL_NAME_TO_GLOBALS tokeninyourtemplate makefile, the code generation make process issues an error. Remove the
ADD_MDL_NAME_TO_GLOBALS token from all template makefiles.
Nonzero Start Time Behavior Change
Previously, the Real-Time Workshop software issued a warning when generating code for models with nonzero start time when the selected target did not support nonzero start time, and the generated code might not have operated correctly. In R2007b, when the Real-Time Workshop build process encounters this condition, the build does not complete and an error message is displayed.
Version 7.0 (R2007b) Real-Time Workshop®Software
For a list of targets that support nonzero start time, see “Targets Supporting Nonzero Start Time” in the Real-Time Workshop User’s Guide.
Compatibility Considerations
Previously, the Real-T ime Workshop build process generated correct code for absolute-time independent models without error. In R2007b, before generating code, set the model start time to zero for no change in functionality of the generated code.
TLC Custom Code Library Function Behavior Changes
In R2007b, the following TLC custom code library functions behave differently:
LibSystemOutputCustomCode
LibSystemUpdateCustomCode
LibSystemInitializeCustomCode
LibSystemDerivativeCustomCode
LibSystemEnableCustomCode
LibSystemDisableCustomCode
Compatibility Considerations
Previously, the Real-T ime Workshop build process generated correct code for TLC custom code library functions without error. In R2007b, the Real-Time Workshop build process requires all calls to TLC custom code functions to be declared in the top-level S-function custom code function is ignored. If your top-level S-function indirectly calls a TLC custom code function, you must include the white space delimited TLC custom code function call as a TLC com ment in the top-level S-function. For example, if your top-level S-function file calls another file that calls
%%LibSystemOutputCustomCode() in the top-level S-function .tlc file. The
Real-Time Workshop build process generates an error when it detects that a S-function indirectly calls TLC custom code functions without the required comment.
LibSystemOutputCustomCode, you must include the comment
.tlc file, otherwise the
63
Real-Time Workshop®Release Notes
LibSystemOutputCustomCode and LibSystemUpdateCustomCode behave
differently in rate-grouped and non-ra te-grouped code generation modes when called from a block output or update function. The system’s output and update custom code is no longer duplicated if it has been registered by a block in the output or update function in a rate-grouped multirate system. The custom code is executed for all rates in rate-grouped single-tasking modes, and is executed once in non-rate-grouped multitasking modes. The old behavior is preserved if the block registers the custom code for the parent system’s output or update function in TLC block functions other than output and update, for example works the same as in prev ious releases. The behavior of the Real-Time Workshop custom code block library remains unchanged.
Template Makefile MAKECMD Path Change for gmakeonMicrosoftWindows
In R2007b, Windows template makefiles (TMFs) that use gmake (*_lcc.tmf) specify a different path to make than in previous releas es.
BlockInstanceSetup. This ensures the custom code block library
64
Version 7.0 (R2007b) Real-Time Workshop®Software
Compatibility Considerations
If you have customized a Windows TMF that uses gmake,updateyour TMF for the path change by removing example, change
MAKECMD = "%MATLAB%\rtw\bin\win32\gmake"
to
MAKECMD = "%MATLAB%\bin\win32\gmake"
\rtw from the MAKECMD line. For
New and Enhanced Demos
The following demo has been added:
Demo...
rtwdemo_emlcbasicdemo
Shows How You Can...
Use Embedded M ATLA B Coder (emlc)to generate embeddable C code from M A TLAB code, compile, run and view the generated C code, and display the results.
65
Real-Time Workshop®Release Notes
Version 6.6.1 (R2007a+) Real-Time Workshop Software
This table summarizes what’s new in V6.6.1 (R2007a+):
New Features and Changes
No No Bug Reports
Version Compatibility Considerations
Fixed Bugs an d Known Problems
Includes fixes
Related Documentation at Web Site
No
66
Version 6.6 (R2007a) Real-Time Workshop®Software
Version 6.6 (R2007a) Real-Time Workshop Software
This table summarizes what’s new in Version 6.6 (R2007a):
New Features and Changes
Yes Details below
Version Compatibility Considerations
Yes—Details labeled as Compatibility Considerations, below. See also Summary.
New features and changes introduced in this version are
“Static File Dependencies Reduced For Improved Integration and Builds”
on page 68
“Support for Simulink Legacy Code Tool Enhancements” on page 68
“New Target Language Compiler Tutorial” on page 69
“Code Generation for Multidimensional Signals” on page 69
“Enhanced Checking and Reporting for Identifier Conflicts” on page 69
“Enhanced Support for Tunable Parameters in Expressions” on page 70
“New Loss of Tunability Diagnostic” on page 70
“Support for Microsoft
Fixed Bugs an d Known Problems
Bug Reports Includes fixes
®
Visual C++ Express Edition” on page 70
Related Documentation at Web Site
Current product documentation
“Enhanced Code Efficiency, Including Merge Block Optimizations” on
page 71
“Reporting of Unconnected Signal Generators” on page 71
“Real-Time Workshop Profiling Works with Referenced Models” on page 71
“New Makefile Command Controls Location and Naming of Model
Reference Libraries” on page 71
“New TMF Token MODELREF_LINK_RSPFILE Supports Linking
Response Files for Model Reference” on page 71
67
Real-Time Workshop®Release Notes
“New sl_customization Based Method for Registering External Mode
Transport Layers” on page 72
“New and Enhanced Demos” on page 73
Static File Dependencies Reduced F or Improved Integration and Builds
The Real-Time Workshop software provides additional source files and functions for use in building your code in the directory. During code generation, these files are added to the build process. This release removes over 200 source files from the these functions and files are generated only when needed. This reduces the number of additional source files required to compile and build the code, which improves compile time and can simplify code integration and verification.
Support for Simulink Legacy Code Tool Enhancements
The Real-Time Workshop software supports the following Legacy Code Tool enhancements:
matlabroot/rtw/c/libsrc
libsrc directory. Instead,
68
New fields in the Legacy Code Tool data structure:
InitializeConditionsFcnSpec and SampleTime. InitializeConditionsFcnSpec defines a function specification for a
reentrant function that the S-function calls to initialize and reset states.
SampleTime allowsyoutospecifywhethersampletimeisinheritedfrom
the source block, represented as a tunable parameter, or fixed.
Support for state (persistent memory) arguments in registered function
specifications.
Support for complex numbers specified for input, output, and parameter
arguments in function specifications. This support is limited to use with Simulink built-in data types.
Support for multidimensional arrays specified for input and output
arguments in function specifications. Previously, multidimensional array support applied to parameters only.
Ability to apply the
data—input, output, parameter, or state. The data type of the function’s return value can be any type except comple x, bus, or fixed-point.
size function to any dimension of function input
size
Version 6.6 (R2007a) Real-Time Workshop®Software
A new Legacy Code Tool option, 'backward_compatibility',whichyou
can specify with the Code Tool syntax, as made available from MATLAB Central in releases before R2006b, for a given MATLAB session.
The following new demos:
rtwdemo_lct_sampletime rtwdemo_lct_work rtwdemo_lct_cplxgain rtwdemo_lct_ndarray
For more information, see
“Integrating Existing C Functions into Simulink Models with the Legacy
Code Tool” in the Writing S-Functions documentation
“Automating Generation of Files for Fully Inlined S-Functions Using
Legacy Code Tool” in the Real-Time Workshop documentation
legacy_code function reference page
legacy_code function. This option enables Legacy
New Target Language Compiler Tutorial
The Target Language Compiler (TLC) has been updated and includes a new tutorial that provides new users with an introduction to TLC syntax. See “Target L anguage Compiler Tutorials” for more information.
Code Generation for Multidimensional Signals
The Real-Time Workshop software now supports code generation for multidimensional signals. For more information, see “Multidimensional Signals” in the Simulink release notes.
Enhanced Checking and Reporting for Identifier Conflicts
The Real-Time Workshop software suppor ts the following identifier conflict enhancements:
69
Real-Time Workshop®Release Notes
Performance improvement: For large models, the Real-Time Workshop
software reviews 100 times more identifiers while delivering the same performance as in R2006a.
MISRA
subsystem identifiers comply with MISRA guidelines.
Conflict detection: A more unified conflict detecting and reporting
mechanism checks more identifiers, providing more information when conflicts occur.
Enhanced Support for Tunable Parameters in Expressions
Expressions that index into tunable parameters, such as P(1)+P(2)/P(i), retain their tunability in generated code, including simulation code that is generated for a reference d model. Both the indexed parameter and the index itself can be tuned.
Parameter expressions of the form P(i) retain their tunability if all of the following are true:
®
compliance: All model reference identifiers and all reused
70
The index
P is a 1D array, or a 2D array with one row or one column, of double data
type
P does not resolve to a mask parameter, but to a variable in the model or
the base workspace
i is a constant or variable of double data type
NewLossofTunabilityDiagnostic
Previously, any loss of tunability generated a warning. In R2007a, you can use the Loss of Tunability diagnostic to control whether loss of tunability is ignored or generates a warning or error. See “Detect loss of tunability” for details.
Support for Microsoft Visual C++ Express Edition
The Real-Time Workshop software now supports using Microsoft®Visual
®
C++
Express Edition for compilation.
Version 6.6 (R2007a) Real-Time Workshop®Software
Enhanced Code Efficiency, Including Merge Block Optimizations
The M erge block adds support for dead code elimination of its inputs. For any Merge block input port that is connected to an unconditionally executed block, dead code elimination removes the calculation of unused values.
Reporting o f Unconnected Signal Generators
During code generation, the Signal & Scope Manager reports unconnected signal generators.
Real-Time Workshop Profiling Works with Referenced Models
You can now use Real-Time Workshop Profiling with referenced models, which was not possible in previous releases.
New Makefile Command Controls Location and Naming of Model Reference Libraries
Except on the Apple®Macintosh®platform, you can use the makefile command location and naming for model reference libraries. See “Controlling the Location of Model Reference Libraries” for details.
USE_MDL_LIBPATHS to change the Real-Time Workshop default
New TMF Token MODELREF_LINK_RSPFILE Supports Linking Response Files for Model Reference
R2007a adds the template makefile (TMF) token MODELREF_LINK_RSPFILE for use with model reference. The MODELREF_LINK_RSPFILE token for the top model expands to the name of a respo ns e file that the top model links against. This token is valid only for build environments that support linker response files.
MODELREF_LINK_RSPFILE offers a preferred alternative to the token MODELREF_LINK_LIBS, which expands to a list of referenced model libraries
that the top model links against, provided that the linker supports response files.
71
Real-Time Workshop®Release Notes
For more information, see “Supporting Model Referencing” in the Real-Time Workshop documentation.
New sl_customization Based Method for Registering External M ode Transport Layers
This release introduces a new method for registering external mode transport layers with the Simulink software. To register a TCP/IP or serial transport layer with a custom target, or to register a custom transport layer, you must add an entry of the following form to an MATLAB path:
function sl_customization(cm)
cm.ExtModeTransports.add('
%end function
For more information about using the new transport registration method with custom targets and/or custom transport layers, see “Client/Server Implementations” and “Cre ating a TCP/IP Transport Layer for External Communication” in the Real-Time Workshop User’s Guide.
sl_customization.m file on the
stf.tlc', 'transport', 'mexfile', 'Level1');
72
Compatibility Considerations
In previous releases, external mode transport layers were associated with targets based on target class, so that a custom target derived from a MathWorks GRT or ERT target by default would inherit its ex ternal mode transport layers.
Beginning in this release, external mode transport layers are associated with targets based on system target file name rather than target class. In order to support external mode, custom targets that previously inherited transport layers based on target class now must specify lines in an sl_customization.m file on the MATLAB path, as shown above.
cm.ExtModeTransports.add
Version 6.6 (R2007a) Real-Time Workshop®Software
New and Enhanced
The following de
Demo...
rtwdemo_lct_sampletime
rtwdemo_lct_work
rtwdemo_lct_cplxgain
rtwdemo_lct_ndarray
mos have been added:
Demos
Shows How You Can...
Specify whether sam ple time is inherited from the source block, represented as a tunable parameter, or fixed
Use s tate arguments in registered function specifications
Specify complex numbers for input, output, and parameter arguments in function specifications.
Specify multidimensional arrays for input and output arguments in function specifications.
73
Real-Time Workshop®Release Notes
Version 6.5 (R2006b) Real-Time Workshop Software
This table summarizes what’s new in Version 6.5 (R2006b):
New Features and Changes
Yes Details below
Version Compatibility Considerations
Yes—Details labeled as Compatibility Considerations, below. See also Summary.
New features and changes introduced in this version are
“Support for Simulink
“New Pack-and-Go Utility” o n page 75
“Support for New Simulink. S ub S ystem.getChecksum Command for
Determining Why Subsystem Code Is Not Reused” on page 76
“Merge Block Input Signals Can Have Storage Classes” on page 76
“Code Formatting Consistency Improvements” on page 77
“Support for Simulink Legacy Code Tool” on page 77
“New findIncludeFiles Function” on page 77
“Show eliminated statements Model Configuration Option Renamed” on
page 78
Fixed Bugs an d Known Problems
Bug Reports Includes fixes
®
Report Generator” on page 75
Related Documentation at Web Site
No
74
“Change to Default Settings for Multitasking Diagnostic Options” on page
78
“Parameter Pooling Is Now Always Enabled” on page 79
“PreLookup Index Search and Interpolation (n-D) Using PreLookup Block
Changes” on page 80
“Character Patterns You Should Not Use in Block Names” on page 80
“New and Enhanced Demos” on page 81
Version 6.5 (R2006b) Real-Time Workshop®Software
Support for Simulink Report Generator
The Real-Time Workshop software has added support for the Simulink Report Generator™. You can use the Simulink Report Generator to document a code generation project in a variety of output formats: Rich Text Format (RTF), Extensible Markup Language (XML), and Hypertext Markup Language (HTML). By using the Real-Time Workshop and the components Code Generation Summary and Import Generated Code, you can generate a report that includes
Model name and version
Real-Time Workshop product version
List of generated source and header (include) files
Optimization and R eal-Time Workshop target selection and build process
configuration settings
Mapping of subsystem numbers to subsystem labels for models that include
subsystems
Listings of generated and custom code for the model
codegen.rpt setup file
®
To see how the Report Generator fits into the general Real-Time Workshop workflow, see “Workflow for Developing Applications Using Real-Time Workshop Software”. For details on using the Report Generator with the Real-Time Workshop product, see the tutorial in “Documenting a Code Generation Project”. See Workshop function for generating a report from the MATLAB co mmand line or from a script. For descriptions of the new Real-Time Workshop Report Generator components, see Code Generation Summary and Import Generated Code in the Simulink Report Generator documentation. For details on using Report Generator, see the Simulink Report Generator docum entation.
rtwReport for a description of the Real-Time
New Pack-and-Go Utility
The Real-Time Workshop V6.5 (R2006b) software introduces a new pack-and-go utility that you can use to relocate static and generated code files for a model to another development environment, such as a secure system or an integrated development environment (IDE) that does not include MATLAB and S i mulink. This utility uses the tools for customizing post code generation build p rocess ing and a
packNGo function to find and package all files needed
75
Real-Time Workshop®Release Notes
to build an executable image for a model into a compressed file that you can relocate and unpack using a standard zip utility.
For more information on how to use the new utility, see “Relocating Code to Another Development Environment”.
Support for New Simulink.SubSystem.getChecksum Command for Determining Why Subsystem Code Is Not Reused
The V6.5 (R2006b) Real-Time Workshop software supports a new
Simulink.SubSystem.getChecksum command that you can use to determine
why subsystem code is not reused.
For a discussion on the code generation aspects of this feature, see “Determining Why Subsystem Code Is Not Reused” in the Real-Time Workshop documentation. For a description of the command, see
Simulink.SubSystem.getChecksum in the Simulink documentation.
76
Merge Block Input Signals Can Have Storage Classes
In previous releases, an input signal connected to a Merge block could not specify a n y storage class except a Merge block can specify a non­same for every non-
For information about the Merge block, see the Merge reference page in the Simulink documentation. For details about using Merge block signal storage classes in generated code, see the bullet for the Merge block under Other Optimization Tools and Techniques in the Real-Time Workshop documentation.
Auto input or output signal connected to the block.
Auto. In R2006b, an input signal connected to
Auto storage class. This class must be the
Version 6.5 (R2006b) Real-Time Workshop®Software
Code Formatting
The Real-Time Wo formatting styl code. The new st
Comments
Blank lines an
Indentation
Line breaks
Internatio
#define sta
Function d
Branching
Structur
e d efinition and value initialization statements
rkshop software is enhanced to apply a more consistent
e to the code that it generates, including integrated custom
yle rules for code generation formatting pertain to
dspaces
nal characters
tements
efinitions
and looping structural statements
Consistency Improvements
Compatibility Considerations
No code g of the co applica by any r on the p operat
eneration readability enhancement affects the syntax or semantics
de. Such changes affect only the physical code appearance. Therefore,
tions and correctly engineered automated tests should be unaffected
eadability enhance m ents. How eve r, automated tests that depended
hysical code layout may be affected. You should change such tests to
e only on functional properties of the code.
Suppo
The Re new S from Enha
New
Ane API
rt for Simulink Legacy Code Tool
al-Time Workshop software provides code generation support for the
imulink Legacy Code Tool. This tool speeds the creation of S-functions legacy C or C++ code. For a list of related demos, see “New and nced Demos” on page 81.
findIncludeFiles Function
w
findIncludeFiles function has been added to the build information
. This function searches for include (header) files in all source and include
77
Real-Time Workshop®Release Notes
paths recorded in a model’s build information object and adds the files found, along with their full paths, to the build information object.
For information on how to use the functions in the build information API, see “Customizing Post Code Generation Build Processing”.
Show eliminated statements Model Configuration Option Renamed
The Show eliminated statements option on the Real-Time Workshop > Comments pane of the Configuration Parameters dialog
box has been renamed to Show eliminated blocks. The corresponding configuration parameter change.
Change to Default Settings for Multitasking Diagnostic Options
For new models created with Simulink V6.5 (R2006b) or later, the default value for the following multitasking diagnostic options on the Configuration Parameters dialog is set to corrupt data or produce unpredictable behavior.
ShowEliminatedStatement is not affected by this
error to av oid generation of code that might
78
Diagnostics > Sample Time > Multitask conditionally executed
subsystem
Diagnostics > Data Validity > Data Store Memory Block > Multitask
data store
For more information about these multitasking diagnostic options, see “Diagnostics Pane: Sample Time” and “Diagnostics Pane: Data Validity” in the Simulink documentation.
Compatibility Considerations
For models created with a version of Simulink before V6.5 (R2006b), when the following conditions exist, Simulink displays a dial og box that reports the issue and suggests that you change the diagnostic setting to recommended by the Model Advisor.
error,as
Version 6.5 (R2006b) Real-Time Workshop®Software
The Tasking mode for periodic sample times option on the
Configuration Parameters Solver pane is set to model includes an asynchronous task.
The diagnostic setting that corresponds to the multitasking issue is set to
a value other than
You use the Real-Time Workshop software to generate code for the model.
The Real-Time Workshop software detects a multitasking issue that might
corrupt data or produce unpredictable behavior.
The dialog presents you with the following options.
error.
MultiTasking or the
Button
Change Change the diagnostic setting to error.
Ignore
Always ignore
Action
Leave the diagnostic setting as is.
Leave the diagnostic setting as is and do not show the dialog b ox again.
Parameter Pooling Is Now Always Enabled
In pr evious releases, the Parameter Pooling optimization was optional and was enabled by default. Due to internal improvements, disabling Parameter Pooling would no longer be useful in any context. The optimization is therefore part of standard R2006b operation, and has been removed from the user interface.
Compatibility Considerations
Upgrading a model to R2006b inherently provides the effect of enabling Parameter Pooling in previous releases. No compatibility considerations result from this change. If the optimization was disabled in an existing model, a warning is generated when the model is first upgraded to R2006b. This warning requires no action and can be ignored.
79
Real-Time Workshop®Release Notes
PreLookup Index Using PreLookup
The Real-Time Wo functions in and Interpola Workshop buil dynamically. option on the R Parameters d functions.
Character P
rkshop build process no longer uses the runtime library
libsrc
c/
tion (n-D) Using PreL ookup blocks. Instead, the Real-Time
d process generates the lookup functions for the two blocks
In addition, if you enable the Utility function generation
eal-Time W orkshop > Interface pane of the Configuration
ialog box, the lookup functions are stored as shared utility
to generate code for the PreLookup Index Search
atterns You Should Not Use in Block
Names
To avoid po the follow
/*
*/
ssible ambiguity in the comments in generated code, do not use
ing character patterns in block names:
Search and Interpolation (n-D)
Block Changes
80
Version 6.5 (R2006b) Real-Time Workshop®Software
New and Enhanced
New demos are
Demo...
rtwdemo_codegenrpt
Collection of custom code demos:
rtwdemo_lc rtwdemo_lct_cpp rtwdemo_lct_filter rtwdemo_l rtwdemo_lct_fixpt_signals rtwdemo_lct_gain rtwdemo_ rtwdemo_lct_lut rtwdemo_lct_start_term
t_bus
ct_fixpt_params
lct_inherit_dims
Demos
Shows How You Can...
Use the Simulink Report Generator to automatically document code you generate with the Real-Time Workshop softw are.
Call external legacy C and C++ functions (existing or custom code) that are external to a Simulink model. The demos use an unsupported Legacy Code Tool application programming interface (API) to register a legacy function prototype and create necessary files for a n S-function that calls the specified legacy function during simulation and in generated code. The Legacy Code Tool allows you to:
Provide the lega cy function specification
Generate a C M EX S-function for
simulation
Generate a block TLC file and optional
rtwmakecfg.m file that is used during
code generation to call the legacy code
81
Real-Time Workshop®Release Notes
Version 6.4.1 (R2006a+) Real-Time Workshop Software
This table summarizes what’s new in V6.4.1 (R2006a+):
New Features and Changes
No No Bug Reports
Version Compatibility Considerations
Fixed Bugs an d Known Problems
at Web site
Related Documentation at Web Site
No
82
Version 6.4 (R2006a) Real-Time Workshop®Software
Version 6.4 (R2006a) Real-Time Workshop Software
This table summarizes what’s new in V6.4 (R2006a):
New Features and Changes
Yes Details below
Version Compatibility Considerations
Yes—Details labeled as Compatibility Considerations, below. See also Summary.
New features and changes introduced in this version are
“New Build Information Application Program Interface” on page 84
“New Mechanism for Customizing Post Code Generation Build Processing”
on page 85
“New Model Configuration Option for Suppressing Makefile Generation”
on page 85
“New RSim Target Option for Feeding Inport Blocks with MAT-File Data”
on page 86
“Switch Block Optimization for Wide Control Port Signals” on page 86
“Multiport Switch Block Enhanced to Generate D efault Switch Case
Statement” on page 86
Fixed Bugs an d Known Problems
Bug Reports at Web site
Related Documentation at Web Site
No
“C++ Language Support Enhancements” on page 87
“Support for Simulink Sign al Object Initialization” on page 88
“Identifiers and Model Reference Applications” on page 89
“Support for Simulink Parameter Object Data Type Enhancements” on
page 89
“Support for New Simplest Rounding Mode for Fixed-Point Simulink
Blocks” on page 89
“Name Change for PrevZC Identifier in Generated Code” on page 90
83
Real-Time Workshop®Release Notes
“Format Enhancements for model.rtw File” on page 90
“Changes to TLC Files in matlabroot/rtw/c/tlc” on page 93
“New and Enhanced Demos” on page 94
“Documentation Enhancements” on page 94
New Build Information Application Program Interface
V6.4 (R2006a) Real-Time Workshop introduces an application program interface (API) for populating and managing all build information associated with a given model in a single source. This feature
Provides a mechanism for defining b uild information for tool chains that
do not use make files
Makes it easier to customize and maintain a model’s build information
The API includes methods for adding, managing, and retrieving:
Compiler flags
84
Preprocessor identifier definitions
Link flags
Include files and paths
Source files and paths
Libraries
The API also includes methods for updating file paths, extensions, and separators.
For information on how to use the API, see the demo and “Customizing P ost Code Generation Build Processing” in the Real-Time Workshop documentation. For descriptions of the API methods, see “Function Reference” and “Alphabetical List”.
rtwdemo_buildInfo
Version 6.4 (R2006a) Real-Time Workshop®Software
New Mechanism for Customizing Post Code Generation Build Processing
Starting with V6.4 (R2006a), you can customize the Real-Time Workshop build process to evaluate a post code generation command after generating and writing the model’s code to disk and before generating a makefile. A post code generation command is a user-defined MA TLAB file that typically ca ll s functions to get data from or add data to the model’s bui ld information object.
This feature is useful for applications that need to control various aspects of the build process after code generation. For example, this is necessary when you develop your own target, or you want to apply an analysis tool to the generated code before continuing with the build process.
To use this feature, you program the command as a script or function and then define the command with the new parameter.
PostCodeGenCommand model configuration
For more information, see the demo Post Code Generation Build Processing” in the Real-Time Workshop documentation.
rtwdemo_buildInfo and “Customizing
New Model Configuration Option for Suppressing Makefile Generation
V6.4 (R2006a) adds a new option to the Real-Time Workshop pane of the Configuration Parameters dialog box and a corresponding mode l configuration parameter, generation during the build process. For example, you might do this to integrate tools into the build process that are not driven by makefiles.
This option controls whether the Real-Time Workshop build process generates a makefile and is selected by default. If you clear the check box in the graphical user interface or set the parameter to build process does no t generate a makefile for the model. When you suppress makefile generation, you must specify any post code generation processing, including compilation and linking, as a command you program and define, using the feature described in “New Mechanism for Custom izing Post Code Generation Build Processing” on page 85.
GenerateMakefile, which you can use to suppress makefile
off, the Real-Time Workshop
85
Real-Time Workshop®Release Notes
For more information, see “Customizing Post Code Generation Build Processing”.
New RSim Target Option for Feeding Inport B locks with MAT-File Data
The RSim target is enhanced with a new -i command line option that allows you to feed an Inport block with i n put data during simulation from a single MAT-file or you can change the MAT-fil e from one simulation to the next. The format requirements of the MAT-file data are flexible in that it can be a single time/data matrix, a single structure, or multiple structures.
For details on how to set up a MAT-file for use with an Inport block and specify signal data for an Inport block, see the demo “Creating a MAT-File for an Inport Block” and “Specifying Signal Data File for an Inport Block” in the Real-Time Workshop documentation.
Switch Block Optimization for Wide Control Port Signals
In releases prior to the V6.4 (R2006a), Real-Time Workshop software optimized code generated for a Switch block such that the code for blocks connected to the data input ports executed conditionally. This optimization was limited to Switch blocks with a control port receiving scalar signals. V6.4 (R2006a) enhances Real-Time Workshopsoftwaretogeneratecodethat performs conditional branch execution whether the Switch block’s control port signal is a scalar value, a vector, or a matrix.
rtwdemo_rsim_i and
86
For a description of the Switch block, see Switch in the Simulink Reference.
Multiport Switch Block Enhanced to Generate Default Switch Case Statement
In V6.4 (R2006a), the Real-Time Workshop build process is enhanced to generate a default switch case statement for the Mulitport Switch block. For a description of this block, see Multiport Switch in the Simulink Reference.
Version 6.4 (R2006a) Real-Time Workshop®Software
C++ Language Sup
The V6.4 (R2006a generation for S Blockset™ prod
) Real-Time Workshop software adds support for C++ code
ignal Processing Blockset™ and Video a nd Image Processing
ucts.
port Enhancements
Limitations
Microsoft Visual C and Microsoft Visual C++, GNU®C/C++, Watcom
C/C++ and Borland (R2006a) Real-Time Workshop software and are fully supported on 32-bit Windows and 32/64-bit Linux Beta C++ support only for the Intel been fully evaluated for C++ compatibility with MathWorks products.
The Real-Time Workshop software provides Beta support for C++ code
generation for all blockset products. C++ code generation for other blockset products has not yet been fully evaluated.
The Real-Time W orkshop software does not support C++ code generation
for the following:
Embedded Target for Infineon Embedded Target for Motorola Embedded Target for Motorola HC12 Embedded Target for OSEK/VDX Embedded Target for TI’s C2000™ DSP Embedded Target for TI’s C6000™ DSP SimDriveline™ SimMechanics™ SimPowerSystems™ xPC Target™
®
C/C++ compilers have been fully tested with the V6.4
®
platforms. However, V6.4 (R2006a) provides
®
C/C++ compiler, which has not yet
®
C166®Microcontrollers
®
MPC555
®
When using the model r efer ence feature, the language of the code ge nerate d
for the top model and any referenced models must match. For example, if you g enerate C++ code for the top model, the generated code for all referenced models must also be C++ code.
The following Real-Time Workshop Embedded C o der dialog box fields
currently do not accept the
.cpp extension. However, a .cpp file will be
generated if you specify a filename without an extension in these fields, with C++ selected as the target language for your generated code.
87
Real-Time Workshop®Release Notes
- Data definition filename field on the Data Placement pane of the
Configuration Parameters dialog box
- Definition file field for an mpt data object in the Model Explorer
These restrictions on specifying
.cpp will be removed in a future release.
Support for Simulink Signal Object Initialization
V6.4 (R2006a) introduces the ability to initialize Simulink signal objects with user-defined values for simulation and code generation. Data initialization increases application reliability and is a requirement of safety critical applications. Initializing signals for both simulation and code generation can expedite transitions between phases of Model-Based Design.
For details on using this feature, see the demo Signal Objects to Initialize Signals and Discrete States” in the Simulink documentation, and “Using Signal Objects to Ini t ia li ze Signals and Discrete States” in the Real-Time W orkshop documentation.
Compatibility Considerations
In general, if a submodel uses workspace variables and the variables chan ge, the Real-Time Workshop build process rebuilds the submodel. This behavior also occurs if the initial value for a signalobjectthatcorrespondstoasignal initialized from outside the model, such as a global data store or root input port, changes.
To work around this behavior, specify the signal object’s initial value as a tunable parameter. For example:
rtwdemo_sigobj_iv,“Using
88
S = Simulink.Signal; S.InitialValue = 'K'; K = Simulink.Parameter; K.Value = 4; K.RTWInfo.StorageClass = 'ExportedGlobal';
You can then use the tunable parameter to change the signal’s initial value without triggering a subsystem build.
Version 6.4 (R2006a) Real-Time Workshop®Software
Identifiers and Model Reference Applications
As or Version 6.4 (R2006a), to avoid name clashes in models that use model referencing, do one of the following:
Increase the maximum identifier length setting for top and referenced
models until the following warning disappears:
"Warning: Insufficient space for computing symbol names in
model ...",
In this case, uniqueness of model names ensures that the names do not clash.
If you have a Real-Time Workshop Embedded Coder license, you can
define a unique symbol naming scheme for each model. For example, you might define model, and so forth. The uniqueness of the naming scheme prevents name clashing.
'm1$R$N$M' for the first model, 'm2$R$N$M' for the second
Support for Simulink Parameter Object Data Type Enhancements
The V6.4 (R2006a) Real-Time Workshop software supports the following Simulink parameter object data type enhancements discussed in “Data Type Property of Parameter Objects Now Settable” and “Range-Checking for Parameter a nd Signal Object Values” in the Simulink Release Notes.
Support for fixed-point data types
Abilitytospecifythedatatypeattributeindependentlyoftheobject’s
value attribute
For a discussion on the code generation aspects of this enhancement, see the demo
rtwdemo_paramdt and“GeneratedCodeforParameterDataTypes”in
the Real-Time Workshop documentation.
Support for New Simplest Rounding Mode for Fixed-Point Simulink Blocks
The V6.4 (R2006a) Real-Time Workshop software supports the new Simplest rounding mode that is available for the Round integer calculations toward
89
Real-Time Workshop®Release Notes
parameter of some fixed-point Simulink blocks. This rounding mode attempts to reduce or eliminate the need for extra rounding code in generated code. The
Simplest rounding mode is currently available for the following blocks:
Data Type Conversion
Product
Lookup Table
Lookup Table (2-D)
Lookup Table Dynamic
For more information, see “Rounding” in the Simulink
®
Fixed Point™
documentation.
Name Change for PrevZC Identifier in Generated Code
In earlier releases, the identifier generated for a data item representing previous zero-crossing signal states (type
PrevZCSigStates_model)was
named inconsistently. Depending on your target configuration, the identifier could be generated as (R2006a), the identifier is generated as
model_PrevZCSigState or model_PrevZC.InV6.4
model_PrevZCSigState across all
configurations. For example, the following would appear in generated C code for a model named
/* Previous zero-crossings (trigger) states */ PrevZCSigStates_mydemo mydemo_PrevZCSigState;
mydemo (for which zero-crossing data is relevant):
Format Enhancements for model.rtw File
Starting in V6.4 (R2006a), the Real-Time W orkshop software repres ents data type information in the file format omits the fields
Width from where they occurred in the following records.
model.rtw in a more compact format. This new
ComplexSignal, DataTypeIdx , Dimensions,and
90
Version 6.4 (R2006a) Real-Time Workshop®Software
Record Record Type Fields Removed
BlockOutputs
Dworks
ExternalInputs
ExternalOutputs
Block output ports
Block Dworks
External inputs
External
ComplexSignal DataTypeIdx Width
ComplexSignal Width
ComplexSignal DataTypeIdx Width
Width
outputs
ModelParameters
Model parameters
ComplexSignal DataTypeIdx Dimensions Width
The following topics discuss
“New Target Language Com piler Library Functions That Support the New
File Format” on page 91
“Compatibility Considerations” on page 92
New Target Language Compiler Library Functions That Support the New File Format
In support of the new file format, V6.4 (R2006a) adds the following new Target Language Compiler (TLC) library functions for gaining access to the
ComplexSignal, DataTypeIdx, Dimensions,andWidth fields for a given
record. You can use the new functions with the new and old file formats.
Function Description
LibGetRecordIsComplex(rec)
LibGetRecordDataTypeId(rec)
Returns the value 1 if the specified record is complex, and 0 otherwise.
Returns the data type identifier of the specified record as a an integer.
91
Real-Time Workshop®Release Notes
Function Description
LibGetRecordDimensions(rec)
LibGetRecordWidth(rec)
Compatibility Considerations
The Target Language Compiler (TLC) includes library functions for retrieving data from fields of the from
model.rtw directly, that is, without using the documented TLC library
functions, the application will be incompatible and will produce incorrect results. In such cases, reprogram your application to use the documented TLC library f unctions to retrieve data from
Thefollowingtableliststhefieldsnowomittedfrommodel.rtw and the TLC library functions you can use to gain access to the fields for various types of records.
Returns the dimensions of the specified record as a vector of integers.
Returns the width of the specified record as an integer.
model.rtw file. If your application retrieves data
model.rtw.
Field Record Type
ComplexSignal
DataTypeIdx
92
Block input port
Block output port
Block parameter
Block Dwork
Block input port
Block output port
TLC Functions
LibBlockInputSignalIsComplex LibGetRecordIsComplex
LibBlockOutputSignalIsComplex LibGetRecordIsComplex
LibBlockParameterIsComplex LibGetRecordIsComplex
LibBlockDWorkIsComplex LibGetRecordIsComplex
(Both functions return 1 or 0, which maptotheoldvalues
'yes' and 'no',
respectively.)
LibBlockInputSignalDataTypeId LibGetRecordDataTypeId
LibBlockOutputSignalDataTypeId LibGetRecordDataTypeId
Version 6.4 (R2006a) Real-Time Workshop®Software
Field Record Type
Block parameter
Block Dwork
Dimensions
Block input port
Block output port
Block parameter
Width
Block input port
Block output port
Block parameter
Block Dwork
For descriptions of the new functions LibGetRecordIsComplex,
LibGetRecordDataTypeId, LibGetRecordDimensions,and LibGetRecordWidth, see “New Target Language Compiler Library Functions
That Support the New File Format” on page 91. For descriptions of other functions liste d in the preceding table, see “T LC Function Library Reference” in the Real-Time Workshop Target L ang ua ge C om piler documentation.
TLC Functions
LibBlockParameterDataTypeId LibGetRecordDataTypeId
LibBlockDWorkDataTypeId LibGetRecordDataTypeId
LibBlockInputSignalDimensions LibGetRecordDimensions
LibBlockOutputSignalDimensions LibGetRecordDimensions
LibBlockParameterDimensions LibGetRecordDimensions
LibBlockInputSignalWidth LibGetRecordWidth
LibBlockOutputSignalWidth LibGetRecordWidth
LibBlockParameterWidth LibGetRecordWidth
LibBlockDWorkWidth LibGetRecordWidth
Changes to TLC Files i n matlabroot/rtw/c/tlc
TLC files in the directory matlabroot/rtw/c/tlc have changed.
You should not customize TLC files in this directory even though the capability exists to do so. Such TLC customizations might not be applied during the code generation process and can lead to unpredictable results.
93
Real-Time Workshop®Release Notes
Compatibility Considerations
Customizations to the files in matlabroot/rtw/c/tlc are not compatible across releases. If you have customized TLC files that reside in t hat directory, you must reapply your customizations when you upgrade.
New and Enhanced Demos
New demos are
Demo...
rtwdemo_buildInfo
rtwdemo_paramdt
rtwdemo_rsim_i
rtwdemo_sigobj_iv
The following demos have been enhanced:
rtwdemo_rsim_batch_script
Shows How You Can...
Customize post code generation build processing by using the new build information A P I and new post code generation command
Control the data type of tunable parameters in code that the Real-Time W o rk shop software generates
Use the new -i RSim target option to feed Inport blocks with MAT-file data
Initialize Simulink signal objects with the new Simulink signal object initialization feature
Documentation Enhancements
New reference docume ntatio n — Real-Time Workshop Reference
New tables that summarize dependencies of optimization and interface
model configuration parameters
94
“Testing and Refining Concept Models With Standalone Rapid Simulations”
— reorganized to reflect workflow
Version 6.3 (R14SP3) Real-Time Workshop®Software
Version 6.3 (R14SP3) Real-Time Workshop Software
This table summarizes what’s new in V6.3 (R14SP3):
New Features and Changes
Yes Details below
Version Compatibility Considerations
Yes—Details labeled as Compatibility Considerations, below. See also Summary.
New features and changes introduced in this version are
“New rtw_precompile_libs Function” on page 96
“Support for Subsystem Latch Enhancements” on page 96
“Support for Variable Transport Delay Enhancements” on page 97
“C++ Target Language Support for the Real-Time Windows Target Product
and External M ode” on page 97
“Rapid Simulation Target Enhanced for Use with the D istributed
ComputingToolboxProduct”onpage98
“Simulink Model and MATLAB Desktop Window Interaction Enhanced”
on page 98
“Customizations to Built-In Blocks” on page 98
Fixed Bugs an d Known Problems
Bug Reports at Web site
Related Documentation at Web Site
No
“Use slbuild Instead of rtwgen” on page 98
“Model Hardware Configuration Parameters Now Honor Device Type
Restrictions” on page 99
“rem Function No Longer Supports Tunable Arguments” on page 100
“Block Libraries, RSim Target Executables, and MAT-Files” on page 100
“Documentation Enhancements” on page 100
95
Real-Time Workshop®Release Notes
New rtw_precomp
The V6.3 (R14SP3 function,
Precompile new
precompiling your precompi can omit libra numerous lib
Recompile pr
Workshop pr this if you n environmen
For detail Libraries
rtw_p
sonusing
” in the Real-Time Workshop documentation.
Support f
The V6.3 ( enhance Port Lat
Arenam
(buffe
to bett
R14SP3) Real-Time Workshop software supports Simulink latch
ments for triggered and function-call subsystems discussed in “Input
ching Enhancements” in the Simulink Release Notes.
ed Inport block option is available for triggered subsystems. Latch r) input was renamed to Latch input by delaying outside signal er reflect the option’s purpose.
) Real-Time Workshop product introduces a new MATLA B
recompile_libs
or updated S-function libraries (MEX-files) for a model. By
S-function libraries, you can optimize system builds. O nce
led libraries exist, the Real-Time Workshop build process
ry compilation from subsequent builds. For m odels that use
raries, the time savings for build processing can be significant.
ecompiled libraries included as part of the Real-Time
oduct, such as eed to customize compiler settings for various platforms or ts.
rtw_precompile_libs, see “Precompiling S-Function
or Subsystem Latch Enhancements
ile_libs Function
, which you can use to
rtwlib or dsplib. You might consider doing
96
Anewo
Inpor
If you subs
Pres
migh
Pla
fun
rmoredetail,seethedescription of the Inport block.
Fo
ption, Latch input by copying inside signal, was added for the
t block for use w ith function-call subsystems.
select Latch input by copying inside signal for a function-call
ystem, the Real-Time Workshop build process
erves latches in generated code regardless of any optimizations that
tbeset
ces the code for latches at the start of a subsystem’s output/update
ction
Loading...