Mathworks REAL-TIME WORKSHOP EMBEDDED CODER RELEASE NOTES user guide

Real-Time Workshop
®
Embedded Coder™ Release Notes
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 2003–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.
Embedded Coder™ Release Notes
Summary by Version ............................... 1
Contents
Version 5.5 (R2010a) Real-Time Workshop
Coder Software
.................................. 4
Version 5.4 (R2009b) Real-Time Workshop
Coder Software
.................................. 16
Version 5.3 (R2009a) Real-Time Workshop
Coder Software
.................................. 33
Version 5.2 (R2008b) Real-Time Workshop
Coder Software
.................................. 44
Version 5.1.1 (R2008a+) Real-Time W orkshop
®
Embedded
®
Embedded
®
Embedded
®
Embedded
®
Embedded Coder Software ....................... 57
Version 5.1 (R2008a) Real-Time Workshop
Coder Software
.................................. 58
Version 5.0.1 (R2007b+) Real-Time Workshop
®
Embedded
®
Embedded Coder Software ....................... 66
Version 5.0 (R2007b) Real-Time Workshop
Coder Software
.................................. 67
Version 4.6.1 (R2007a+) Real-Time W orkshop
®
Embedded
®
Embedded Coder Software ....................... 80
Version 4.6 (R2007a) Real-Time Workshop
Coder Software
.................................. 81
Version 4.5 (R2006b) Real-Time Workshop
Coder Software
.................................. 90
®
Embedded
®
Embedded
iii
Version 4.4.1 (R2006a+) Real-Time W orkshop
®
Embedded Coder Software ....................... 98
Version 4.4 (R2006a) Real-Time Workshop
Coder Software
.................................. 99
Version 4.3 (R14SP3) Real-Time Workshop
Coder Software
.................................. 112
Version 4.2.1 (R14SP2+) Real-Time Workshop
®
Embedded
®
Embedded
®
Embedded Coder Software ....................... 117
Version 4.2 (R14SP2) Real-Time Workshop
Coder Software
.................................. 118
Version 4.1 (R14SP1) Real-Time Workshop
Coder Software
.................................. 123
Version 4.0 (R14) Real-Time Workshop
Coder Software
.................................. 125
Version 3.2.1 (R13SP2) Real-Time Workshop
Coder Software
.................................. 153
®
Embedded
®
Embedded
®
Embedded
®
Embedded
iv Contents
Version 3.2 (R13SP1+) Real-Time Workshop
Coder Software
.................................. 155
Version 3.1 (R13SP1) Real-Time Workshop
Coder Software
.................................. 161
Compatibility Summary for Real-Time Workshop
®
Embedded
®
Embedded
®
Embedded Coder Software ....................... 166
SummarybyVersion
This table provides quick access to what is new in each version. For clarification, see “Using Release Notes” on page 2 .
Real-Time Workshop®Embedded Coder™ Release Notes
Version (Release)
Latest Versi V5.5 (R2010a
V5.4 (R2009b)
V5.3 (R2009a)
V5.2 (R2
V5.1.1 (R2008a+)
V5.1 (R2008a)
1 (R2007b+)
V5.0.
V5.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
Yes Summary
Yes Summary
Yes Summary
Yes Summa
No Bug Reports
ry
y
ns
Fixed Bugs and Known Problems
Bug Reports Includes fix
Bug Reports Includes fixes
Bug Repor Includes
Bug Reports Includes fixes
Includes fixes
Bug Rep Inclu
Includes fixes
Includes fixes
ts
fixes
orts
des fixes
es
Related Documentation at Web Site
Printable R elease Notes: PDF
Current product documentation
No
No
No
No
No
No
No
V4.6.1 (R2007a+)
.6 (R2007a)
V4
V4.5 (R2006b)
No No Bug
Inc
Yes Details
Yes Details
No Bug Reports
Includes fixes
Yes Summary
Bug Reports Includes fixes
Reports
ludes fixes
No
No
No
1
Real-Time Workshop®Embedded Coder™ Release Notes
Version (Release)
V4.4.1 (R2006a+)
V4.4 (R2006a)
V4.3 (R14SP3)
V4.2.1 (R14SP2+)
V4.2 (R14SP2)
V4.1 (R14SP1)
V4.0 (R14)
V3.2.1 (R13SP2)
V3.2 (R13SP1+)
New Features and Changes
No No Bug Reports
Yes Details
Yes Details
No No Bug Reports
Yes Details
Yes Details
Yes Details
Yes Details
Yes Details
Version Compatibility Considerations
Yes Summary
Yes Summary
Yes Summary
No
Yes Summary
No
No
Fixed Bugs and Known Problems
Includes fixes
Bug Reports Includes fixes
Bug Reports Includes fixes
Includes fixes
Bug Reports Includes fixes
Fixed bugs
Fixed bugs
Fixed bugs V3.2.1 product
No bug fixes
Related Documentation at Web Site
No
No
No
No
No
No
No
documentation
No
V3.1 (R13SP1)
2
Yes Details
No
No bug fixes
No
Using Release Notes
Use release notes when upgrading to a newer version to learn about:
New features
Changes
Potential impact on your existing files and practices
SummarybyVersion
Review the release notes for other MathWorks™ products required for this product (for example, MATLAB
®
or Simulink®). Determine if enhancements,
bugs, or compatibility considerations in other products impact you.
If you are upgrading from a software version other than the m ost recent one, review the current release notes and all interim versions. For example, when you upg rade from V1.0 to V1.2, review the release notes for V1.1 and V1.2.
What Is in the Release Notes
New Features and Changes
New functionality
Changes to existing functionality
Version Compatibility Con si derations
When a new feature or change introduces a reported incompatibility between versions, the Compatibility Considerations subsection explains the impact.
Compatibility issues reported after the product release appear under Bug Reports at The MathWorks™ Web site. Bug fixes can sometimes result in incompatibilities, so review the fixed bugs in Bug Reports for any compatibility impact.
Fixed Bugs and Known Problems
The MathWorks offers a user-searchable Bug Reports database so you can view Bug Reports. The development team updates this database at release 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.
3
Real-Time Workshop®Embedded Coder™ Release Notes
Version 5.5 (R2010a) Real-Time Workshop Embedded Coder Software
New Features and Changes
Yes Details below
This table summ
Version Compatibility Considerations
Yes—Details as Compatibi
Considerat
below. See a Summary
New features and changes introduced in this version are:
“Customize Generated C ode Modules Using File Packaging Format
Configuration Parameter” on page 5
“Code Generation Verification Improvements” on page 5
“AUTOSAR Compiler Abstraction Macro G eneration” on page 6
“AUTOSAR Enhancements” on page 6
“Software-in-the-Loop Simulation Mode” on page 7
“Code Coverage Measurement for Generated Code” on page 8
“Specify Bitfield Declarator Type Using New Configuration Parameter”
on page 8
arizes what is new in Version 5.5 (R2010a):
labeled
lity
ions,
lso
Fixed Bugs an d Known Problems
Bug Reports Includes fixes
Related Documentation at Web Site
Printable Re Notes: PDF
Current pro documentat
lease
duct
ion
“Efficiency Objective for Code Generation Separated into Execution, ROM,
and RAM” on page 8
“Generated Code Enhancements” on page 9
“Model Variants Improvements for Code Generation” on page 11
“Code Generation Template Enhancements for Function and File Banner
Customization” on page 11
“Target Function Library Enhancements” on page 11
4
Version 5.5 (R2010a) Real-Time Workshop®Embedded Coder™ Software
“Data Type Replacement Extended to Map Booleans to Signed Integers”
on page 13
“Exported Function Code Enhanced to Allow Bit Packing” on page 13
“Enhanced Multiple-Instance Subsystem Code” on page 13
“Obsolete Header File rtw/c/ert/ertformat.h Removed” on page 14
“NameChangetotheReal-Time Workshop > Data Placement Pane”
on page 14
“MISRA C Model Advisor Checks” on page 14
“New and Enhanced Demos” on page 15
Customize Generated Co de Modules Using File Packaging Format Configuration Parameter
R2010a introduces a new configuration parameter, “File packaging format”, on the Code Placement pane of the Configuration Parameters dialog box. This parameter p rovides several options to reduce the number of files generated. See “Customizing Generated Code Modules ”, for more information.
Code Generation Verification Improvements
R2010a includes additional functionality to the Code Generation Verification (CGV) API. The cgv.CGV class now contains the following methods:
getSavedSignals returns a list of signal names from the input data
createToleranceFile creates a file correlating tolerance information with
signal names.
compare compares like-named signals between two models
plot creates a plot of a provided list of signals
See “ Veri fying N u m erical Eq u iv a len c e with Code Generation Verification” for more information on how to use these methods for code generation verification.
5
Real-Time Workshop®Embedded Coder™ Release Notes
AUTOSAR Compile
R2010a provides abstraction mac C macros contai
For more infor Macros” in the
a new option to generate AUTOSAR code with compiler ros. If you select this option, the software generates code with ning platform-independent compiler directives.
mation, see “G enerating AUTOSAR Compiler Abstraction
Real-Time Workshop
r Abstraction Macro Generation
Compatibility Considerations
In R2010a, ne
FUNC
VAR
CONST
P2VAR
P2CONST
If your AU these ke R2010a s reconfi reserv
gure your model to replace these keywords with names that are not
ed keywords.
w reserved keywords for AUTOSAR support are:
TOSAR model (system target file
ywords for the name of a variable or function to be generated, then
oftware produces an error when you build the model. You must
®
Embedded Coder™ documentation.
autosar.tlc)specifiesanyof
AUTOSA
R Enhancements
SIL and PIL Simulation Support
nd PIL simulation modes now support verification of AUTOSAR code
SIL a
rated from top models.
gene
ore information about this option, see “Verifying the AUTOSAR Code
For m
h SIL and PIL Simulations” in the Real-Time W orkshop Embedded Coder
wit
umentation.
doc
6
Version 5.5 (R2010a) Real-Time Workshop®Embedded Coder™ Software
Software-in-the-Loop Simulation Mode
New Software-in-the-Loop (SIL) simulation mode allows you to run top models or M odel blocks as a SIL simulation. With this mode, you can:
Verify generated source code without modifying the original model.
Reuse test harnesses for the original model with the generated source code.
This mode, which executes code on the host computer, also provides a convenient alternative to PIL simulation when target hardware is not available.
For more information, see “Verifying Code Using the SIL Simulation Mode” in the Real-Time Workshop Embedded Coder documentation.
For examples of SIL verification, see the demo
rtwdemo_sil_pil_script(previously called rtwdemo_sil_pil in R2009b).
Compatibility Considerations
The new Software-in-the-Loop (SIL) simulation mode repla ces host-based PIL simulation. R2010a software generates an error if all of the following is true about your model:
The model has been saved using the R2009b, or earlier, software.
The simulation mode is set to PIL.
The model is configured correctly for host-based PIL simulation using
R2009b software.
The error message is:
ModelName is not correctly configured for PIL simulation. The model was
last saved in an older release and is configured for "host-based PIL"
simulation. "Host-based PIL" simulation is no longer available and has
been replaced by SIL simulation. If ModelName is referenced by a Model
block running in PIL mode, you must change the simulation mode of the
Model block to SIL. If ModelName is a top model running in PIL mode, you
must change the top-model simulation mode to SIL. Re-run the simulation
when you have changed the simulation mode.
7
Real-Time Workshop®Embedded Coder™ Release Notes
ModelName isthenameofamodelorthepathtoaModelblockinPILmode.
Code Coverage Measurement for Generated Code
You now have a new option to measure code coverage using the BullseyeCoverage™ tool from Bullseye Testing Technology™. When you run a top-model or Model block SIL simulation, this option allows you to collect code coverage metrics for generated source code.
For more information, see “Using a Code Coverage Tool in a SIL Simulation” in the Real-Time Workshop Embedded Coder documentation.
Specify Bitfield Declarator Type Using New Configuration Parameter
R2009b introduced a new optimization to “Pack Boolean data into bitfields” on the Optimization pane of the Configuration Parameters dialog box. Selecting this option now enables a new configuration parameter, “Bitfield declarator type specifier”, to specify the data type for bitfields as
unsigned char. T he optimization benefit of selecting a specific data type
is dependent on your target.
unsigned int or
Efficiency Objective for Code Generation Separated into Execution, ROM, and RAM
Previously, you could select Efficiency as your code generation objective. The Code Generation Advisor provided advice for configuration parameters that were common to RAM, RO M , and execution efficiency objectives. If a parameterwasnotcommontoallthreeobjectives,theCodeGeneration Advisor did not provide advice for that parameter.
In R2010a, the code generation efficiency objective is separated into three objectives: The new efficiency objectives allow you to explicitly define your goal for generating code. The Code Generation Advisor provides advice on configuration parameters that are specific to the objectivesthatyouspecify, resulting in more complete advice.
8
Execution efficiency, ROM efficiency,andRAM efficiency.
Version 5.5 (R2010a) Real-Time Workshop®Embedded Coder™ Software
For details, see “Mapping Application Objectives to Model Configuration Parameters”.
Compatibility Consideration
When you open the Configuration Parameters dialog box, if you previously specified the efficiency objective with the following priority of the new objectives:
1 Execution efficiency
2 ROM efficiency
3 RAM efficiency
The priority of the new objectives causes the Code Generation Advisor to provideadvicethatissimilartotheobsolete
Efficiency for the code generation objective, the software replaces
Efficiency objective.
If you previously created a custom objectiv e based on the
Efficiency
objective, the custom objective contains the same parameters and checks that it did when you created it.
Generated Code Enhancements
In R2010a, code generation enhancements are the following:
Enables in-place read and write operations on a data store memory. The
generate code operates on the data store memory directly without making extra copies. This optimization uses less RAM and ROM, and executes faster.
Eliminates unnecessary DWorks associated with an Assignment block in
an iterator subsystem. The generated code uses less global memory.
Uses local variables instead of a global DWork for a Unit Delay or Memory
block when their state value is not persistent. For example, when the blocks are in an Iteration system with the block parameter States when starting set to executes faster.
Eliminates a data copy when passing a submatrix, containing contiguous
data, to a function. For example, this optimization occurs when a submatrix
reset. The generated code uses less global memory and
9
Real-Time Workshop®Embedded Coder™ Release Notes
signal is selected through a Selector block and passed into a Stateflow chart. The generated code now passes the address of the first element of the submatrix to the function. This optimization generates less code, uses less RAM, and execute s faster.
Improve code reuse of identical subsystems in different instances w he n
the subsystem arguments are individually passed by reference and are different storage classes. This optimization reduces ROM usage of the generated code.
Improves handling of if-else patterns for enabled subsystem pairs, which
are driven by enabled signals and the v alues of the two signals are the opposite at any time. In the generated code, this optimization uses local variables instead of global variables for the enabled subsystem outputs. This optim ization uses less RAM and ROM and executes faster.
Improves expression folding to reduce data copies in a Bus Assignment and
Switch block pattern. This optimization improves the execution speed of the generated code.
Improves C code generation for Embedded MATLAB
concatenated arrays or matrix signals. The g enerated code uses less RAM and ROM, and executes faster.
Uses a local variable instead of gl o bal data in the generated code for the
output of a While iterator subsystem. This optimization occurs when this system executes at least once for all time steps.
®
code when handling
®
10
Enables inlin in g of gene r ated cod e fo r State fl ow cha r ts, even if the
generated code calls a subfunction which accesses global Simulink data. This optimization removes a limitation of inlining Stateflow code.
Improves handling of vector operations. Identifies more opportunities for
merging similar loops and replacing indexed vector signals with scalar variables. The generated code uses less RAM and ROM, and executes faster.
Generates more efficient code for enabled subsystems by
- Optimizing away conditional mode-checking code when it is superfluous.
- Replacing a SUBSYS_ENABLED/SUBSYS_DISABLED enumerated
type with a Boolean type.
Version 5.5 (R2010a) Real-Time Workshop®Embedded Coder™ Software
Model Variants Improvements for Code Generation
Previously, when you used a Simulink.Parameter object of enumerated type for variant object conditions, the generatedcodeonlyincludedacheckthat the variables were defined. In R2010a, the generated code now includes preprocessor conditionals to che ck that the variant object condition variables contain valid values of the enumerated type definition. See “Variant Models and Enumerated Types” and “Defining Variant Control Variables and Variant Objects for Generating Code” for more information.
The Code Variants Report in the HTML Code Generation Report now displays the variant objects in alphabetical order for better readability.
Code Generation Template Enhancements for Function and File Banner Customization
Improvements to the function and file banner customization for the generated code include:
File banner generation in
A new tag attribute,
banners. See “Customizing a Code G eneration Template (CGT) File for File and Function Banner Generation” for more information.
A token attribute,
This attribute provides finer control of the content of the block description comments in the generated code. See “Function Banner” for more information.
style, for the function banner token, BlockDescription.
rtwtypes.h.
width, to specify the width of both function and file
Target Function Library Enhancements
R2010a provides several enhancements to target function libraries (TFLs), with corresponding updates to the demo
C++ Name Spaces Supported
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. (For more information, see “New C++ (ISO) Math Library” in the Real-Time Workshop
®
release notes.)
rtwdemo_tfl_script.
11
Real-Time Workshop®Embedded Coder™ Release Notes
In addition, you can now specify C++ name spaces on TFL replacement functions. R2010a provides a programmatic interface that allows you to register a TFL entry with the implementation defined in a C++ name space. If the conceptual signature is matched for the entry, the C++ name space isemittedtothegeneratedcode. Formore information, see the reference pages for the new TF L table creation functions registerCPPFunctionEntry, enableCPP, and setNameSpace.
Ability to Create Custom TFL Entries
TFLs now support custom entries that allow you to specify near-arbitrary match criteria. You first create your own TFL entry class, derived from either
RTW.TflCOperationEntryML (for operator replacement). In your derived
class, you implement a and customize the match criteria. You also can modify the implementation signature to meet your application needs. For more information, see “Refining TFL Matching and Replacement Using Custom TFL Table Entries” in the Real-Time Workshop Embedded Coder documentation.
RTW.TflCFunctionEntryML (for function replacement) or
do_match method with a fixed preset signature
12
Enhanced Support for Scalar Operator Replacement
R2010a adds TFL support for replacing scalar complex operations, including addition, subtraction, multiplication, cast, and complex conjugation. Mixed types are supported. For more information, see “Example: Mapping Scalar Operators to Target-Specific Implementations”.
Additionally, you can now replace fixed-point shift right for all fixed-point input types. For more information, see “Mapping Fixed-Point Operators to Target-Specific Implementations”.
Note Real-Time Workshop Embedded Coder documentation provides a current list of all operators supported or replacement with custom library functions using TFL tables.
Enhanced Support for Nonscalar Operator Replacement
R2010a adds TFL support for replacing Hermitian and complex conjugate operations for nonscalar inputs.
Version 5.5 (R2010a) Real-Time Workshop®Embedded Coder™ Software
Additionally, you can now replace a transposition or Hermitian operation combined with matrix multiplication with a single BLAS function call.
For more information, see “Mapping Nonscalar Operators to Target-Specific Implementations”.
Data Type Replacement Extended to Map Booleans to Signed Integers
R2010a extends data type replacement to allow mapping the boolean built-in data type to any of the following integer types:
int8
uint8
intn
uintn
where n is 8, 16, or 32, matching the integer word size for your production hardware (for example, execution speed of generated code on some targets. For more information, see “Replacing Embedded Coder documentation.
boolean with an Integer Data Type” in the Real-Time Workshop
int32 for 32-bit hardware). This can increase the
Exported Function Code Enhanced to Allow Bit Packing
To s upport multithread deploym ent of expo rte d functions, gene rated code f or exported functions has been enhanced to allow multithread-safe bit packing.
Enhanced Multiple-Instance Subsystem Code
R2010a removes some limitation s on code generation for ERT multiple-instance models. The following forced-nonreusable subsystems are now allowed in ERT multiple-instance models:
Subsystems with noninlined S-functions as triggers
Subsystems with wide function-calls as triggers
13
Real-Time Workshop®Embedded Coder™ Release Notes
Obsolete Header File rtw/c/ert/ertformat.h Removed
R2010a removes the obsolete static header file rtw/c/ert/ertformat.h. Macros equivalent to the macros defined by automatically generated since R13.
Compatibility Considerations
If you have static C files authored before R13, such as a static main.c,andif the files reference the header file the files as follows:
1 Include the file rtwtypes.h in your C code (for example, #include
"rtwtypes.h"
2 Replace all occurrences of the macro name ssGetErrorStatus with
rtmGetErrorStatus, and replace all occurrences of the macro name ssSetErrorStatus with rtmSetErrorStatus.
).
Name Change to the Real-Time Workshop > Data Placement Pane
In R2010a, the Real-Time Workshop > Data Placement pane in the Configuration Parameter dialog box is now the Real-Time Workshop > Code Placement pane to better d escribe existing and new functionality of the parameters o n this pane. See “Real-Time Workshop Pane: Code Placement” for more information.
ertformat.h have been
rtw/c/ert/ertformat.h, you must modify
14
MISRA C Model Advisor Checks
The Simulink Model Advisor includes the following new MISRA C compliance checks:
“Check for blocks not recommended for MISRA-C:2004 compliance”
“Check configuration parameters for MISRA-C:2004 compliance”
For more information about the Model Advisor, see “Consulting the Model Advisor” in the Simulink documentation.
®
Version 5.5 (R2010a) Real-Time Workshop®Embedded Coder™ Software
New and Enhanced
The following de
Demo...
rtwdemo_cgv
The following demos have been enhanced in R2010a:
Demo... Now...
rtwdemo_tfl_script
rtwdemo_rtwecintro
rtwdemos
Tutorial Generat the Mode
>Guided
s > Step-by-Step Code
ion Process > Understanding
l
mos have been added in R2010a:
Demos
Shows How You Can...
Compare a model in different simulations using the Code Generation Verification API.
Illustrates new target function library (TFL) capabilities, such as custom TFL table entries and enhanced support for scalar and nonscalar operator replacement.
Illustrat configur
Illustrates:
Using code generation objectives to configure
models.
Saving configuration sets using the
method of the Simulink.ConfigSet clas s.
es using code generation objectives to
e models.
saveAs
15
Real-Time Workshop®Embedded Coder™ Release Notes
Version 5.4 (R2009b) Real-Time Workshop Embedded Coder Software
New Features and Changes
Yes Details below
This table summ
Version Compatibility Considerations
Yes—Details as Compatibi
Considerat
below. See a Summary
New features and changes introduced in this version are
“Improved User Guide Documentation” on page 17
“Code Generation O bjectiv es Now Customizable” on page 17
“Code Generation Obje ctive s Limitation Removed” on page 18
“Verify Numerical Equivalence of Results” on page 18
“Automatically Verify a SIL or PIL Configuration” o n page 18
“New Top-Model Processor-in-the-Loop (PIL) Simulation Mode” on page 19
“Processor-in-the-Loop Enhancements” on page 19
arizes what is new in Version 5.4 (R2009b):
labeled
lity
ions,
lso
Fixed Bugs an d Known Problems
Bug Reports Includes fixes
Related Documentation at Web Site
Printable Re Notes: PDF
Current pro documentat
lease
duct
ion
16
“Ability to Generate Switch-Case Statements for Embedded MATLAB
Function Blocks and Stateflow Charts” on page 20
“Target Function Library Enhancements” on page 21
“C++ Encapsulation Enhancements” on page 23
“AUTOSAR Enhancements” on page 26
“Pack Boolean Data Into Bitfields in the Generated Code Using New
Configuration Parameter” on page 27
“Generate Preprocessor Conditional Directives Using New Configuration
Parameter” on page 27
Version 5.4 (R2009b) Real-Time Workshop®Embedded Coder™ Software
“Specify Function Argument Names Using New Configuration Parameter”
on page 27
“Remove or Preserve extern Keyword In Generated Code Function
Declarations Using New Configuration Parameter” on page 28
“New Function Banner Customization and Code Generation Template
Improvements” on page 28
“HTML Code Generation Report Provides Hyperlink to Requirements
Document” on page 28
“Code Traceability Improvement” on page 29
“Tunable Iteration Limit for the For Iterator block” on page 29
“Generated Code Enhancements” on page 29
“Duplicate Block Comments No Longer Appear in the Generated Code”
on page 31
“Block Comments for Custom Blocks are Now Configurable” on page 31
“Name Improvement for Block Parameter Structure in Generated Code”
on page 31
“Generate Code for Variable-Size Signals Using New Configuration
Parameter” on page 31
“New and Enhanced Demos” on page 32
Improved User Guide Documentation
The Real-Time Workshop Embedded Coder User’s Guide has been reorganized and consolidated to better support user workflows.
Code Generation Objectives Now Customizable
Previously, you could run the Code Gen eration Advisor based on four predefined objectives: efficiency, traceability, safety precaution, and debugging. In R2009b, you can create customized objectives and use the C ode Generation Advisor to review models against the custom objectives.
You can use the Code Generation ObjectiveAPItocreatecustomobjectivesby:
17
Real-Time Workshop®Embedded Coder™ Release Notes
Creating a new objective and adding parameters and checks to a new
objective.
Creating a new objective based on an existing objective, then adding,
modifying and removing the parameters and checks within the new objective.
For details, see “Creating Custom Objectives” in the Real-Time Workshop Embedded Coder User’s Guide.
Code Generation Objectives Limitation Removed
Previously, the code generator did not support reviewing referenced models during the build process. In R2009b, The MathWorks removes this limitation. In the Configuration Parameters dialog box, on the Real-Time Workshop pane, select Check m odel before build to review the top model and referenced models during the build process.
For details, see “Reviewing Objectives in Referenced Models” in the Real-Time Workshop Embedded Coder User’s Guide.
18
Verify Numerical Equivalence of Results
In R2009b, you can use Code Generation Verification (CGV) t o verify the numerical equivalence of results when you execute a model in different modes of execution. CGV supports executing the model in simulation, Software-In-the-Loop (SIL), and Processor-In-the-Loop (PIL).
For details, see “Verifying Numerical Equivalence of Results with Code Generation Verification API” in the Real-Time Workshop Embedded Coder documentation.
Automatically Verify a SIL or PIL Configuration
You might need to change model settings to configure the model correctly for SIL or PIL. To find out what settings you must change, you can use the
cgv.Config class. Us ing the cgv.Config class, you can review your model
configuration and determine which settings you must change to configure the model correctly for SIL or PIL.
Version 5.4 (R2009b) Real-Time Workshop®Embedded Coder™ Software
For details, see “Verifying a SIL or PIL Configuration” in the Real-Time Workshop Embedded Coder documentation.
New Top-Model Processor-in-the-Loop (PIL) Simulation Mode
New Processor-in-the-Loop (PIL) simulation mode allows you to run a complete model as a PIL simulation on your target processor, debugger, or instruction set simulator. With this mode, you can verify the object code that is generated and compiled from a complete model without creating a separate test harness model. This provides an alternative to block-based approaches where the PIL sim ulation is performed using a test harness model that contains a block executing in PIL mode (e.g. Model block PIL).
Additionally, by selecting your host machine as the target hardware, you can use the PIL simulation mode to perfo rm Software-in-the-Loop (SIL) verification. Again, this provides an alternative to block-based approaches for SIL.
For more information on this new mode (and how it differs from the block-based PIL and SIL), see “Verifying Compiled Object Code with Processor-in-the-Loop Simulation” and “Choosing a PIL Approach” in the Real-Time Workshop Embedded Coder documentation.
For examples of SIL and PIL verification, see the new demo rtwdemo_sil_pil.
Processor-in-the-Loop Enhancements
Bus Support
Processor-in-the-loop (PIL) now provides support for buses.
For more information on PIL bus support, see “I/O Support ” in the PIL support tables in the Real-Time Workshop Embedded Coder documentation.
Data Stores and Imported Data Definition
PIL now provides support for global data stores and grouped custom storage classes.
19
Real-Time Workshop®Embedded Coder™ Release Notes
PIL support for imported data definition is improved. You can use s i gn als, parameters, data stores, etc., that specify storage classes with imported data definitions. For exceptions, see “Imported Data Definitions” in the PIL support tables.
For more information on PIL support, see “SIL and PIL Simulation Support and L imitations” in the Real-Time Workshop Embedded Coder documentation.
PIL Block Behavior with Goto/From Blocks
You will now see an error if your PIL component includes any Goto / From blocks that cross the boundary of the PIL component.
Previously it was possible but not recommended to use Goto/From blocks for I/O data that crosses the boundary of the PIL block component. For virtual (nonatomic) subsystems, the right-click PIL build transformed boundary-crossing Goto blocks into outports and From blocks into inports. TheresultingPILblockhadextraI/Oportsandyouhadtoreworkthemodel to connect it. This behavior has changed to an error if your PIL component includes any Goto / From blocks that cross the boundary of the PIL component.
20
Ability to Generate Switch-Case Statements for Embedded MATLAB Function Blocks and Stateflow Charts
You can choose to generate switch-case statements during code generation when you have
An Embedded MATLAB Function block in a Simulink model
A flow graph or an Embedded MATLAB function in a Stateflow chart
Switch-case statements provide more readable and efficient code than if-elseif-else statements when multiple decision branches are possible.
When you load models created in R2009a and earlier, this optimization is off to maintain backward compatibility. In previous versions, logic appeared unchanged in generated code. For more information, see:
if-elseif-else decision logic in one of the following:
if-elseif-else
Version 5.4 (R2009b) Real-Time Workshop®Embedded Coder™ Software
“Real-Time Workshop Pane: Code Style” in the Real-Time Wo rks ho p
Embedded Coder documentation
“Enhancing Readability of Generated Code for Embedded MATLAB
Function Blocks” in the Simulink documentation
“Enhancing Readability of Generated Code for Flow Graphs” in the
Stateflow documentation
Target Function Library Enhancements
TFLs Now Support Function Replacement for Nonscalar Operators
Target function libraries (TFLs) now support the following nonscalar operators for replacement with custom library functions:
+ (addition)
(subtraction)
* (matrix multiplication) .* (array multiplication) ' (matrix transposition) .' (array trans position)
For more information, see “Mapping Nonscalar Operators to Target-Specific Implementations” in the Real-Time Workshop Embedded Coder documentation and the TFL demos page
rtwdemo_tfl_script.
Ability to Use BLAS Functions for Matrix Multiplication
TFLs now support the ability to map matrix multiplication operations to Basic Linear Algebra Subroutine (BLAS) functions.
For more information, see the BLAS examples in “Mapping Nonscalar Operators to Target-Specific Implementations” in the Real-Time Workshop Embedded Coder documentation and the TFL demos page
rtwdemo_tfl_script.
21
Real-Time Workshop®Embedded Coder™ Release Notes
Support for Data Type Conversion (Cast) Replacement
TFLs now support function replacement for data type conversion (cast) operations.
For m ore information, see “Mapping Data Type Conversion (Cast) Operations to Target-Specific Implementations” in the Real-Time Workshop Embedded Coder documentation.
Support for Fixed-Point Shift Left Replacement
TFLs now support function replacement for fixed-point << (shift left) operations.
For more information, see “Mapping Fixed-Point Shift Left Operations to Target-Specific Implementations” in the Real-Time Workshop Embedded Coder documentation.
Support for Replacing Additional Math Functions
TFLs now support function replacement for the following math functions.
22
acosh fix min saturate
asinh hypot
atan2 ldexp rem
atanh ln round
exactrSqrt max rSqrt
mod
/fmod
sign
Additionally, replacement of the abs function now works with integer argumentsaswellasfloating-pointarguments.
For more information, see “Example: Mapping Math Functions to Target-Specific Implementations” in the Real-Time Workshop Embedded Coder documentation.
Version 5.4 (R2009b) Real-Time Workshop®Embedded Coder™ Software
C++ Encapsulati
on Enhancements
Control Visibility and Access for Data Members In C++ Model Class Using New Configuration Parameters
R2009b adds five model configuration parameters that provide enhanced control over visibility and access for data members in a generated C++ model class. If you select the for your model, the following new parameters appear on the Interface pane of the Simulink Configuration Parameters dialog box:
“Block parameter visibility” “Internal data visibility” “Block parameter access” “Internal data access” “External I/O access”
Compatibility Considerations. The new parameters replace the following obsolete model configuration parameters, which w ere supported in R2008b and R2009a, and which have been removed from the Interface pane:
Private parameter and state members Parameter and state access methods I/O access methods Inline access methods
ert.tlc target and the C++ (Encapsulated) language
To support forward and backward compatibility,
If you open a model created in R2008b or R2009a with R2009b, the obsolete
parameters are automatically converted to the new parameters.
If you open a model in R2009b and use Save As to save the model in
R2008b or R2009a format, the new parameters are converted to the R2008b/R2009a parameters.
Select Dynamic Memory Allocation for Registering Referenced C++ Encapsulation Models Using New Configuration Option
R2009b adds the model configuration option Use operator new for referenced model object registration. This option specifies whether
generated code should use the operator
new, during model object registration,
23
Real-Time Workshop®Embedded Coder™ Release Notes
to instantiate objects for referenced models configured with a C++ encapsulation interface.
If you select the
ert.tlc target and the C++ (Encapsulated) language for
your model, Use operator new for referenced model object registration appears on the Interface pane of the Simulink Configuration Parameters dialog box. If you select this option, the model build process generates code that uses dynamic memory allocation to instantiate objects for referenced models configured with a C++ encapsulation interface. Specifically, during instantiation of an object for the top model in a model reference hierarchy, the generated code uses
new to instantiate o bjects for referenced models.
Selecting this option frees a parent model from having to maintain information about submodels beyond its direct children. Clearing this option means that a parent model maintains information about all of its submodels, including i ts indirect children as well as its direct children.
For more information, see “Use operator new for referenced model object registration” in the Real-Time Workshop Embedded Coder reference documentation.
Function Subsystems and Charts Now Generated as Private Member Functions in C++ Encapsulation Model Class
R2009b enhances the C++ encapsulation code generated for Simulink subsystems and Stateflow charts that are not required or configured to be reusable — that is, subsystems or charts for w hich the Real-Time Workshop system code parameter is set to
Function.
24
In previous releases, the build process generated subsystem or chart functions as global reusable functions outside of the class structure, regardless of whether the Real-Time Workshop system code parameter was set to
Function or Reusable function. If your coding standard required subsystem
or chart functions to be encapsulated in a class interface, the generated code would not meet the requirement. Additionally, if the model required only a single instance of the subsystem or chart, generating a global reusable function added unnecessary memory and processing overhead.
Beginning in R2009b, the build process generates
Function subsystems and
charts as private member functions in the C++ encapsulation model class.
Version 5.4 (R2009b) Real-Time Workshop®Embedded Coder™ Software
Compatibility Considerations. Beginning in R2009b, if C++
(Encapsulated)
is selected as the Language option for your model, and
if your model contains a Simulink subsystem o r Stateflow chart for which the Real-Time Workshop system code parameter is set to
Function,the
build process generates the subsystem or chart function as a private member function in the C++ encapsulation model class, rather than as a global reusable function outside of the class structure. If you want the subsystem or chart function to be generated as a global reusable function outside of the class structure, go to the subsystem or chart parameters dialog box and set the Real-Time Workshop system code parameter to
Reusable function.
Limitations.
This enhancement only applies to
Function subsystems and charts in the
top model, not in referenced models.
If a chart contains a subfunction, the chart is generated as a global reusable
function outside of the class structure rather than as a p rivate member function in the C++ encapsulation model class.
Mismatched System Code Options for Nested Subsystems or Charts Now Error Out During C++ Encapsulation Code Generation
When generating C++ encapsulation code for a model, the build process now flags an error if a Simulink subsystem or Stateflow chart for which the Real-Time W orkshop system code parameter is set to in a subsystem or chart for which the Real-Time Workshop system code parameter is set to
Reusable function.
Compatibility Considerati ons . In previous releases, misma tch ed
Real-Time Workshop system code parameter v alues between a nested subsystem or chart and its containing subsystem or chart did not generate an error, because C++ encapsulation code generation would generate both
Function and Reusable function subsystems or charts as global reusable
functions outside of the model class structure.
Beginning in R2009b, C++ encapsulation code generation generates subsystems and charts as private member functions in the model class, so you
Function is nested
Function
25
Real-Time Workshop®Embedded Coder™ Release Notes
can no longer nest a Function subsystem or chart in a Reusable function subsystem or chart.
To resolve the conflict, dooneofthefollowing:
Set Real-Time Workshop system code to
nested subsystem or chart. The subsystems or charts will generate global reusable functions outside of the class structure.
Set Real-Time Workshop system code to
subsystem or chart. The subsystems or charts will generate private member functions in the model class.
Reusable function for the
Function for the containing
AUTOSAR Enhancements
Multi-Argument Client-Server Communication
Support is now provided for multi-argument AUTOSAR clien t-serv er communication. You can generate AUTOSAR-compliant code, and import and export AUTOSAR description XML files for Application Software Components and Basic Sof tw are. For more information, see “Configuring Client-Server Communication” in the Real-Time Workshop Embedded Coder documentation.
The new demo rtwdemo_autosar_clientserver_script shows how you can generate and export AUTOSAR-compliant code and XML files for a Simulink modelwithanAUTOSARclient-serverinterface.
Merging Inter-Runnable Variables
You can now use the Merge block to merge inter-runnable variables. However, there are constraints on the signal names for the Merge block and the destination of its output. For more information on these constraints, see “Using the Merge Block for Inter-Runnable Variables” in the Real-Time Workshop Embedded Coder documentation.
26
Updating Model Configuration Set
If you saved an AUTOSAR model configuration set as a MAT-file using a previous release of Real-Time Workshop Embedded Coder, then you must run
slupdate on the model to update the referenced configuration set. After
Version 5.4 (R2009b) Real-Time Workshop®Embedded Coder™ Software
this, resave the configuration set (as a MAT-file). For more information, see “Setting Up Configuration Sets”, “Referencing Configuration Sets”, and
slupdate in the Simulink documentation.
Limitations
You cannot use the new Invoke AUTOSAR Server Operation block within a referenced model. If a referenced model has this block, the software produces a warning when you build the top model. You can only use the Invoke AUTOSAR Server Operation block in the top m odel.
Pack Boolean Data Into Bitfields in the Generated Code Using New Configuration Parameter
R2009b introduces a new configuration parameter to pack Boolean data into bitfields in the generated code. Choosing this option reduces global RAM usage. For details, see “Pack Boolean data into bitfields” in the Simulink documentation.
Generate Preprocessor Conditional Directives Using New Configuration Parameter
Previously, there was no built-in solution for implementing variants in the generated code. In R2009b, you can generate preprocessor conditional directives using model reference variants. The new configuration parameter Generate preprocessor conditionals provides the capability to implement variants globally for a model or locally for each referenced model. For details, see “Generate preproces sor conditionals” in the Real-Time Workshop documentation and “Generating Code Variants for Variant Models” in the Real-Time Workshop Embedded Coder documentation.
Specify F unction Argument Names Using New Configuration Parameter
R2009b adds a new Identifier format control parameter, “Subsystem method arguments” on the Real-Time Workshop > Symbols pane of the Configuration Parameters dialog box. This parameter provides finer control over the naming rules for function argument names in reusable subsystems. To be able to use the new parameter, your model must use an ERT-based
27
Real-Time Workshop®Embedded Coder™ Release Notes
system target file (require s a Re al-Time Workshop Embedded Coder license). For a description of the Identifier format control parameters and their use, see “Specifying Identifier Formats” in the Real-Time Workshop Embedded Coder documentation.
Remove or Preser ve extern Keyword In Generated Code Function Declarations Using New Configuration Parameter
Previously, the Real-Time Workshop software automatically included the
extern keyword in function declarations in the generated code. In R2009b, a
new configuration parameter provides you with the flexibility to remove the
extern keyword from function declarations. For details, see “Preserve extern
keyword in function declarations” in the Real-Time Workshop Embedded Coder documentation.
New Function Banner Customization and Code Generation Template Improvements
R2009b introduces a unified approach to customizing and sharing file and function banner templates in the “Code Generation Template (CGT) Files”:
28
Custom function banner generation provides consistency in banner
comments for functions and shared utility functions.
Tagformattomoreeasilycreatefileandfunctionbanners.
Predefined tokens include specific information about each function in the
function banner.
Predefined styles pro vide a consistent format for the boundary of file and
function banners throughout your code.
HTML Code Generation Report Provides Hyperlink to Requirements Document
Previously, to trace requirements descriptions in the generated code to the requirements document for that block, you had to perform multiple steps. In R2009b, the code generation report provides hyperlinks directly to the corresponding requirem ents document. To include requirements descriptions in the generated code, you need a Simulink Verification and Validation™
Version 5.4 (R2009b) Real-Time Workshop®Embedded Coder™ Software
software license. For details, see “Including Requirements Information with Generated Code” in the Simulink Verification and Validation documentation.
Code Traceability Improvement
Previously, hyperlinks in the HTML code generation report might not work if a model contains international characters and is open on a machine with different character encoding. In R2009b, traceability in the code g eneratio n report is enhanced to remove this limitation.
Tunable Iteration Limit for the For Iterator block
Previously, the Iteration limit parameter of the For Iterator block appeared only as a number in the generated code. The Iteration limit parameter now supports storage classes. The named constant representing the iteration limit appears in the generated code when you define it as a object in the base workspace. This capability im proves the readability and reusability of the generated code. For details, see the Iteration limit parameter description in the For Iterator block.
Simulink.Parameter
Generated Code Enhancements
In R2009b, code generation is enhanced to:
Eliminate unnecessary data copies for the Bus Creator block in referenced
models. Th i s optimization reduces RAM usage and improves execution speedofthegeneratedcode.
Eliminate unnecessary data copies from a subsystem output port to the
root Outport block for the following subsystems:
- Nonreusable
- Function call
- Conditional
- Triggered
This optimization reduces RAM usage and improves execution speed of the generated code.
29
Real-Time Workshop®Embedded Coder™ Release Notes
Combine similar loops which contain structure member read-only
references. This optimization improves execution speed and likely reduces RAM and ROM usage of the generated code.
Copy data between two structure data types using the assignment operator.
Previously, the gene rated code copied data between two structure data types member by member. This optimization generates less code and improves execution speed for block I/O.
Reduce global data copies by using local variables for the Vector
Concatenate and Matrix Concatenate block outputs whenever possible. This optimization reduces RAM usage and improves execution speed of the generated code.
Remove unreachable code from nested if statements containing the
same test condition. This optimization generates less code and improves execution speed of the generated code.
Eliminate
side-effect free and all branches are identical. This optimization improves code readability, reduces code size, and reduces execution time.
If or Switch statem ents when the condition expression is
Removed Limitations for Reusable Subsystem Optimization
Previously, the Pass reusable subsystem outputs as parameter on the Optimization pane of the Configuration Parameters dialog box had several limitations for the Individual arguments option. In R2009b, all limitations have been addressed, except for signals with variable dimensions.
Generated rtwtypes.h Header File Now Omits Unnecessary Type Definitions
Real-Time Workshop Embedded Coder generated production code for the header file definitions. The build process now conditionally generates type definitions and defines bas ed on built-in integer d ata types, which are needed only when you select MAT-file logging or the C AP I data exchange interface for your model.
rtwtypes.h is now optimized to remove unnecessary type
30
Version 5.4 (R2009b) Real-Time Workshop®Embedded Coder™ Software
Duplicate Block
Comments No Longer Appear in the
Generated Code
Previously, i f a comments might the Real-Time duplicate blo Code” for more generated cod
Block Commen Configurab
Previously code by manu R2009b, th into the ge Generated continue generate TLC files generat
s to emit manually inserted comments instead of the automatically d comme nts . Consider removing existing block comments from your
ed co de and code-to-model traceability might not work.
Name Imp in Gene
usly, if you add a Model block to your model, the Real-Time Workshop
Previo
re changes the name of the instance of a block parameter structure in
softwa
neratedcodetoagenericname,forexample,
the ge
ock parameter structure follows the global variable naming rule. See
the bl
tifier Format Control Parameter Values” in the Real-Time Workshop
“Iden
dded Coder documentation for more information.
Embe
block includes a description or a requirement, duplicate block
appear in the generated code for certain blocks. In R2009b,
Workshop Embedded Coder software no longer generates
ck comments. See “Adding Custom Comments to Generated
information on how to include block comments into the
e.
ts for Custom Blocks are Now
le
, block comments for custom b locks were inserted in the generated
ally inserting com ments into the associated TLC files. In
e code generation process automatically inserts block comments
nerated code for custom blocks. See “Adding Custom Comments to
Code” for more information. Note that the code generation process
. Manually inserted comments might be poorly formatted in the
rovement for Block Parameter Structure
rated Code
rtP. In R2009b, naming of
Gene Con
R20 thi
Re
rate Code for Variable-Size Signals Using New
figuration Parameter
09b supports code generation for variable-size signals. You can turn on/off
s capability from a new parameter support variable-size signals on the
al-Time Workshop > Interface pane of the Configuration Parameters
31
Real-Time Workshop®Embedded Coder™ Release Notes
dialog box. This parameter only a pp ea rs if you select the ert.tlc system target file.
New and Enhanced Demos
The following demos have been added in R2009b:
Demo...
rtwdemo_auto
sar_clientserver_script
Shows How You Can...
Configure and and export AUT Simulink m od interface.
rtwdemo_pr
eprocessor_script
Configure m conditiona embedded ex
rtwdemo_s
il_pil
Carry out s processo
The following demos have been enhanced in R2009b:
Demo... Now...
rtwdemo_comments
Includes a code generation template file to illustrate how to customize file banner, function banner, and file trailer comments in the generated code.
rtwdemo_international (see “Character
Set Limitation” in the Real-Time Workshop documentation)
rtwdemo_tfl_script
Includes a code generation template file to illustrate how to customize file banner, function banner, and file trailer comments in the generated code.
Includes models that illustrate ho w to use targe t function libraries (TFLs) to replace nonscalar operators and utilize Basic Linear Algebra Subroutine (BLAS) library functions in generated code
generate AUTOSAR -compliant code
OSAR-compliant XML files for a
el with an AUTOSAR client-server
odel variants and generate preprocessor
ls to control which code is linked to the
ecutable.
oftware-in-the-loop (SIL) or
r-in-the-loop (PIL) code verification.
32
Version 5.3 (R2009a) Real-Time Workshop®Embedded Coder™ Software
Version 5.3 (R2009a) Real-Time Workshop Embedded Coder Software
New Features and Changes
Yes Details below
This table summ
Version Compatibility Considerations
Yes—Details as Compatibi
Considerat
below. See a Summary
New features and changes introduced in this version are
“Ability to Specify Code Generation Objectives” on page 34
“Ability to Specify Custom Storage Classes as Signal Properties” on page 35
“PIL Enhancements” on page 35
“C++ Encapsulation Interface SupportforReferencedModels”onpage36
“Type Cast Applied to Mismatched const Type Qualifiers When Using
Reference Models with Function Prototype Control or C++ Encapsulation Interfaces” on page 37
“Target Function Libraries Allow Remapping of Operator Outputs to
Implementation Function Inputs” on page 38
arizes what’s new in Version 5.3 (R2009a):
labeled
lity
ions,
lso
Fixed Bugs an d Known Problems
Bug Reports Includes fixes
Related Documentation at Web Site
No
“Target Function Library Parameter AcceptExprInput Controls Code
Representation of Expression Inputs in Replacement Results” on page 38
“AUTOSAR Enhancements” on page 39
“Enhanced emlc Support for Embedded Real-Time (ERT) Targets” on page
39
“Optimized ERT-Based Targets Deprecated” on page 40
“Right-Click Builds No Longer Generate Unused Functions in Production
Code” on page 40
33
Real-Time Workshop®Embedded Coder™ Release Notes
“Pass Reusable Subsystem Outputs as Individual Arguments in Generated
Code Using New Configuration Parameter” on page 41
“SimplifyArrayIndexinginGeneratedCodeUsingNewConfiguration
Parameter” on page 41
“Generated Code Enhancements” on page 41
“Code Generation Report Improvement” on page 42
“Code Traceability Improvement” on page 42
“New and Enhanced Demos” on page 43
Ability to Specify Code Generation Objectives
Previously, setting up your model for code generation was difficult due to the com plexity of options and settings available. In R2009a, you can specify high-level code generation objectives and run Model A dv is or checks to identify changes to model constructs and settings that improve the generated code.
The high-level code generation objectives ava il able in R2009a are:
34
Efficiency (ERT-based targets)
Safety precaution (ERT-based targets)
Traceability (ERT-based targets)
Debugging (GRT- or ERT-based targets)
After specifying your code generation objectives, you can run Model Advisor checks before generating code to identify suggested changes to your model and make the changes using the Model Advisor interface. The generated code includes comments identifying which high-level objectives you specified, and theresultsoftheModelAdvisorrunatthetimeofcodegeneration.
The new generation objectives.
For details, see “Mapping Application Objectives to Model Configuration Parameters” in the Re al-T ime Workshop Embedded Coder User’s Guide.For limitations that apply, see Limitations on Code Generatio n Objectives.
rtwdemo_usingrtwec demo shows you how you can specify code
Version 5.3 (R2009a) Real-Time Workshop®Embedded Coder™ Software
Ability to Specify Custom Storage Classes as Signal Properties
In previous releases, applying a custom storage class to a signal required creating a custom storage class and its custom attributes in the object, and resolving thesignaltotheobjectinsomeway.
A signal object that specifies a custom storage class can be applied to at most one signal. This restriction can cause a proliferation of base workspace signal objects that apply the same custom storage class to multiple signals. In addition, base workspace signal objects cannot be saved with a model; they must be saved in a separate file and loade d whenever the model is loaded.
To overcome these disadvantages, R2009a allows you to apply a custom storage class to a signal by specifying the storage class in the Signal Properties dialog box that defines the signal. This technique creates an embedded signal object that is associated with the port where the signal originates and does not appear in any workspace. See “Applying CSCs to Parameters and Signals” for details.
Simulink.Signal object in the base workspace, specifying the
PIL Enhancements
Processor-in-the-loop (PIL) Model block simulation mode now supports tunable parameters and serial communication between h os t and target.
Tunable Parameters
For information see “Tunable Parameters and SIL/PIL” in the Real-Time Workshop Embedded Coder documentation.
The demo parameters during a PIL simulation.
Serial Communication
For information see “Communications rtiostream API” in the Real-Time Workshop Embedded Coder documentation.
The demo serial communication.
rtwdemo_pil has been enhanced to demonstrate the u se of tunable
rtwdemo_rtiostream has been enhanced to include configuring for
35
Real-Time Workshop®Embedded Coder™ Release Notes
PIL Block Behavior with Goto/From Blocks
Currently, it is possible but not recommended to use Goto/From blocks for I/O data that crosses the boundary of the PIL block component. For virtual (nonatomic) subsystems, the right-click PIL build transforms boundary-crossing Goto blocks into outports and From blocks into inports. The resulting PIL block has extra I/O ports and you must rework the model to connect it.
Starting in the next release this behavior will change and you will see an error if your PIL component includes any G oto/From blocks that cross the boundary of the PIL component.
For more information on PIL support, see “SIL and PIL Simulation Support and L imitations” in the Real-Time Workshop Embedded Coder documentation.
C++ Encapsulation Interface Support for Referenced Models
R2008b introduced the ability to generate a C++ class interface to model code, in which required model data is encapsulated into C++ class attributes and model entry point functions are encapsulated into C++ class methods. However, in a model reference hierarchy, you could generate a C++ encapsulation interface only for the top model. If you built a model containing a Model block whose referenced model had the Language setting, the build reported an error.
C++ (Encapsulated) selected as
36
Beginning in R2009a, you can use C++ encapsulation interfaces throughout a model reference hierarchy. You can now:
Select
models in a model reference hierarchy, and configure custom C++ encapsulation interfaces for those models.
Mix C++ encapsulation and C code interface styles within a model reference
hierarchy. (The demo model model that uses the C code interface style, co mpiled with a C++ compiler, while the other models in the same hierarchy use C++ encapsulation interfaces.)
C++ (Encapsulated) as the Language setting for referenced
rtwdemo_cppencap includes a referenced
Version 5.3 (R2009a) Real-Time Workshop®Embedded Coder™ Software
The demo model rtwdemo_cppencap has been enhanced to include a model reference h ierarchy that illustrates the use of C++ encapsulation interfaces at multiple levels of the hierarchy.
In addition to the limitations that apply to any model build involving C++ encapsulation (“C++ Encapsulation Interface Control Limitations”), the following limitations apply to building a referenced model that is configured to generate a C++ encapsulation interface:
The
In cases for which a referenced model cannot have a combined
void-void step method style of C++ encapsulation interface is not
supported for referenced models. You must use the
method
output/update function, you cannot use a C++ encapsulation interface. Those cases include:
style.
I/O arguments step
- The model has multiple sample times.
- The model has a continuous sample time.
- T he model is saving states.
For more information about using C++ encapsulation, see “Controlling Generation of Encapsulated C++ Model Interfaces” in the Real-Time Workshop Embedded Coder documentation.
Type Cast Applied to Mismatched const Type Qualifiers When Using Reference Models with Function Prototype Control or C++ Encapsulation Interfaces
When you control C function prototypes or C++ encapsulation interfaces in models that use model referencing, if the input argument of the referenced model’s step function interface is set to
none,andtheconst qualifier for the source signal in the referenced model’s
parent is set to a value other than the referenced model’s interface specification by generating a type cast that discards the behavior, add an appropriate
const type qualifier from the source signal. To override this
none, Real-Time Workshop software honors
const typ e qualifier to the referenced model.
const type qualifier for the root
37
Real-Time Workshop®Embedded Coder™ Release Notes
Target Function Libraries Allow Remapping of Operator Outputs to Implementation Function Inputs
Target function libraries (TFLs) n ow allow remapping of operator outputs to implementation function inputs. This capability can help satisfy an established coding pattern or convention in an applicat io n environmen t, perhaps a code environment to which generated code is being relocated.
For example, for a sum operation, the build process might generate code similar to the following:
rtY.Out1 = u8_add_u
R2009a allows you to remap the output to any pos function argument list. For example, remappi generates code similar to the following:
uint8_T rtb_Add8;
u8_add_u8_u8(&rtb_Add8, rtU.In1, rtU.In2); rtY.Out1 = rtb_Add8;
For more information, see “Remapping Operator Outputs to Implementation Function Input Positions” in the Real-Time Workshop Embedded Coder documentation.
8_u8(rtU.In1, rtU.In2);
ition in the implementation
ng the output to the first input
Target Function Library Parameter AcceptExprInput Controls Code Representation of Expression Inputs in Replacement Results
The target function library (TFL) functions
setTflCFunctionEntryParameters an d setTflCOperationEntryParameters
have added an AcceptExprInput parameter for controlling the code representation of expression inputs in function or operator replacements. The
AcceptExprInput parameter allows you to control whether an expression
input to your TFL implementation function is integrated directly into the generated function call or assigned to a temporary variable. If the value of
AcceptExprInput is true, expression inputs are integrated into the
generated code in a form similar to the following:
38
rtY.Out1 = u8_add_u8_u8(u8_add_u8_u8(rtU.In1, rtU.In2), rtU.In3);
Version 5.3 (R2009a) Real-Time Workshop®Embedded Coder™ Software
Beginning in R2009a, you can override that behavior by setting
AcceptExprInput to false, which generates a temporary variable for the
expression input, as follows:
uint8_T tempVar;
tempVar = u8_add_u8_u8(rtU.In1, rtU.In2); rtY.Out1 = u8_add_u8_u8(tempVar, rtU.In3);
AUTOSAR Enhancements
Support is provided for AUTOSAR schema version 3.0, which is now the default.
For inform ation, see “Ge nerating Code for AUTOSAR Software Components” in the Real-Time Workshop Embedded Coder User’s Guide documentation.
Enhanced emlc Support for Embedded Real-Time (ERT) Targets
emlc now supports:
Integer-only code generation
Option to turn off nonfinite support
You can now turn off nonfinite support if you do not need it. Turning off nonfinite support results in leaner generated code.
Custom naming of identifiers
You can now specify the identifier format for:
- G l ob al variables
- Global types
- Local functions
- L ocal temporary variables
- C onstant macros
For more information, see “Real-Time Workshop Dialog Box for Embedded MATLAB Coder” in the Real-Time Workshop reference.
39
Real-Time Workshop®Embedded Coder™ Release Notes
Optimized ERT-B
Starting in R200
ert.tlc Real­for optimized f
ert.tlc Real
for optimized
9a, two optimized ERT-based targets are no longer available:
ased Targets Deprecated
Time Workshop Embedded Coder (auto configures ixed-point code)
-Time Workshop Embedded Coder (auto configures floating-point code)
Compatibility Considerations
If you select the target r generation or floating Generatio
Right-Cl Function
Prior to R Embedde
The subs
the sub Enable parame
ed either of these targets for your model in previous releases,
emains available for that model. For new models, use the code
objectives parameters to configure your model for fixed-point
-point code. For more information, see “Ability to Specify Code
n Objectives” on page 34.
ick Builds No Longer Generate Unused
sinProductionCode
2009a, if all of the following conditions existed, Real-Time Workshop
d Coder generated unused functions in production code:
ystem includes a block that has an enable or disable method, or
system itself has an enable or disable method. An example is an
d Subsystem block with the Enable block States when enabling
ter set to
reset.
40
You ri
In a gen S-f
ecuted subsystem that has an enable or disable method.
ex
ght-clicked the subsystem block and did one of the following:
- Selec
- Sele
erated
unction wrapper only if the generated S-function resides in a conditionally
ted the Tools > Real-Time Workshop > Build Subsystem
nu option, and the root model is configured for an ERT target.
subme
cted the Tools > Real-Time Workshop > Generate S-function
enu option and the Use Embedded Coder option on the Generate
subm
nction for Subsystem dialog box.
S-fu
production code environment, the enable and disable methods in your
model.c file are dead code. The methods are called by the ERT
Version 5.3 (R2009a) Real-Time Workshop®Embedded Coder™ Software
Starting with R2009a, the code generator no longer generates the enable and disable methods in
model.c, eliminating the dead code.
Compatibility Considerations
If you place an S-function generated under the preceding conditions in a conditionally executed subsystem that requires the enable or disable method, the S-function block reports a runtime error message similar to the following:
The model is attempting to invoke the enable method of the S-function block generated for the model does not include an enable method.
block-name for model-name, yet the code
Pass Reusable Subsystem Outputs as Individual Arguments in Generated Code Using New Configuration Parameter
R2009a introduces a new configuration parameter to pass reusable subsystem outputs as individual arguments to reduce global RAM usage and data copy operations. See “Pass reusable subsystem outputs as” in the Simulink documentation for more information.
Simplify Array Indexing in Generated Code Using New Configuration Parameter
R2009a introduces a new configuration parameter to remove costly multiply operations when accessing arrays in a loop in the generated code. See “Simplify array indexing” in the Simulink documentation for more information.
Generated Code Enhancements
In R2009a, code generation is enhanced to:
Suppress overflow protection code if the build process determines that the
range for block operations is sufficiently restricted. This enhancement improves memory usage and execution speed.
Identify inputs and outputs of function-call subsystems as well as Simulink
functions in Stateflow charts that do not need to use global memory. This capability reduces global memory usage and increases execution speed.
41
Real-Time Workshop®Embedded Coder™ Release Notes
Merge blocks with initialization value have been updated in R 2009a to use this e nhancement.
Reduce global data copies in the generated code when the output port of a
reusable subsystem connects to a Vector Concatenate block.
Eliminate unnecessary data copies in the generated code for a SinCos b lock
withoutputstoglobalstorage. Thiscapabilityimprovesexecutionspeed and reduces R AM usage.
Identify similar loops and combine them into a single loop iteration,
thereby improving the execution speed of the generated code and reducing RAM usage.
Eliminate unnecessary data copies at the output ports for the Selector
and Assignment blocks. This capability generates less code and reduces RAM usage.
The code efficiency improvement is not applied if:
- T he Selector block connects to more than one block.
- The input signal of the Assignment block connects to at least one other
block.
42
Code Generation Repor t Improvement
In R2009a, you can more easily read and use the code generation report:
In the Generated Source files list in the left pane, the source file name is
highlighted to indicate the file displayed in the right pane.
The destination of the hyperlink in the right pane when navigating
hyperlinks to functions, variables, and data types in the generated source files is highlighted.
For more information, see “Generating Reports for Code Reviews and Traceability Analysis”.
Code Traceability Improvement
In previous releases, if the model was built in a different directory from where the model was stored, the hyperlinks in the co de generation report did not navigate to the model after the model was closed. In R2009a, the
Version 5.3 (R2009a) Real-Time Workshop®Embedded Coder™ Software
code generation report records the location of the model at the time of code generation. If a model is closed, clicking a hyperlink opens the model and highlights a block. For more information, see “Tracing Code to Model Objects Using Hyperlinks”.
New and Enhanced Demos
Beginning with R2009a, the Real-Time Workshop Demos in the Help contents uses a new format to display Real-Time Workshop and Real-Time Workshop Embedded Coder demos. The differences include:
Indentation now is used to designate a functionally-related group of demos.
Indentation no longer identifies demos for which the Real-Time Workshop Embedded Coder software is required.
If a demo requires Real-Time Workshop Embe dded Coder software, the
demo naming or text identifies the requirement.
The following demo has been added in R2009a:
Demo...
rtwdemo_
usingrtwec
Shows How You Can...
Generate producti aReal-T a model, code gen the res
The following demos have been enhanced in R2009a:
Demo... Now...
rtwdemo_cppencap
Extends C++ encapsulation to a model reference hierarchy.
rtwdemo_cscpredef
rtwdemo_pil
Illustrates the use of embedded signal objects.
Shows how to use tunable parameters during a processor-in-the-loop simulation.
rtwdemo_rtiostream
Includes configuring for serial communication.
C code for embedded systems requiring
on code efficiency and quality. You select
ime W orkshop Embedded Coder target for
quickly configure options based on your
eration objectives, generate code, and view
ulting files.
43
Real-Time Workshop®Embedded Coder™ Release Notes
Version 5.2 (R2008b) Real-Time Workshop Embedded Coder Software
New Features and Changes
Yes Details below
This table summ
Version Compatibility Considerations
Yes—Details as Compatibi
Considerat
below. See a Summary
New features and changes introduced in this version are
“New Option to Generate Encapsulated C++ Class Interfaces for Model
Data and Functions” on page 45
“New CPPClassGenCompliant Target Configuration Parameter” on pag e 46
“New Processor-in-the-Loop (PIL) Model Blo ck Simulation Mode and API”
on page 46
“AUTOSAR Enhancements” on page 47
“Flexible Configuration Options for Referenced Models in TLC-Based
Custom Targets” on page 48
arizes what is new in Version 5.2 (R2008b):
labeled
lity
ions,
lso
Fixed Bugs an d Known Problems
Bug Reports Includes fixes
Related Documentation at Web Site
No
44
“Generated Code Enhancements” on page 49
“Target Function Library Enhancements” on page 49
“Enhanced emlc Support for Target Function Libraries” on page 50
“New Code Interface Report Details Generated Code Architecture” on
page 51
“Scheduling Code Now Separated from Model Application C ode” on page 51
“Model Initialization Function Prototype Control” on page 53
“Support for Model-Level Control of Test Points” on page 54
Version 5.2 (R2008b) Real-Time Workshop®Embedded Coder™ Software
“Custom Storage Class Enumerated Type Name Misspelling Fixed” on
page 54
“CustomStorageClassFileTypeChangedinR2008a”onpage54
“Minimize Local Variables in Code Generation Using New Configuration
Parameter” on page 55
“Simulink Configuration Parameters” on page 55
“New and Enhanced Demos” on page 55
New Option to G enerate Encapsulated C++ Class Interfaces for Model Data and Functions
The Real-Time Workshop language option C++, introduced in R14SP2, generates a C++ compatible interface to code generated from Simulink models. How eve r, code generated using the that model data and functions are not encapsulated into C++ class attributes and methods.
C++ option has the limitation
With the addition of the language option the Real-Time Workshop Embedded Coder software can generate a C++ class interface to model code, in which all required model data is encapsulated into C++ class attributes and all model entry point functions are encapsulated into C++ class methods . The benefits of encapsulation include
Greater control over access to model data
Ability to m ultiply instantiate model classes
Easier integration of Re al-Time Workshop Embedded Coder generated
model code into C++ programming environments
C++ encapsulation also can be applied to right-click builds of nonvirtual subsystems.
For more information, see “Controlling Generation of Encapsulated C++ Model Interfaces” in the Real-Time Workshop Embedded Coder documentation.
For a demonstration of the C++ encapsulation capability, see the demo model
rtwdemo_cppencap.
C++ (Encapsulated) in R2008b,
45
Real-Time Workshop®Embedded Coder™ Release Notes
New CPPClassGenCompliant Target Configuration Parameter
In conjunction with the C++ encapsulation feature described in the previous section, this release introduces the configuration parameter. This parameter is set in the function for an ERT-based target to indicate whether the target supports the ability to generate and configure C++ encapsulation interfaces to model code. T he default is (
ert.tlc)targets.
off for custom and non-ERT targets and on for ERT
CPPClassGenCompliant target
SelectCallback
To make an ERT-based target compliant, use the to set
CPPClassGenCompliant to on. This enables the feature infrastructure
and user interface.
Whenthelanguageoption always generates an example main program, how the generated code can be deployed. The generated example main file has been updated to declare model data and call the C++ encapsulation interface configured model step method appropriately.
C++ (Encapsulated) is selected, code generation
SelectCallback function
ert_main.cpp, demonstrating
New Processor-in-the-Loop (PIL) Model Block Simulation Mode and API
Real-TimeWorkshopEmbeddedCodernow provides Processor-in-the-Loop (PIL) Model block simulation mode and API for verification of embedded code on your target processor.
Model block PIL mode
Allows easy switching between Normal, Accelerator and PIL simulation modes.
You can test object code with no need to modify the original model.
You can reuse test suites, resulting in faster iteration between model development and generated code verification.
46
PIL Connectivity API
Allows you to access the power of PIL verification for your target processor.
You can integrate third party or custom tools for:
Version 5.2 (R2008b) Real-Time Workshop®Embedded Coder™ Software
- Building the PIL application
- Downloading and running the application
- Communicating with the application
For more information see “Verifying Compiled Object Code with Processor-in-the-Loop Simulation” in the Real-Time Workshop Embedded Coder documentation.
See the following new demos for step-by-step examples:
rtwdemo_pil
This model shows you how to compare results from Normal mode simulation and PIL mode execution for the same referenced model. You simply run the simulation to compare the simulation behavior with the behavior of the co rresponding generated code. This uses the default host-based PIL configuration, so the gene rate d code is c ompiled for and executed on your host workstation.
rtwdemo_custom_pil
This demo shows you how to create a custom PIL configuration using the target connectivity APIs. You can examine the code that configures the PIL build process, a tool to use for downloading and execution, and a communication channel between host and target. Follow the steps to activate a full host-based PIL configuration.
rtwdemo_rtiostream
This demo shows you how to implement a communication channel to enable exchange of data between different processes. This is required for PIL, which requires exchange of data between the Simulink software (running on your host machine) and deployed code (executing on target hardware). A default TCP/IP implementation is provided.
AUTOSAR Enhancements
AUTOSAR support has been enhanced to include the following functionality:
Multiple Runnable Entities
47
Real-Time Workshop®Embedded Coder™ Release Notes
You can model multiple AUTOSAR runnable entities as function-call subsystems.
Calibration Parameters
You can import your calibration parameters into the Workspace and assign them to block parameters in your model.
Access to Basic Software
You can designate inports and outports as access points to AUTOSAR services and device drivers (basic software).
Error Status
You can designate inports to receive error status.
Enumerations
You can map MATLAB enumerated types to and from AUTOSAR enumerated types.
Absolute Time
48
You can now use blocks that depend on time, such as the Discrete-Time Integrator block, which you may need to use in a multiple runnable software component.
For inform ation, see “Ge nerating Code for AUTOSAR Software Components” in the Real-Time Workshop Embedded Coder User’s Guide documentation.
New functions also provide command-line access to all new AUTOSAR options. For more information, see “Configuring AUTOSAR Options Programmatically” in the Real-Time Workshop Embedded Coder User’s Guide documentation.
Also, a new AUTOSAR demo is provided,
rtwdemo_autosar_multirunnables_script,andtheexistingtwodemos
are updated.
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
Version 5.2 (R2008b) Real-Time Workshop®Embedded Coder™ Software
the parent model. By default, the valuesmustbethesameinbothmodels. See “Controlling Configuration Option Value Agreement” in the Real-Time Workshop documentation for information about overriding this default.
Generated Code Enhancements
In R2008b, code generation is enhanced to:
Eliminate data copies for transposing matrices in code. Expression folding
reduces the computation into the Transpose block, which improves stack consumption and memory access, and improving execution speed.
Compute constants for evenly spaced constant data, (for example, 1, 2, 3,
...), rather than defining them in ROM consumption and memory access, avoiding compiler stress due to large data sets.
Optimize inlining of code generated from Simulink blocks, Stateflow charts,
and Embedded MATLAB code.
Remove unnecessary saturation logic code, reducing RAM and ROM,
improving code efficiency.
model_data.c. This capability reduces
Provide bidirectional traceability for control ports, such as Trigger and
Enable blocks.
Provide local and reusable input buffers for Model blocks. This capability
reduces global data usage and data copying when interfacing with code from a referenced model, which can increase the efficiency of generated code.
Target Function Library Enhancements
Functions pow, power, and memcpy Now Supported for Function Replacement
This release adds pow, power,andmemcpy to the list of functions that you can replace with custom or target-specific implementations using target function libraries (TFLs). This allows you to replace default implementations of
power,ormemcpy that may be insufficient for your application or your target
environment.
pow,
49
Real-Time Workshop®Embedded Coder™ Release Notes
For a demonstration of pow, power,andmemcpy function replacements, see the demo model “Replacing Math Functions and Operators Using Target Function Libraries” in the Real-Time Workshop Embedded Coder documentation.
rtwdemo_tflmath. For detailed information about TFLs, see
Improved Fixed-Point M ultiplication and Division Operator Replacement
In prev io us releases, TFL support for fixed-point multiplication and division operator replacement did not provide a generalized net slope matching capability. This limited the ability to generate the same TFL replacement function for a range of different input slopes in the model. This release adds a new Net Slope TFL entry, which allows you to match fixed-point slope information between a multiplication or division operator and the TFL entry in a more general and intuitive way.
Enhanced emlc Support for Target Function Libraries
50
Support for Embedded Real-Time (ERT) Target Function Libraries
You can now configure emlc to use ERT target function libraries (TFLs) when generating C code. You enable this feature by defining a configuration object for C code generation using a new prompt, as in this example:
rtwcfg = emlcoder.RTWConfig('ert')
When y ou open the properties dialog box for the configuration object, the ERT TFLs will appear in the drop-down list for the Target function library field.
This feature requires a Real-Time Workshop E mbe dded Coder lice ns e.
ert parameter at the MATLAB command
New API for Customizing Target Function Libraries
This release introduces an API for registering custom embedded real-time (ERT) target function libraries (TFLs) for use with or more custom TFLs in a file called the MATLAB path. This feature requires a Real-Time W orkshop Embedded Coder license.
rtwTargetInfo.m that emlc reads on
emlc. You register one
Version 5.2 (R2008b) Real-Time Workshop®Embedded Coder™ Software
New Code Interface Report Details Generated Code Architecture
AnewCode Interface Report section has been added to the standard Real-Time Workshop Embedded Coder HTML code generation report. The Code Interface Report section provides documentation of the generated code interface, including model entry point functions and interface data, for consumers of the generated code. The information in the report can help facilitate code review and code integration.
The Code Interface Report section is automatically included in every Real-Time Workshop Embedded Coder HTML code generation report, so to generate it, you need only select the model option Create code generation report. To view the code interface report for a model, build the model, go to the Contents pane of the code generation report, and click the Code Interface Report link.
For more information, see “U sing the Code Interface Report to Analyze the Generated Code Interface” in the Real-Time Workshop Embedded Coder documentation.
Scheduling Code Now Separated from Model Application Code
In previous releases, algorithmic code and rate-monotonic scheduling code were interleaved in multirate model code generated by Real-Time Workshop Embedded Coder software. This could make it difficult to deploy multirate algorithmic code independently of the Real-Time Workshop Embedded C oder scheduling code.
In R2008b, scheduling code has been moved from the generated file to the example main program, creating a clean separation of algorithmic code and scheduling code. This has the following benefits:
Simplifies deployment and integration of multirate algorithmic code
Improves efficiency of multirate algorithmic code (less code runs at the
base rate)
Improves memory usage (may reduce or eliminate
rtModel data)
model.c
51
Real-Time Workshop®Embedded Coder™ Release Notes
Code generation assumes the same run-time environment, with a rate-monotonic scheduler in use, as in previous releases.
Note This change is for Real-Time Workshop Embedded Coder code generation only; Real-Time Workshop code generation and Simulink simulation are unaffected. Handling of rate transitions during simulation is unchanged.
Compatibility Considerations
In R2008b, Real-Time Workshop Embedded Coder no longer generates rate-monotonic scheduling code that is interleaved with multirate algorithmic code in resides exclusively in
Multirate code generated using R2008b will be compatible with previously existing models, except when both of the following conditions are true:
model.c. Code for controlling the execution of subrate tasks now
ert_main.
52
You are using a static main program based on the R2008a version of
ert_main.c or .cpp.
You are using a system target file based on the R2008a version of
ert.tlc,
and in that file, you have retained the following assignment, which specifies that the
SetEvents function is inlined in the static main program:
%assign InlineSetEventsForThisBaseRateFcn = TLC_TRUE
If both of the listed conditions apply, and if you want to continue to work with your existing static main program and system target file, you m ust add an
if statementtoyourstaticmainprogram. Inthesectionofyourstaticmain
that updates event flags and checks for subrate overrun conditions, add the two lines show n in bold below:
for (i = FIRST_TID+1; i < NUMST; i++) {
if (rtmStepTask(RT_MDL,i) && eventFlags[i]++) {
OverrunFlags[0]--;
OverrunFlags[i]++;
/* Sampling too fast */
rtmSetErrorStatus(RT_MDL, "Overrun");
Version 5.2 (R2008b) Real-Time Workshop®Embedded Coder™ Software
return;
}
if (++rtmTaskCounter(RT_MDL,i) == rtmCounte rLimit(RT_MDL,i))
rtmTaskCounter(RT_MDL, i) = 0;
}
Model Initialization Function Prototype Control
Previously, nonreentrant code supported control of the model step function prototype. In R2008b, function prototype control includes control for initialization functions, simplifying code integration and testing, and reducing global RAM usage.
As part of this enhancement, the Model Interface dialog box has the following changes:
Previous Model Interface Dialog
New Model Interface Dialog Box
Box
Function Specification parameter options:
Default model-step function
Model Specific C prototype
Function Specification parameter options:
Default model initialize and step functions
Model Specific C prototypes
Preview subpane
Configure function arguments
subpane
Step fun ction preview subpane
Configure model initialize and step functions subpane
N/A Initialize function name
parameter
Function name parameter
Function argument table
Step function name parameter
Step function arguments table
See “Controlling Generation of Function Prototypes” in the Real-Time Workshop Embedded Coder documentation for more information.
53
Real-Time Workshop®Embedded Coder™ Release Notes
Compatibility Considerations
Previously, if your model included a Stateflow chart that has the chart property Execute (enter) Chart At Initialization selected and the chart was connected to model inports or outports, during the build process a Stateflow diagnostic referenced this construct, but code was always generated.
In R2008b, if this construct is in your model and you are controlling the model function prototypes, the build process results in an error and code is not generated. To avoid this error, you can:
1 Place a Sign al Conversion block between the root inport or outport and
the Stateflow chart.
2 Select the Override optimizations and always copy signal parameter
of the Signal Conversion block.
Support for Model-Level Control of Test Points
Previously, disabling test points set during debugging required you to disable each test point individually. Not disabling test points can lead to suboptimal generated code. In R2008b, the Real-Time Workshop software providesasingleoptiontoignorealltestpointsduringcodegeneration, facilitating transition from prototyping to deployment and avoiding accidental degradation of generated code due to workflow artifacts. See “Ignore test point signals” in the Real-Time Workshop documentation.
54
Custom Storage C lass Enumerated Type Name Misspelling Fixed
The enumerated type name BuiltinCSCAttributes_IncludeDelimeter has been renamed
BuiltinCSCAttributes_IncludeDelimiter.
Custom Storage Class File Type Changed in R2008a
Up until R2007b, The MathWorks released built-in custom storage class definitions only in The MathWorks rele as ed built-in custom storage class definitions in both
.m files and .p files, creating a possible incompatibility. No R2008a release
note appeared that described this change, but a note now appears in its correct location. See the R2008a release note “Custom Storage Class File
.m files. In R2008a and R2008b (the current release)
Version 5.2 (R2008b) Real-Time Workshop®Embedded Coder™ Software
Type Changed” on page 62 for information about the change a nd the possible “Compatibility Considerations”onpage63thatitintroduced.
Minimize Local Variables in Code Generation Using New Configuration Parameter
R2008b introduces a new configuration parameter to eliminate copies between local and global variables, reducing stack size and data copy operations. See “Minimize data copies between local and global variables” in the Simulink documentation for more information.
Simulink Configuration Parameters
In R2008b, the following Simulink Configuration Parameters dialog box button label is updated:
Location Previous Pa rameter
Real-Time Workshop > Interface
New and Enhanced Demos
Thefollowingdemoshavebeenadded:
Demo...
rtwdemo_autosar_multirunnables_script
rtwdemo_cppencap
rtwdemo_custom_pil
New Parameter
Label
Configure Step Function
Shows How You Can...
Configure and generate AUTOSAR-compliant code and export AUTOSAR software component description XML files for a Simulink model with multiple runnable entities.
Generate a customizable C++ encapsulation interfacetocodegeneratedbytheReal-Time Workshop Embedded Coder software.
Create a custom processor-in-the-loop (PIL) configuration using target connectivity APIs.
Label
Configure M odel Functions
55
Real-Time Workshop®Embedded Coder™ Release Notes
Demo...
rtwdemo_iec61508_script
rtwdemo_pil
The following demo has been enhanced in R2008b:
rtwdemo_tfl_script
Shows How You Can...
Use Model Advisor checks to help you develop a model and code that comply with the IEC 61508 standard (uses Simulink
®
Verification and
Validation™ software).
Compare results from Normal mode simulation and PIL mode execution for the same referenced model.
56
Version 5.1.1 (R2008a+) R eal-Time Workshop®Embedded Coder™ Software
Version 5.1.1 (R2008a+) Real-Time Workshop Embedded Coder Software
This table summ
New Features and Changes
No No Bug Reports
Version Compatibility Considerations
arizes what’s new in Version 5.0.1 (R2008a+):
Fixed Bugs an d Known Problems
Includes fixes
Related Documentation at Web Site
No
57
Real-Time Workshop®Embedded Coder™ Release Notes
Version 5.1 (R2008a) Real-Time Workshop Embedded Coder Software
New Features and Changes
Yes Details below
This table summ
Version Compatibility Considerations
Yes—Details as Compatibi
Considerat
below. See a Summary
New features and changes introduced in this version are
“New AUTOSAR Compliant Code Generation Capability and Demos” on
page 59
“Bidirection al Traceability for Stateflow Charts and Embedded MATLAB
Functions” on page 59
“Generated Code Enhancements” on page 62
“Function Prototype Control Enhancements” on page 62
“CustomStorageClassFileTypeChanged”onpage62
“Improved MISRA C Compliance for Matrix Math Utilities and Lookup
Block Utilities” on page 64
arizes what’s new in Version 5.1 (R2008a):
labeled
lity
ions,
lso
Fixed Bugs an d Known Problems
Bug Reports Includes fixes
Related Documentation at Web Site
No
58
“math.h Header File Inclusion Now Controllable Through Target Function
Library Customization” on page 64
““What’s T his?” Context-Sensitive Help Available for Simulink
Configuration Parameters Dialog” on page 64
“New and Enhanced Demos” on page 65
Version 5.1 (R2008a) Real-Time Workshop®Embedded Coder™ Software
New AUTOSAR Comp Capability and D
Real-Time Works AUTOSAR-compl line function “Generating C Workshop Embe
Select the ne
Code Generat
box. You can t for configu and from XML
New functi more infor the Real-T
Also, two
rtwdemo_ rtwdemo
Bidirec
ring AUTOSAR-compliant code generation and import/export to
ons provide command-line access to all AUTOSAR options. For
mation, see “Configuring AUTOSAR Options Prog ramm atically ” in
ime Workshop Embedded Coder User’s Guide documentation.
AUTOSAR demos are provided,
autosar_roundtrip_script
_autosar_legacy_script
tional Traceability for Stateflow Charts and
Embedd
In prev provid bidir objec targe code go fr righ
ious releases, the Real-Time Workshop Embedded Coder software
ed bidirectional traceability for Simulink blocks only. In R2008a,
ectional traceability is added between generated code and Stateflow chart
ts and Embedded M ATLAB scripts. For embedded real-time (ERT) based
ts, you can choose to include traceability comments in the generated
. Using the enhanced traceability report, you can click hyperlinks to
omalineofcodetoitscorrespondingiteminthemodel. Youcanalso
t-click an item in your m odel to find its corresponding line of code.
hop Embedded Coder V5.1 (R2008a) provides
iant code generation configurable by GUI, command
s, or AUTOSAR-compliant XML files. For information, see
ode for AUTOSAR Software Components” in the Real-Time
dded Coder User’s Guide documentation.
w system target file
ion Options pane in the Configuration Param eters dialog
hen launch the Model Interface dialog to access all options
files.
ed MATLAB Functions
emos
liantCodeGeneration
autosar.tlc to access the AUTOSAR
and
.
following parameters are added or updated for bidirectional traceability:
The
59
Real-Time Workshop®Embedded Coder™ Release Notes
Previous Parameter Location and N a m e
Real-Time Workshop > General pane: Gen era te HTML report
Real-Time Workshop > General pane: Launch report automatically
Real-Time Workshop > General pane: Code-to-block highlighting
Real-Time Workshop > General
pane: Block-to-code highlighting
N/A
N/A
N/A
N/A
New Parameter Location and Name
Real-Time Workshop > Report pane: Create code generation report
Real-Time Workshop > Report pane: Launch report automatically
Real-Time Workshop > Report pane: Code-to-model
Real-Time Workshop > Report pane: Model-to-code
Real-Time Workshop > Report pane: Eliminated / virtual blocks
Real-Time Workshop > Report pane: Traceable Simulink blocks
Real-Time Workshop > Report pane: Traceable Stateflow objects
Real-Time Workshop > Report pane: Traceable Embedded MATLAB functions
60
Real-Time Workshop > Comments pane: Simulink block comments
Real-Time Workshop > Comments pane: Simulink block / Stateflow comments
Also, the right-click Real-Time Workshop > Highlight Code menu option is now Real-Time Workshop > Navigate to Code.
For more information, see “Traceability of Stateflow Objects in Real-Time Workshop Generated Code” in the Stateflow and Stateflow
®
Coder™ documentation, “Using Traceability in Embedded MATLAB Function Blocks” in the Simulink documentation, and “Generating Reports for Code Reviews
Version 5.1 (R2008a) Real-Time Workshop®Embedded Coder™ Software
and Traceability Analysis” in the Real-Time Workshop Embedded Coder documentation.
61
Real-Time Workshop®Embedded Coder™ Release Notes
Generated Code E
In R2008a, code g
Enable cross pr
charts.
Reduce the siz
Assignment, B
Function Pro
In R2008a, fu
Adds a previ
configurin
Adds the ca
Ignores th
configur
For more i the R eal
ation parameter when a
nformation, see “Controlling Generation of Function Prototypes” in
-Time Workshop Embedded Coder documentation.
eneration is enhanced to
oduct optimizations between Simulink blocks and Stateflow
e of co de and improve code execution speed for the Bus us Creator and Bus Selector blocks.
totype Control Enhancements
nction prototype control:
ew function prototype command,
g the prototype programmatically.
pability to work with model references.
e Pass scalar root inputs by value model reference
nhancements
getPreview,when
model_step function prototype is specified.
Compatibility Considerations
usly, the code generator ignored function prototype control
Previo
ications for reference models. In R2008a, when you configure
specif arefer implem by doi
enced model for function prototype control and multi-instance
entations, the code generator reports an error. Y ou can fix the error
ng one of the following:
62
Confi
Disa
Cust
In p rel fun whe
gure the referenced model for single-instance implementation.
ble function prototype control for the model.
om Storage Class File Type Changed
revious releases, a built-in class’s custom storage class definitions were
eased in a
ctionally equivalent
n both files exist MATLAB ignores the
.m file. In R2008a, they are released in both a .m file and a
.p file. The .p files take precedence over .m files, so
.m file and loads the .p file.
Version 5.1 (R2008a) Real-Time Workshop®Embedded Coder™ Software
The .m file exists for human readability and to support customizing built-in custom storage classes (CSCs).
You can examine a built-in class’s custom storage class definitions in the Custom Storage Class D esigne r. In previous releases, the designer loaded the
.m file that defined the CSCs. You can edit .m files, so you could ed it built-in
CSC definitions and save the changes, which would take effect immediately. In R2008a, the CSC designer loads the
.p files cannot be edited, so all CSC Designer editing capabilities are disabled
when the CSC Designer obtained the CSCs that it displays from a
.p file rather than the .m file. However,
.p file.
You can delete a and the CSC Designer load the corresponding thesameCSCsasthe
.p file that contains CSC definitions, in which case MATLAB
.m file, which defines exactly
.p file. However, .m files can be edited, so you can
then edit built-in CSCs as in previous releases. How ever, The MathWorks discourages this practice. If you delete both the
.p file and the .m file for a
package that defines CSCs, an error occurs when you try to use the package.
Compatibility Considerations
No compatibility problems a rise unless you changed built-in custom storage class definitions in earlier releases and want to continue to do so in R2008a. As of R2008a, The MathWorks discourages customizing built-in custom storage class files. The preferred techniqueistocreateuser-definedpackages and custom s torage classes, as described in “Subclassing Simulink Data Classes” and “Creating and Using Custom Storage Classes”. The CSC designer stores user-defined CSC definitions in capability is unchanged in R 2008a.
If you want to continue the practice of customizing the CSC definitions for a built-in package, you must first delete the P-file that defines the CSCs for the package. That file is always named MATLABpathinadirectorynamed@ name, e.g.
@simulink. With the P-file deleted, the CSC designer loads the .m
csc_registration.p, and exists on the
package,wherepackag e is the package
file, w hich you can then edit and save as in earlier releases. MATLAB then loads the changed CSC definitions for that package from the
.m files, so the interface to that
.m file.
63
Real-Time Workshop®Embedded Coder™ Release Notes
Improved MISRA C Compliance for Matrix Math Utilities and Lookup Block Utilities
This release improves the MISRA C compliance of matrix math u til ities and lookup block utilities that are used in generated code.
math.h Header File Inclusion Now Controllable Through Target Function Library Customization
In previous releases, code generated by the Real-Time Workshop Embedded Coder software automatically included the standard math functions, regardless of the math requirements of the target environment. In this release, selecting or customizing a target function library (TFL) for your model controls which header files are included, and generated code does not automatically include
For more information about selecting TFLs, see “Selecting and Viewing Target Function Libraries” in the Real-Time Workshop documentation. For more information about customizing TFLs, see “Replacing Math Functions and Operators Using Target Function Libraries” in the Real-Time Workshop Embedded Coder documentation.
math.h header file, defining C
math.h unless it is needed.
64
“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.
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.
Version 5.1 (R2008a) Real-Time Workshop®Embedded Coder™ Software
3 Click What’s This? A context-sensitive help window appears showing a
description of the parameter.
New and Enhanced Demos
Thefollowingdemoshavebeenadded:
Demo...
rtwdemo_autosar_legacy_script
rtwdemo_autosar_roundtrip_script
rtwdemo_polyspace
The following demo has been enhanced to illustrate code traceability improvements in R2008a:
rtwdemo_hyperlinks
Shows Ho w You Can...
Prepare, implement, and verifyanexistingmodelfor AUTOSAR by using the AUTOSAR target.
Import, modify, and export AUTOSAR software components.
Use PolySpace®products to prove both the absence and presence of run-time errors for code generated by Real-Time Workshop Embedded Coder software. It also shows the results of MISRA C compliance for the generated code.
65
Real-Time Workshop®Embedded Coder™ Release Notes
Version 5.0.1 (R2007b+) Real-Time Workshop Embedded Coder Software
This table summ
New Features and Changes
No No Bug Reports
Version Compatibility Considerations
arizes what’s new in Version 5.0.1 (R2007b+):
Fixed Bugs an d Known Problems
Includes fixes
Related Documentation at Web Site
No
66
Version 5.0 (R2007b) Real-Time Workshop®Embedded Coder™ Software
Version 5.0 (R2007b) Real-Time Workshop Embedded Coder Software
New Features and Changes
Yes Details below
This table summ
Version Compatibility Considerations
No Bug Reports
New features and changes introduced in this version are
“New Target Function Library (TFL) API for Mapping Math Functions and
Operators to Target-Specific Code” on page 68
“Bidirectional Traceability Now Supported Through Automated
Block-to-Code and Code-to-Block Highlighting” on page 70
“HTML Code Generation Report Adds Traceability Report” on page 72
“Elimination of Wrapper Generated by R2007a model_step Function
Prototype Control Feature” on page 73
“Optimized External I/O Data Structures with Function Prototype Control”
on page 74
“MISRA C Compliance Enhanced for Enabled Subsystem Code” on page 74
“User-Defined Data Classes Can Reference Custom Storage Classes from
Other Packages” on page 74
arizes what’s new in Version 5.0 (R2007b):
Fixed Bugs an d Known Problems
Includes fixes
Related Documentation at Web Site
No
“Data Type Assistant Support for MPT Objects” on page 77
“New Target Config uration Parameter for Enabling Real-Time Workshop
Compiler Optimization Level Control” on page 77
“New Interactive Guided Introduction Demo” on page 78
“New and Enhanced Demos” on page 79
67
Real-Time Workshop®Embedded Coder™ Release Notes
New Target Function Librar y (TFL) API for Mapping Math Functions and Operators to Target-Specific Code
In previous releases, the Target floating-point math environment parameter on the Interface pane of the Configuration Parameters dialog box allowed you to select a math library (ANSI function calls would be generated for appropriate/supported functions within the generated code for your model. However, no general mechanism was provided for creating and registering generic target-specific function libraries.
This release provides the target function library (TFL) API, which allows you to create and register function replacement tables. When selected for a model, these TFL tables provide the basis for replacing default math functions and operators in your model code with target-specific code. The ability to control function and operator replacements in this manner potentially allows you to optimize target performance (speed and memory) and better integrate model code with exte rnal and legacy code.
The general steps for creating and using a target function library are as follows:
®
,ISO®,orGNU®)towhich
68
1 Create one or more TFL tables containing replacement entries for math
operators (+, –, *, /) and functions using a MATLAB-based API. (The demo
rtwdemo_tfl_script provides example tables that can be used as a
starting point for customization.)
2 Register a target function library, consisting of one or more replacement
tables, using a Simulink
sl_customization API.
Version 5.0 (R2007b) Real-Time Workshop®Embedded Coder™ Software
3 Open your model and select the desired target function library from the
Target function library drop-down list, located on the Interface pane in the Configuration Parameters dialog box.
4 Build your model.
For more information, see “Replacing Math Functions and Operators Using Target Function Libraries” in the Real-Time Workshop Embedded Coder documentation.
Additionally, see the new demo
rtwdemo_tfl_script, which illustrates how
to use TFLs to replace operators and functions in generated code. With each example model included in this demo, a separate TFL is provided to illustrate the creation of operator and function replacements and how to register the replacements with Simulink.
69
Real-Time Workshop®Embedded Coder™ Release Notes
Bidirectional T
raceability Now Supported Through Automated Block Highlighting
In previous rel traceability
Include hyper
the Configura
This release and generate
Renaming th
Code-to-bl
Adding the
ablockand
To use Blo
1 Open an ER
the Conf
HTML rep highlig Configu
traced
eases, Real-Time Workshop Embedded Coder software provided
fromgeneratedcodebacktomodel source blocks through the
links to model option on the Real-Time Workshop pane of
tion Parameters dialog box.
provides bidirectional traceability between model source blocks
dcodeby
e existing option from Include hyperlinks to model to
ock highlighting
Block-to-code highlighting option, which allows you to select
highlight its generated code.
ck-to-code highlighting,
T-based model and go to the Real-Time Workshop pane of
iguration Parameters dialog box. Select the options Generate
ort, Launch report automatically,andBlock-to-code
hting.(SelectingBlock-to-code highlighting also enables the
re button, which you can click to select a build directory to be
.)
-to-Code and Code-to-Block
70
2 Build your model. This will launch an HTML code generation report.
3 In the model window, right-click any block. In the right-click menu, select
Real-Time Workshop > Highlight C ode.
Version 5.0 (R2007b) Real-Time Workshop®Embedded Coder™ Software
4 This selection highlights the generatedcodefortheblockintheHTMLcode
generation report. The total number of highlighted lines is displayed next to each source file name in the left panel of the HTML report. Previous and Next buttons help you navigate through the highlighted lines.
71
Real-Time Workshop®Embedded Coder™ Release Notes
For more information, see “Generating Reports for Code Reviews and Traceability Analysis” in the Real-Time Workshop Embedded Coder documentation.
Additionally, see the enhanced demo through using Code-to-block highlighting, Block-to-code highlighting, and the traceability report discussed in the next section.
rtwdemo_hyperlinks,whichwalksyou
HTML Code Generation Report Adds Traceability Report
In previous releases, HTML code generation reports did not provide information to help explain why some model blocks do not generate corresponding code. In this release, when you select the Block-to-code highlighting parameter discussed in the previous section, the generated HTML report contains a traceability report. The traceability report contains sections that allow you to account for Eliminated / Virtual Blocks versus
Traceable Blocks, providing a complete mapping between blocks and code.
72
Version 5.0 (R2007b) Real-Time Workshop®Embedded Coder™ Software
For more information, see “Generating Reports for Code Reviews and Traceability Analysis” in the Real-Time Workshop Embedded Coder documentation.
Additionally, see the enhanced demo through using the new traceability report.
rtwdemo_hyperlinks,whichwalksyou
Elimination of Wrapper Generated by R2007a model_step Function Prototype Control Feature
In R2007a, function prototype control generated a wrapper function to implement the modifies the
model_step function. In R2007b, function prototype control
model_step function directly, reducing execution time.
73
Real-Time Workshop®Embedded Coder™ Release Notes
Optimized Exter Prototype Contr
In R2007b, funct in the followin
The data struc
of the externa function.
The data stru
MAT-file log
For more inf the R eal-Ti
MISRA C Com Subsystem
R2007b im
Impleme
stateme
Improvi
ion prototype control optimizes external I/O data structures
gways:
ture of a model’s external input is r em ove d unless the value
l input is used in a subsystem implemented by a nonreusable
cture for the model’s external output is removed except when
ging is enabled, or if the sample time of the outport is constant.
ormation, see “Controlling Generation of Function Prototypes” in
me Workshop Embedded Coder documentation.
pliance Enhanced for Enabled
Code
proves MISRA C compliance of generated code by:
nting enabled subsystem logic more efficiently using if-then-else
nts
ng compliance of library code used in generated code
nal I/O Data Structures with Function
ol
74
User-D Storag
In pre defin not be adup was n be up
Any tha and
ss or section exists, in the package that first defined it; other packages refer
cla
it by pointing to it in its original location. Thus any changes to the class or
to
efined Data Classes Can Reference Custom e Classes from Other Packages
vious releases, the custom storage classes and memory section
itions contained in a package were unique to that package, and could
used directly by other packages. The only recourse was to create
licate definition in every package that needed it. If a global change
eeded in the definition of the class or section, each local copy had to
dated separately.
package can access and use custom storage classe s and memory sections
t are defined in any other package, including both user-defined packages
predefined packages such as
Simulink and mpt. Only one copy of the
Version 5.0 (R2007b) Real-Time Workshop®Embedded Coder™ Software
section, including changes to a predefined class/section in later MathWorks product releases, are available in every referencing package.
Toconfigureapackagetouseacustomstorage class o r memory section that is defined in another package:
1 Type cscdesigner to launch the Custom Storage Class Designer. The
relevant part of the desig ne r window looks like this:
2 Select the Custom Storage Class or Memory Section tab as appropriate.
The following example assumes Custom Storage Class. Memory section references work the same way.
3 Use S ele ct Package to select the pack ag e in which you want to reference
a class (or section) defined in some other package.
4 In the Custom storage class definitions pane, select the existing
definition below which you want to insert the reference.
75
Real-Time Workshop®Embedded Coder™ Release Notes
5 Click New Reference.
A new reference with a default name and properties appears below the previously selected definition. The new reference is selected, and a Reference tab appears that shows the reference’s initial properties. This tab appears whenever a reference is selected, allowing reference properties to be viewed and changed. A typical appearance is:
76
6 Use the Nam e field to enter a name for the new reference. The name
must be unique in the importing package, but can duplicate the name in the source package.
7 Set Refer to custom storage class in package to specify the package
that contains the custom storage class you want to reference.
8 Set Custom storage class to reference to specify the custom storage
class to be referenced. Trying to create a circular reference generates an error and leaves the package unchanged.
9 Click OK or A pply.
If you had worked under the Memory Section tab rather than the Custom Storage Class tab, the sequence would have been essentially the same, with
Version 5.0 (R2007b) Real-Time Workshop®Embedded Coder™ Software
appropriate differences in the dialog box labels and the set of items available to be chosen.
You can use Custom Storage Class Designer capabilities to copy, reorder, validate, a nd otherwise manage classes and sections that have been added to a class by reference. However, you cannot change the underlying definitions. You can change a custom storage class or memory section only in the package where it was originally defined.
For more info rmation, see “Using Custom Storage Class References” and “Using Memory Section References”.
Data Type Assistant Support for MPT Objects
Simulink now provides a standardized user interface, the Data Type Assistant, for specifying data types associated with Simulink blocks and data
objects, as well as Stateflow data. See “Using the Data Type Assistant” for details.
The Data Type Assistant appears on the dialogs of a variety of blocks and data objects, including MPT data objects, which are specific to the Real-Time Workshop Embedded C oder software:
mpt.Parameter
mpt.Signal
Information about MPT objects appears in “Defining Data Representation and Storage for Code Generation”.
New Target Configuration Parameter for Enabling Real-Time Workshop Compiler Optimization Level Control
V5.0 (R2007b) Real-Time Works ho p Embedded Coder introduces a new target configuration parameter, whether a target supports the new Real-Time Workshop configuration parameter Compiler Optimization L evel.(Compiler Optimization Level con trols the compiler optimization l evel for building generated code; for more information, see “Controlling Compiler Optimization Level and
CompOptLevelCompliant. This parameter indicates
77
Real-Time Workshop®Embedded Coder™ Release Notes
Specifying Custom Optimization Settings” in the Real-Time Workshop documentation.)
When the to
on,theCompiler Optimization Level parameter is displayed in the
CompOptLevelCompliant target configuration parameter is set
Real-Time Workshop pane of the Configuration Parameters dialog box for your model. If the
CompOptLevelCompliant parameter is not set to on,the
Compiler Optimization Level parameter does not appear.
By default, the targets a nd
CompOptLevelCompliant parameter is set to off for custom
on for targets provided by Real-Time Workshop and Real-Time
Workshop Embedded Coder.
To make a target compliant, use the
CompOptLevelCompliant to on, and then modify the target makefile to honor
SelectCallback function to set
the setting for Compiler Optimization Level, in the manner of the targets provided by Real-Time Workshop and Real-Time Workshop Embedded Coder.
New Interactive Guided Introduction Demo
An interactive demo of R eal-Tim e Workshop Embedded Coder is available. This demo shows you how to apply MathWorks products to the basic steps thatarecommontomostprojectsthat design and implement a control algorithm. To view the demo:
1 In the MATLAB command window, enter the following command:
>> rtwdemos
78
The Real-Time Workshop Demos page is displayed.
2 Scroll down to Step-by-Step Code Generation Process under Guided
Tutorials.
Help displays the names of the modules that comprise the Step-by-Step Code Generation Process demo. To begin viewing the demo, click the name
of the first module, Introduction, then proceed through subsequent modules in order, or jump directly to any that are of particular interest.
Version 5.0 (R2007b) Real-Time Workshop®Embedded Coder™ Software
New and Enhanced
The following de
Demo...
rtwdemo_pcgd_intro
rtwdemo_tfl_script
The foll improve traceab
owing demo has been enhanced to illustrate code traceability
ments in R2007b, including block-to-code highlighting and
ility report enhancements:
rtwdem
o_hyperlinks
mos have been added:
Demos
Shows How You Can...
Apply MathWorks products to the basic steps that are common to most projects that design and implement a control algorithm. For more information, see “New Interactive Guided Introduction Demo” on page 78.
Use Target Function Libraries (TFLs) to replace operators and functions in generated code. Witheachexamplemodelincluded in this demo, a separate Target Function Library is provided to illustrate the creation of operator and function replacements using a MATLAB based API, and how to register the replacements with Simulink.
79
Real-Time Workshop®Embedded Coder™ Release Notes
Version 4.6.1 (R2007a+) Real-Time Workshop Embedded Coder Software
This table summ
New Features and Changes
No No Bug Reports
Version Compatibility Considerations
arizes what’s new in Version 4.6.1 (R2007a+):
Fixed Bugs an d Known Problems
Includes fixes
Related Documentation at Web Site
No
80
Version 4.6 (R2007a) Real-Time Workshop®Embedded Coder™ Software
Version 4.6 (R2007a) Real-Time Workshop Embedded Coder Software
New Features and Changes
Yes Details below
This table summ
Version Compatibility Considerations
No Bug Reports
New features and changes introduced in this version are
“Controlling Step Function Prototypes for Models” on page 81
“New ModelStepFunctionPrototypeControlCompliant Target Configuration
Parameter” on page 83
“New ERT Target for Generating Host-Based Shared Libraries” on page 84
“Enhanced Software-in-the-loop (SIL) Testing with New Portable Word
Sizes Option” on page 86
“New Code Style Options for Controlling Expression Optimizations in
Generated Code” on page 87
“Enhanced MISRA C Com pliance” on page 88
“New and Enhanced Demos” on page 88
arizes what’s new in Version 4.6 (R2007a):
Fixed Bugs an d Known Problems
Includes fixes
Related Documentation at Web Site
No
Controlling Step Function Prototypes for Models
In previous releases, there were only limited ways to control the function prototype of an ERT-based model’s generated default
If you generate reusable, reentrant code for an ERT-based model, the model’s root-level inputs and outputs, block states, parameters, and external outputs are passed in to following:
model_step function prototype resembles the following:
void model_step(void);
model_step using a function prototype that resembles the
model_step function. The
81
Real-Time Workshop®Embedded Coder™ Release Notes
void model_step(inport_args, outport_args, BlockIO_arg, DWork_arg, RT_model_arg);
Thisreleaseaddsmoreflexibleusercontroloverthemod el_step function prototype that is generated for ERT-based Simulink models. From the Interface pane of the Configuration Parameters dialog box, you can click a new Configure Functions button that launches a Model Step Functions dialog box. Based on the Function specification value you select f o r your
model_step function (supported values include Default model-step
function
and Model specific C prototype), you can preview and modify
the function prototype. Here is a sample dialog box:
82
Once you validate and apply your changes, you can generate co de based on your function prototype modifications.
Version 4.6 (R2007a) Real-Time Workshop®Embedded Coder™ Software
Alternatively, you can use function prototype control functions to programmatically control
model_step function prototypes. For more
information, see “Configuring Model Function Prototypes Programmatically” in the Real-Time Workshop Embedded Coder documentation.
You can also control step function prototypes for nonvirtual subsystems, if you generate subsystem code using right-click build. To launch the Model Step Functions for subsystem dialog box, use the function
RTW.configSubsystemBuild:
RTW.configSubsystemBuild('model/subsystem') RTW.configSubsystemBuild(gcb)
Right-click building the subsystem will generate the step function according to the customizations you make.
For more information about controlling
model_step function prototypes,
see the sections “Configuring the Target Hardware Environment” and “Controlling Generation of Function Prototypes” in the Real-Time Workshop Embedded Coder documentation. For limitations that a pply, see “Model Function Prototype Control Limitations” in the Real-Time Workshop Embedded Coder documentation.
For more detailed information about the default calling interface for the
model_step function, see the model_step reference page.
New ModelStepFunctionPrototypeControlCompliant Target Configuration Parameter
In conjunction with the function prototype control feature described in the previous section, this release introduces the
ModelStepFunctionPrototypeControlCompliant target configuration
parameter. This parameter is set in the to indicate whether the target supports the ability to control the function prototypes of step functions that are generated for a Simulink model. The default is
off for custom and non-ERT targets and on for ERT (ert.tlc)
targets.
SelectCallback function for a target
83
Real-Time Workshop®Embedded Coder™ Release Notes
When this parameter is set to off and you attempt to use function prototype control to modify a step function signature, Real-Time Workshop Embedded Coder ignores the modified function prototype control configuration.
To make a target compliant,
1 Use the SelectCallback function to set
ModelStepFunctionPrototypeControlCompliant to on. This enables
the feature infrastructure and user interface.
2 If your target uses a custom static main module, and if a nondefault
function prototype control configuration is associated with a model, update the main module to call the function prototype controlled model step function. You can do this in either of the following ways:
a Manually adapt your main module to declare appropriate model data
and call the function prototype controlled model step function.
b Generate your main module using Generate an example main
program on the Templates pane of the Configuration Parameters
dialog box. This mechanism has been updated to declare model data and call the function prototype controlled model step function appropriately.
84
New ERT Target for Generating Host-Based Shared Libraries
This release adds a new ERT target, ert_shrlib.tlc,forgeneratinga host-based shared library from your Simulink model. Selecting this target allows you to generate a shared library version of your model code that is appropriate for your host platform, either a Windows (
.dll)fileoraUNIX
®
shared object (.so) file. This feature can be used to package your source code securely for easy distribution and shared use. The generated
.dll or .so file is shareable among different applications and
upgradeable without having to recompile the applications that use it.
To configure your model code for shared use by applications, you select the
ert_shrlib.tlc target on the Real-Time Workshop pane of the
Configuration Parameters dialog box.
®
dynamic link library
Version 4.6 (R2007a) Real-Time Workshop®Embedded Coder™ Software
The shared library generated from your model can be dynamically loaded from another application. For example, if you open the demo select the
ert_shrlib.tlc target, and generate code, application code similar
rtwdemo_counter,
to the following could be used to dynamically load the generated library file:
#if (defined(_WIN32)||defined(_WIN64)) /* WINDOWS */ #include <windows.h> #define GETSYMBOLADDR GetProcAddress #define LOADLIB LoadLibrary #define CLOSELIB FreeLibrary
#else /* UNIX */ #include <dlfcn.h> #define GETSYMBOLADDR dlsym #define LOADLIB dlopen #define CLOSELIB dlclose
#endif
int main() {
void* handleLib; ... #if defined(_WIN64)
handleLib = LOADLIB("./rtwdemo_counter_win64.dll"); #else #if defined(_WIN32)
handleLib = LOADLIB("./rtwdemo_counter_win32.dll");
85
Real-Time Workshop®Embedded Coder™ Release Notes
#else /* UNIX */
handleLib = LOADLIB("./rtwdemo_counter.so", RTLD_LAZY); #endif #endif ...
return(CLOSELIB(handleLib)); }
For more information about using the ert_shrlib.tlc target, see “Creating and Using Host-Based Shared Libraries” in the Real-Time Workshop Embedded C oder documentation. For limitations that apply, see “Host-Based Shared Library Limitations” in the Real-Time Workshop Embedded Coder documentation.
Enhanced Software-in-the-loop (SIL) Testing with New Portable Word Sizes Option
This release adds a new model configuration option, Enable portable word sizes, that supports code generation for host-target configurations in
which the processor word sizes differ betwe en host and target platforms (for example, a 32-bit host and a 16-bit target). Selecting the Enable portable word sizes option allows you to generate code with conditional processing macros that allow the same generated source code files to be used both for software-in-the-loop (SIL) testing on the host platform and for production deployment on the target platform.
86
To use this feature, select both Create Simulink (S-Function) block and Enable portable word sizes on the Interface pane of the Configuration Parameters dialog box. Also, make sure that Emulation hardware is set to None on the Hardware Implementation pane.
n you generate code from your model, data type definitions are
Whe
ditionalized such that
con
the host platform and Real-Time Workshop types are used to support
on
tmwtypes.h is included to support SIL testing
Version 4.6 (R2007a) Real-Time Workshop®Embedded Coder™ Software
deployment on the target platform. For example, in the generated code below, the first two lines define types for host-based SIL testing and the bold lines define types for target deployment:
#ifdef PORTABLE_WORDSIZES /* PORTABLE_WORDSIZES defined */ # include "tmwtypes.h" #else /* PORTABLE_WORDSIZES not defined */ #define __TMWTYPES__ #include <limits.h> ...
typedef signed char int8_T; typedef unsigned char uint8_T; typedef int int16_T; typedef unsigned int uint16_T; typedef long int32_T; typedef unsigned long uint32_T; typedef float real32_T; typedef double real64_T;
... #endif /* PORTABLE_WORDSIZES */
To build the generated code for SIL testing on the host platform, the definition
PORTABLE_WORDSIZES should be passed to the compiler, for example by u sing
the compiler option deployment, the code should be compiled without the
-DPORTABLE_WORDSIZES.Tobuildthesamecodefortarget
PORTABLE_WORDSIZES
definition.
For more information about using portable word sizes for host-based SIL testing, see “Configuring the Target Hardware Environment” and “Configuring Hardware Implementation Settings” in the Real-Time Workshop Embedded Coder documentation. For limitations that apply, see “Portable Word Sizes Limitation” in the Real-Time Workshop Embedded Coder documentation.
New Code Style Options for Controlling Expression Optimizations i n Generated Code
Two new options on the Code Style pane of th e Configuration Parameters dialog box allow you to control specific optimizations in generated code:
87
Real-Time Workshop®Embedded Coder™ Release Notes
Option Description
Preserve o p er a n d order in expression
Preserve condition expression in if statement
Formoreinformation,seeCodeStylePaneintheReal-TimeWorkshop Embedded Coder documentation.
By default, Real-Time Workshop might reorder commutable operands to make an expression left-recursive. Selecting this option preserves the expression order y ou specify in the model.
By default, Real-Time Workshop negates the condition expression in an
if statement if the first
statement branch is empty. Selecting this option preserves the condition expression you specify in the model.
Enhanced MISRA C Compliance
This release provides several enhancements to MISRA C compliance, including
Numerous improvements to source files in the
directory
matlabroot/rtw/c/libsrc
88
Elimin ation of
information, see the Stateflow and Stateflow Coder Release Notes)
Simplified generated code for reusable enabled subsystems (for more
information, see the Real-Time Workshop Release Notes)
goto statements in Stateflow generated code (for more
New and Enhanced Demos
Thefollowingdemoshavebeenadded:
Version 4.6 (R2007a) Real-Time Workshop®Embedded Coder™ Software
Demo...
rtwdemo_fcnprotoctrl
Shows How You Can...
Control the generated function prototype for the model entry point function
rtwdemo_shrlib
Use the ERT shared library target to generate a host-based shared library ( or .so) from a model and then load the shared library from another application
The following demo has been enhanced:
rtwdemo_sil
model_step
.dll
89
Real-Time Workshop®Embedded Coder™ Release Notes
Version 4.5 (R2006b) Real-Time Workshop Embedded Coder Software
New Features and Changes
Yes Details below
This table summ
Version Compatibility Considerations
Yes—Details as Compatibi
Considerat
below. See a Summary.
New features and changes introduced in this version are
“Efficiency Enhancements in Generated Code” on page 91
“Fixed-Point Code Generation Support for Enhanced N -Dimensional
Lookup Table Blocks” on page 91
“Ability to Control Use of Parentheses in Generated Code” on page 91
“Enhanced HTML Code Report Performance and Content” on page 92
“New General-Purpose O SEK /VDX Real-Time Operating System (RTOS)
Example” on page 92
“New ’error’ Hook Method fo r STF_make_rtw_hook.m” on page 93
arizes what’s new in Version 4.5 (R2006b):
labeled
lity
ions,
lso
Fixed Bugs an d Known Problems
Bug Reports Includes fixes
Related Documentation at Web Site
No
90
“Maximum Length E nforced for Au to-Generated Identifiers in Generated
Code” on page 93
“New Default Value for IncludeER T F i rstT ime Model Configuration
Parameter” on page 95
“UseoffirstTimeArgumenttomodel_initializeFunctiontoBe
Discontinued” on page 96
“"Source of initial values" Option for MPT Data Objects Removed” on
page 96
“New and Enhanced Demos” on page 97
Version 4.5 (R2006b) Real-Time Workshop®Embedded Coder™ Software
“New Reference Documentation” on page 97
Efficiency Enhancements in Generated Code
Real-Time Workshop Embedded Coder V4.5 (R2006b) provides the following efficiency enhancements in code generated from Simulink models:
Element-by-element optimized code for vector operations
Improved efficiency and readability of
that have multiple sources
Unnecessary temporary variables no longer generated for muxed signals
for loops generated for wide signals
Fixed-Point Code Generation Support for Enhanced N-Dimensional Lookup Table Blocks
Real-Time Workshop Embedded Coder V4.5 (R2006b) supports fixed-point code generation for the following new Simulink N-dimensional lookup table blocks:
Prelookup
Interpolation Using Prelookup
The new blocks provide fixed-point arithmetic and more efficient code generation than the b locks they replace, PreLookup Index Search and Interpolation (n-D) Using PreLookup.
Ability to Control Use of Parentheses in Generated Code
The new Code Style pane in the Configuration Parameters dialog box allows you to control optional parentheses in generated code, including generating code that meets MISRA code similar to that of previous releases.
®
requirements. The default behavior is to generate
Formoreinformation,seeCodeStylePaneintheReal-TimeWorkshop Embedded Coder documentation.
91
Real-Time Workshop®Embedded Coder™ Release Notes
Enhanced HTML Code Report Performance and Content
If you select the Generate HTML report check box on the Real-Time Workshop pane of the Configuration Parameters dialog box, Real-Time
Workshop Embedded Coder automatically produces a code generation report in HTML format. In R2006b, the performance associated with producing the code generation report has improved significantly. In addition, the reports no longer display the names of hidden blocks, such as automatically inserted Rate Transition blocks, as hyperlinks.
New General-Purpose OSEK/VDX Real-Time Operating System (RTOS) Example
Real-Time Workshop Embedded Coder V4.5 (R2006b) adds a new demo,
rtwdemo_osek, that illustrates techniques for interfacing to the OSEK/VDX
real-time operating system (RTOS). The demo model includes:
®
Example Simulink block implementations of OSEK functions
and ActivateTask
Function-call subsystems that are generated as separate OSEK tasks,
which can execute based on assigned priority using the OSEK scheduler
Additional files related to the demo are provided in
matlabroot/toolbox/rtw/rtwdemos/osektgt_demo. These include:
Real-Time Workshop Embedded Coder file customization template
osek_file_process.tlc, which generates a generic OSEK main program
and an OSEK Implementation Language (OIL) file
OSEK library file
osek_file_process.tlc
C and C MEX-files for the S-functions oseksetalarm and osektask
After launching rtwdemo_osek,youcansavethemodelfilertwdemo_osek.mdl to a work directory. You can use the model file and the related files in
matlabroot/toolbox/rtw/rtwdemos/osektgt_demo as a starting point to
target specific OSEK implementations. The demo model provides examples of implementing Simulink blocks for OSEK APIs, and you can modify
oseklib.tlc, which contains functions called by
SetAlarm
92
Version 4.5 (R2006b) Real-Time Workshop®Embedded Coder™ Software
oseklib.tlc and osek_file_process.tlc to provide detailed information
about your OSEK implementation.
Note
The
The
rtwdemo_osek demo runs only on 32-bit Windows. (You can run the
demo if the MATLAB system.)
rtwdemo_osek demo incorporates a subset of the Embedded Target for
OSEK/VDX functionality. W ith the introduction of R2006b, Embedded TargetforOSEK/VDXwillnolongerbeavailableforpurchaseasaseparate product.
computer command returns the value PCWIN on yo ur
New ’error’ Hook Method for STF_make_r tw_hook.m
As of V4.5 (R2006b), the STF_make_rtw_hook.m hook file, which you can use to customize the target build proces s, supports a new If used, Real-Time Workshop calls the occurs during code generation or the build process. For example, you might use the new hook method to clean up any static or global data used by the hook file after an error occurs. Valid arguments include the hook method and model name.
For more information about the
STF_make_rtw_hook.m hook file, see “Customizing the Target Build
Process with the STF_make_rtw Hook File” in the Real-Time Workshop documentation.
'error' hook method when an error
'error' hook method or the
'error' hook method.
Maximum Length Enforced for Auto-Generated Identifiers in Generated Code
In previous releases, some autogenerated identifiers in generated code were allowed to exceed the Maximum identifier length specified on the Real-Time Workshop/Symbols pane of the Configuration Parameters dialog box. Ge nerate d identifiers that exceeded the Maximum identifier
length did not honor the user setting and potentially were inconsistent
93
Real-Time Workshop®Embedded Coder™ Release Notes
with ANSI C or MISRA guidelin es requiring identifiers to be unique within a prescribed length (31 characters).
In R2006b, the user-specified Maximum identifier length is more rigorously enforced for autogenerated identifiers in generated code.
For limitations that apply, see “Identifier Format Control Parameters Limitations” in the Real-Time Workshop Embedded Coder documentation. For upgrade and compatibility considerations, see “Compatibility Considerations” on page 94.
For more information about the Real-Time Workshop Embedded C oder parameters for Identifier format control and their use, see “Customizing Generated Identifiers” and its subsection “Specifying Identifier Formats” in the Real-Time Workshop Embedded Coder documentation.
Compatibility Considerations
The following considerations for identifier format control apply when upgrading a Simulink model from an earlier release to this release:
94
Some identifiers that were allowed to exceed the Maximum identifier
length (on the Real-Time Workshop/Symbols pane of the Configuration
Parameters dialog box) in earlier releases are mangled in this release to conform to the maximum length. The mangling is most likely to occur in models with long names.
To preserve the identifiers, you can increase the value of the Maximum identifier length parameter for the model.
For models that use model referencing, some models that built successfully
in previous versions might get build warnings or errors in R2006b, due to potential collisions between truncated identifier names that are exported by sibling models. To avoid name clashes in models that use model referencing, do one of the follow ing:
- Increase the Maximum identifier length for top and referenced
models until the warnings or errors disappear. In this case, uniqueness of model names ensures that the exported identifier names do not clash.
- Define a unique identifier naming scheme for each model. For example,
you might define the Identifier format control string
m1$R$N$M for
Version 4.5 (R2006b) Real-Time Workshop®Embedded Coder™ Software
the first model, m2$R$N$M for the second model, and so forth. In this case, uniqueness of Identifier format control strings ensures that the exported identifier names do not clash.
The identifier format control enhancements in this release introduce some
naming differences in the autogenerated ide ntifiers for
- Stateflow and Embedded MATLAB temporary variables
- Subsystem and model reference global identifiers and types
New Default Value for IncludeERTFirstTime Model Configuration Parameter
In R2006a, Real-Time Workshop Embedded Coder introduced the
IncludeERTFirstTime model configuration parameter, wh ich specifies
whether Real-Time Workshop Embedded Coder is to include the argument in the model_initialize function generated for an ERT-based Simulink model.
firstTime
In R2006b, the default value of this parameter has changed from the
firstTime argument) to off (donotincludethefirstTime argument).
As a result, for ERT-based Simulink models newly created in R2006b, the code generated for the include the
To include the the
IncludeERTFirstTime parameter to on. However, see the release note
“Use of firstTime Argument to model_initialize Function to Be Discontinued” on page 96.
Note In R2006b, it is no longer required that the setting for
IncludeERTFirstTime must be consistent throughout a model reference
hierarchy.
firstTime argument.
firstTime argument in generated code, change the value of
model_initialize function by default will no longer
on (include
Compatibility Considerations
For ERT-based Simulink models newly created in R2006b, the code generated for the
firstTime argument. As a result, existing custom static main programs
model_initialize function by default will no longer include the
95
Real-Time Workshop®Embedded Coder™ Release Notes
that invoke model_initialize with the firstTime argument will need to be reconciled with the code generated for the example, you can
model_initialize function. For
Modify the invoking main program to remove code related to the
argument (recommended).
Change the value of the
parameter to
Modify the invoking main program to conditionally include or suppress
the
firstTime argument for the Simulink model. In the generated
header file set to 0 if the parameter is set to
#include autobuild.h and then conditionally compile d eclarations
and calls to the
INCLUDE_FIRST_TIME_ARG macro.
on and regenerate code for the Simulink model.
autobuild.h, the macro INCLUDE_FIRST_TIME_ARG will be
IncludeERTFirstTime parameter is set to off or 1 if the
model_initialize function, based on the value of the
IncludeERTFirstTime model configuration
on. Inside the static main program, make sure to
firstTime
Use of firstTime Argument to model_initialize Function to Be Discontinued
In a future release, Real-Time Workshop Embedded Coder will no longer use the function. For more information about this change, use the form at http://www.mathworks.com/contact_TS.html to contact The MathWorks Technical Support.
firstTime argument in a model’s generated model_initialize
"Source of initial values" Option for MPT Data Objects Removed
In R2006b, the Source of initial values option for MPT data objects has been rem oved from the Data Placement pane of the Configuration Parameters dialog box. Although this option was visible in R2006a, it was obsolete and the setting had no effect.
96
Use
Simulink.Signal objects to initialize signal values, as explained in
“Initializing Signals and Discrete States” in the Simulink documentation.
Loading...