MISRA AC TargetLink
In Nov. 2007 the Motor Industry Software Reliablility Association (MISRA) published the first version of the "Modelling style guidelines for the application of TargetLink in the contect of code generation". The guidelines address aspects of functional safety for embedded software generated with the TargetLink code generator from dSPACE.
The Model Examiner is the first guidelines checker which covers all statically checkable MISRA AC TL rules.
Download list of MISRA AC TargetLink checks in MXAM
MISRA AC TargetLink Checks in MXAM
| No. | Rule | Guideline Title | Repair |
|---|---|---|---|
| 1 | 1.1 | Use of block priorities | yes |
| 2 | 1.2 | Comments in block properties | |
| 3 | 2.3 | Restricting identifiers to 31 characters | yes |
| 4 | 3.2 | Definition of calibration constants in Simulink and ... | |
| 5 | 3.3 | Use of calibration constraints | |
| 6 | 4.2 | Permitted data types at the Stateflow chart interface | yes |
| 7 | 4.4 | Avoidance of saturation in integer arithmetic | yes |
| 8 | 4.5 | Avoidance of rounding operations | |
| 9 | 4.6 | use of user-defined min and max values | |
| 10 | 5.1 | Attributes of Look-up table outputs | |
| 11 | 5.2 | Use of the Switch-case block | partial |
| 12 | 5.3 | Use of Data Store Memory block across TargetLink ... | |
| 13 | 5.4 | Use of From and Goto blocks across TargetLink subsystems | |
| 14 | 5.5 | Inports and Outports at the TargetLink subsystem interface | |
| 15 | 5.6 | Use of the Multiport Switch block | |
| 16 | 5.7 | Use of data types for the Multiport Switch block | |
| 17 | 5.8 | Use of the Switch block | |
| 18 | 5.9 | Use of the Fcn block for assigning Boolean variables | |
| 19 | 5.10 | Use of Custom Code block | yes |
| 20 | 6.1 | Power-of-two scaling | yes |
| 21 | 6.2 | Zero Offsets | yes |
| 22 | 6.3 | Use of the Math block sqrt function for fixed-point code ... | |
| 23 | 6.4 | Use of the FIR Filter block for fixed-point code generation | |
| 24 | 6.5 | Use of the Trogonometric function for fixed-point code ... | |
| 25 | 6.6 | Use of custom Lookuptable functions | |
| 26 | 6.7 | Avoiding rescaling of input signals to Lookup tables | |
| 27 | 7.1 | Generating generic code without pragmas | yes |
| 28 | 7.2 | Avoiding target-specific assembly code | yes |
| 29 | 7.5 | Avoiding local macros | |
| 30 | 7.6 | Correct declaration of external variables | |
| 31 | 7.7 | Use of include statements in Custom Code | |
| 32 | 7.9 | Avoiding shift operations on signed data types |
DSPACE TargetLink
In Mai 2008 dSPACE published the latest version 2.1 of the "Modeling Guidelines for MATLAB/Simulink/Stateflow and TargetLink". The guidelines address best practices for TargetLink models.
The Model Examiner focuses on the adoption of a safe language subset for code generation wth TargetLink.
Download list of dSPACE TargetLink checks in MXAM
dSPACE TargetLink Checks in MXAM
| No. | Rule | Guideline Title | Repair |
|---|---|---|---|
| 1 | 2.1.1 | Block Priorities | yes |
| 2 | 2.1.5 | Bus Capable Blocks | |
| 3 | 2.3.2 | Limitations with Regard to the Dead Zone Block | |
| 4 | 2.4.2 | Limitations with Regard to the Discrete-Time Integrator Block | |
| 5 | 2.5.2 | Limitations with Regard to the Relational Operator and ... | |
| 6 | 2.6.2 | Limitations with Regard to the Look-up Table (n-D) and ... | |
| 7 | 2.7.2 | Limitations with Regard to Operand Numbers for the Product Block | |
| 8 | 2.7.3 | Limitations with Regard to Parameters for the Product Block | |
| 9 | 2.7.4 | Limitations with Regard to the Sum Block | yes |
| 10 | 2.7.5 | Restrictions with Regard to the Math Function Block | yes |
| 11 | 2.10.2 | Use of the Switch Case Block | yes |
| 12 | 2.10.3 | Duplicate Inports | |
| 13 | 2.11.2 | Use of the Data Type Conversion Block | |
| 14 | 2.12.4 | Restrictions with Regard to the Merge Block | yes |
| 15 | 2.12.5 | No Cascades of Merge Blocks prior to TargetLink 2.1.6 | |
| 16 | 2.12.7 | Use of the Multiport Switch Block | |
| 17 | 2.12.8 | Restrictions with Regard to the Multiport Switch Block | yes |
| 18 | 2.12.9 | Limitations with regard to the Bus Creator Block | yes |
| 19 | 2.16.1 | Initialization of a Stateflow Chart | yes |
| 20 | 2.16.2 | Reserved Names in Stateflow | |
| 21 | 2.16.3 | Permitted Dimensionality at the Stateflow Chart Interface | |
| 22 | 2.16.4 | Usage of Constants | |
| 23 | 2.16.5 | Permitted Data Types at the Stateflow Chart Interface | yes |
| 24 | 2.16.6 | Transition Actions | |
| 25 | 2.16.11 | MATLAB Functionality | |
| 26 | 2.16.12 | Alias Types | |
| 27 | 2.16.14 | Arrays at Interfaces of Graphical Functions | |
| 28 | 2.16.16 | Data on the Level of Stateflow Boxes | |
| 29 | 2.16.17 | Embedded MATLAB Functionality | |
| 30 | 2.16.18 | Complex Expressions for the Size Property | |
| 31 | 2.16.19 | Simulink-Stateflow Inheritance | |
| 32 | 4.2 | Reserved System Header File Names | |
| 33 | 5.2 | Comments in Block Properties | |
| 34 | 7.2 | Diagnostics Settings | yes |
| 35 | 7.3 | Advanced Settings | yes |
| 36 | 8.3 | Data Types for Signal Buses at the TargetLink-Simulink Interface | |
| 37 | 8.5 | Avoidance of Saturation in Integer Arithmetic | yes |
| 38 | 8.6 | Avoidance of Rounding Operations | |
| 39 | 8.13 | Use of Data Types for Multiport Switch Blocks |
TargetLink Known Problems
dSPACE constantly updates the known problems for TargetLink within their Known Problems Report. The Known Problems Report lists known TargetLink limitations, possible workarounds and available bugfixes.
The Model Examiner focuses on TargetLink modelling patterns, which result in incorrect but compilable code.
TargetLink Known Problem Checks in MXAM
| No. | Report ID | Title |
|---|---|---|
| 1 | PR20041110-13 | State variables with local scope are not re-initialized |
| 2 | PR20050721-08 | Handling of expr. w/ SF int. types can differ from SF semantics |
| 3 | PR20050809-07 | Nonpersistent variable in multirate production code |
| 4 | PR20051017-01 | Stateflow: overflow in relational operation |
| 5 | PR20060928-17 | Components of DD struct variables may get incorrectly merged... |
| 6 | PR20061030-09 | Wrong code for a relational operation in Stateflow |
| 7 | PR20070320-01 | TL InPort or BusInport on root level may cause downsampling of data |
| 8 | PR20070704-01 | Wrong code is generated for a Rate Limiter block if the product of ... |
| 9 | PR20070914-06 | Wrong code for an Enabled, Triggered and Enabled or Action triggered ... |
| 10 | PR20080125-07 | Wrong code generated for While Iterator block |
| 11 | PR20080214-11 | Erroneous elimination of unscaled SF relational opperation |
| 12 | PR20080215-03 | Interface variable of incremental subsystem may be eleminated in ... |
MAAB
The MathWorks Automotive Advisory Board (MAAB) published the latest version of the "CONTROLLER STYLE GUIDELINES FOR PRODUCTION INTENT USING MATLAB®, Simulink® and Stateflow® Version 2.0" in July 2007. The guideline address style guidelines and best practices for the use of Simulink and Stateflow in the context of automotive embedded software modeling and code generation.
Download list of MAAB checks in MXAM
MAAB Checks in MXAM
| No. | ID | Guideline Title | Repair |
|---|---|---|---|
| 1 | jc_0201 | Usable characters for Subsystem names | yes |
| 2 | jc_0211 | Usable characters for Inport block and Outport block | yes |
| 3 | jc_0221 | Usable characters for signal line name | yes |
| 4 | jc_0231 | Usable characters for block names | yes |
| 5 | jc_0011 | Optimization parameters for Boolean data types | yes |
| 6 | jc_0021 | Model diagnostic settings | |
| 7 | na_0004 | Simulink model appearance | yes |
| 8 | db_0043 | Simulink font and font size | |
| 9 | db_0042 | Port block in Simulink models | yes |
| 10 | jc_0081 | Icon display for Port block | yes |
| 11 | db_0142 | Position of block names | |
| 12 | jc_0061 | Display of block names | yes |
| 13 | jm_0013 | Annotations | yes |
| 14 | db_0032 | Simulink signal appearance | |
| 15 | jc_0281 | Naming of Trigger Port block and Enable Port block | yes |
| 16 | jm_0010 | Port block names in Simulink models | partial |
| 17 | na_0008 | Display of labels on signals | yes |
| 18 | db_0081 | Unconnected Ports and Signals | |
| 19 | jm_0001 | Prohibited Simulink standard blocks inside controllers | |
| 20 | hd_0001 | Prohibited Simulink sinks | |
| 21 | na_0011 | Scope of Goto and From blocks | yes |
| 22 | jc_0141 | Use of the switch block | |
| 23 | jc_0121 | Use of the Sum Block | yes |
| 24 | jc_0131 | Use of Relational Operator block | |
| 25 | jc_0111 | Direction of Subsystem | yes |
| 26 | db_0123 | The name of a Stateflow input/output is the same as the corresponding signal | |
| 27 | db_0129 | Stateflow transition appearance | |
| 28 | db_0122 | Stateflow/Simulink interface signals and parameters | yes |








