gradient

MISRA AC TargetLink

Die Motor Industry Software Reliability Association, MISRA hat für dSPACE TargetLink als ersten Seriencode-Generator offizielle MISRA-Modellierungsrichtlinien veröffentlicht: "Modelling style guidelines for the application of TargetLink in the contect of code generation". Die Richtlinien enthalten Vorgaben zur Modellierung in TargetLink unter dem Aspekt der funktionalen Sicherheit, wie sie insbesondere in sicherheitskritischen Projekten relevant sind.

Der Model Examiner ist der erste Richtlinien-Checker, der alle statisch überprüfbaren MISRA AC TL Regeln umfasst.

Download list of MISRA AC TargetLink checks in MXAM

 

Die MISRA-TargetLink-Modellierungsrichtlinien können über die offizielle MISRA-Website www.misra.org.uk bezogen werden.

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

Die von der Firma dSPACE veröffentlichten "Richtlinien für die Modellierung von MATLAB / Simulink / Stateflow und TargetLink" postulieren best practices für die Modellierung mit TargetLink. Um einen transparenten Modellierungsstil sowie hocheffizienten und korrekten Code zu gewährleisten, sind sie unumgänglich.

 

Inhalt der Modellierungsrichtlinien

Die TargetLink-Modellierungsrichtlinien umfassen rund 150 Regeln zu folgenden Aspekten:

- Transparentes Reglerlayout

Analog zu Codierrichtlinien werden auch auf Modellebene Regeln postuliert, die die Transparenz und Lesbarkeit von Modellen erhöhen.

- Geeignete Sprachuntermenge

Es wird eine Untermenge der in MATLAB/Simulink/Stateflow verfügbaren Sprachelemente definiert, die eine optimale Umsetzung der entwickelten Modelle mit Hilfe von TargetLink ermöglicht.

- Optimaler Festkomma-Code

Neben den in TargetLink bereits integrierten Hilfsmitteln wie Autoskalierung, dienen die Regeln als Leitfaden zur Umsetzung von Modellen in hocheffizienten Festkomma-Code.

- Code-Generator-Optionen

Es werden Optimierungseinstellungen für das Handling von Variablen und Funktionen beschrieben, um effizienten Code zu erzeugen.

- MISRA-Konformität

Es werden Regeln formuliert, die eine maximale Konformität des generierten Codes mit MISRA C gewährleisten.

 

Der Model Examiner konzentriert sich besonders auf die Anwendung eines sicheren Sprachumfangs für die Codegenerierung mit TargetLink.

 

Download: Liste der 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

Die Firma dSPACE aktualisiert ständig die bekannten Limitierungen für den TargetLink Codegnenerator in ihrem Known Problems Report. Dieser führt bekannte Einschränkungen im Rahmen der Entwicklung mit TargetLink auf, zeigt mögliche Abhilfen und Workarounds.

Der Model Examiner konzentriert sich besonders auf die Modellmuster von TargetLink, die bei der Codegenerierung zu unerwünschtem Verhalten im Code führen können und für die TargetLink keine Warnungen erzeugt.

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

Das MathWorks Automotive Advisory Board, MAAB, veröffentlichte die Version des "CONTROLLER STYLE GUIDELINES FOR PRODUCTION INTENT USING MATLAB®, Simulink® and Stateflow® Version 2.1" im Juli 2007. Die MAAB Richtlinien fokussieren sich insbesondere auf die Modellierung von regelungstechnisch geprägten Simulink- und Stateflow-Modellen, aus denen Code erzeugt werden soll. Im Schwerpunkt adressieren die MAAB Richtlinien die Lesbarkeit, Wartbarkeit und Portierbarkeit der Modelle. Neben diesen Aspekten werden auch bewährte Konfigurationen und Design-Pattern für die Modellierung vorgeschlagen.

Download: Liste der 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