メインコンテンツ

このページの内容は最新ではありません。最新版の英語を参照するには、ここをクリックします。

MISRA C 標準への準拠を検証するためのモデリング ガイドラインとモデル アドバイザー チェック

MISRA C:2012 準拠の概要表で、MISRA C:2012 コーディング標準に対する生成された C コードの準拠に関連するモデリング ガイドラインが示されています。これらのガイドラインとそれに対応するモデル アドバイザー チェックのリストについては、MISRA C:2012 への準拠を検証するための高信頼性システムのモデリング ガイドラインとモデル アドバイザー チェックを参照してください。MISRA C:2012 モデル アドバイザー チェックの MISRA C:2012 Rule または Directive へのマッピングについては、MISRA C:2012 モデル アドバイザー チェックの根拠を参照してください。

MISRA C:2012 モデル アドバイザー チェックの根拠

次の表は、MISRA C:2012 モデル アドバイザー チェックの MISRA C:2012 に基づく根拠を示しています。

モデル アドバイザー チェックMISRA C:2012 Rule または Directive
MISRA C:2012 のコンフィギュレーション パラメーターをチェック
 [固定小数点の正味傾き計算に除算を使用][オン] または [整数の逆数の場合にのみ除算を使用] に設定します。

MISRA C:2012 Rule 10.1: Operands shall not be of an inappropriate essential type.

[Inf または NaN のブロックの出力][警告] または [エラー] に設定します。

MISRA C:2012 Directive 4.1: Run-time failures shall be minimized

[Model Verification ブロックを有効にする][すべて無効] に設定します。

General recommendation for embedded systems.

[指示のないイベント ブロードキャスト][エラー] に設定します。

MISRA C:2012 Rule 17.2: Functions shall not call themselves, either directly or indirectly

コンフィギュレーション パラメーター [オーバーフロー時にラップ][警告] または [エラー] に設定します。

MISRA C:2012 Directive 4.1: Run-time failures shall be minimized

[製品ハードウェアの符号付き整数の除算の丸め][ゼロ方向] または [負方向] に設定します。

MISRA C:2012 Rule 10.1: Operands shall not be of an inappropriate essential type.

[算術シフトとして符号付き整数を右にシフト] をオフにします。

MISRA C:2012 Rule 10.1: Operands shall not be of an inappropriate essential type.

[コンパイル時の MATLAB 関数の再帰限界値]0 に設定します。

MISRA C:2012 Rule 17.2: Functions shall not call themselves, either directly or indirectly

[MATLAB 関数での動的メモリ割り当て] をオフにします。

MISRA C:2012 Directive 4.12: Dynamic memory allocation shall not be used.

MISRA C:2012 Rule 21.3: The memory allocation and deallocation functions of <stdlib.h> shall not be used.

[MATLAB 関数の実行時再帰を有効にする] をオフにします。

MISRA C:2012 Rule 17.2: Functions shall not call themselves, either directly or indirectly

[ビットフィールド宣言子の型指定子]uint_T に設定します。

MISRA C:2012 Rule 6.1: Bit-fields shall only be declared with an appropriate type

MISRA C:2012 Rule 6.2: Single-bit named bit fields shall not be of a signed type

[キャスト モード][標準準拠] に設定します。

MISRA C:2012 Rules 10.x: The essential type model

[コード置換ライブラリ][なし] または [AUTOSAR 4.x] に設定します。

General recommendation for embedded systems.

[エクスターナル モード] をオフにします。

General recommendation for embedded systems.

MISRA C:2012 Directive 4.12: Dynamic memory allocation shall not be used

MISRA C:2012 Rule 21.3: The memory allocation and deallocation functions of <stdlib.h> shall not be used

MISRA C:2012 Rule 21.6: The Standard Library input/output functions shall not be used

[共有定数の生成] をオフにします。

MISRA Rule 8.5: An external object or function shall be declared once in one and only one file

[MAT ファイルのログ] をオフにします。

General recommendation for embedded systems.

[識別子の最大の長さ] を実装に応じた制限に設定します。既定の設定は 31 です。

MISRA C:2012 Rules 5.1-9: 識別子

[かっこのレベル][標準 (標準準拠のためのかっこ)] または [最大 (かっこで優先度を指定)] に設定します。

MISRA C:2012 Rule 12.1: The precedence of operators within expressions should be made explicit

[関数宣言に static キーワードを保持] を選択します。

MISRA Rule 8.7: Functions and objects should not be defined with external linkage if they are referenced in only one translation unit

MISRA Rule 8.8: The static storage class specifier shall be used in all declarations of objects and functions that have internal linkage

[2 のべき乗での乗算を符号付きのビット単位シフトに置換] をオフにします。MISRA C:2012 Rule 10.1: Operands shall not be of an inappropriate essential type

[共有コードの配置][共有場所] に設定します。

コンフィギュレーション パラメーター [共有定数の生成] の前提条件

[連続時間のサポート] をオフにします。

General recommendation for embedded systems.

[サポート: 非有限数] をオフにします。

MISRA C:2012 Directive 4.1: Run-time failures shall be minimized

[インラインでない S-Function のサポート] をオフにします。

General recommendation for embedded systems.

[システム生成の識別子][短縮形] に設定します。

MISRA C:2012 5.1: External identifiers shall be distinct

MISRA C:2012 5.2: Identifiers declared in the same scope and name space shall be distinct

MISRA C:2012 5.4: Macro identifiers shall be distinct

MISRA C:2012 5.5: Identifiers shall be distinct from macro names

[システム ターゲット ファイル] を ERT ベースのターゲットに設定します。

General recommendation for embedded systems.

[モデルの初期化に動的メモリ割り当てを使用] をオフにします。

[コード インターフェイスのパッケージ化][再利用可能な関数] に設定されている場合にのみ選択します。

MISRA C:2012 Directive 4.12: Dynamic memory allocation shall not be used.

MISRA C:2012 Rule 21.3: The memory allocation and deallocation functions of <stdlib.h> shall not be used.

EnableSignedLeftShifts – オフ

MISRA C:2012 Rule 10.1: Operands shall not be of an inappropriate essential type

C/C++ 量産コード展開に推奨されないブロックがないかチェック

General recommendation for embedded systems.

MISRA C:2012 で推奨されないブロックをチェック
 

3 次スプライン内挿法または外挿法を使用している Lookup Table ブロック。

具体的には以下のブロックです。

MISRA C:2012 Rule 11.3: A cast shall not be performed between a pointer to object type and a pointer to a different object type.

MISRA C:2012 Rule 11.5: A conversion should not be performed from pointer to void into pointer to object.

MISRA C:2012 Rule 11.8: A cast shall not remove any const or volatile qualification from the type pointed to by a pointer.

MISRA C:2012 Rule 11.9: The macro NULL shall be the only permitted form of integer null pointer constant.

MISRA C:2012 Rule 12.1: The precedence of operators within expressions should be made explicit.

推奨されない Lookup Table ブロック。

具体的には以下のブロックです。

  • Lookup Table

  • Lookup Table (2-D)

MISRA C:2012 Rule 11.3: A cast shall not be performed between a pointer to object type and a pointer to a different object type.

MISRA C:2012 Rule 11.5: A conversion should not be performed from pointer to void into pointer to object.

MISRA C:2012 Rule 11.8: A cast shall not remove any const or volatile qualification from the type pointed to by a pointer.

MISRA C:2012 Rule 11.9: The macro NULL shall be the only permitted form of integer null pointer constant.

MISRA C:2012 Rule 12.1: The precedence of operators within expressions should be made explicit.

MISRA C:2012 Rule 12.2: The right hand operand of a shift operator shall lie in the range zero to one less than the width in bits of the essential type of the left hand operand.

S-Function Builder ブロック

MISRA C:2012 Rule 8.4: A compatible declaration shall be visible when an object or function with external linkage is defined.

MISRA C:2012 Rule 8.5: An external object or function shall be declared once in one and only one file.

From Workspace ブロック

MISRA C:2012 Rule 18.4: The +, -, += and -= operators should not be applied to an expression of pointer type.

String ブロックがモデルまたはサブシステム内で見つかった。

具体的には以下のブロックです。

MISRA C:2012 Directive 4.7: If a function returns error information, then that error information shall be tested

MISRA C:2012 Rule 17.7: The value returned by a function having non-void return type shall be used

MISRA C:2012 Rule 21.6: The Standard Library input/output functions shall not be used

サポートされていないブロック名のチェック (Simulink Check)

MISRA C:2012 Rule 3.1: The character sequences /* and // shall not be used within a comment.

Assignment ブロックの使用をチェックMISRA C:2012 Rule 9.1: The value of an object with automatic storage duration shall not be read before it has been set.
default ケースをもたない switch case 式のチェックMISRA C:2012 Rule 16.4: Every switch statement shall have a default label.
AUTOSAR 受信側インターフェイスの欠落しているエラー ポートのチェック (Simulink Check)

MISRA C:2012 Directive 4.7: If a function returns error information, then that error information shall be tested.

MISRA C:2012 Rule 17.7: The value returned by a function having non-void return type shall be used.

符号付き整数のビット演算のチェックMISRA C:2012 Rule 10.1: Operands shall not be of an inappropriate essential type.
再帰関数の呼び出しのチェック (Simulink Check)MISRA C:2012 Rule 17.2: Functions shall not call themselves, either directly or indirectly.
浮動小数点値の等式演算と不等式演算のチェックMISRA C:2012 Directive 1.1: Any implementation-defined behaviour on which the output of the program depends shall be documented and understood.
モデル関数内の欠落している const 修飾子をチェック (Simulink Check)MISRA C:2012 Rule 8.13: A pointer should point to a const-qualified type whenever possible.
整数の語長をチェックMISRA C:2012 Rule 10.1: Operands shall not be of an inappropriate essential type.
バス要素の名前として使用されるバス オブジェクト名のチェック (Simulink Check)

MISRA C:2012 Rule 10.1: Operands shall not be of an inappropriate essential type.

MISRA C:2012 Rule 5.6: A typedef name shall be a unique identifier.

MISRA C:2012 への準拠を検証するための高信頼性システムのモデリング ガイドラインとモデル アドバイザー チェック

MathWorks Advisory Board (MAB) によって策定されたモデリング ガイドラインを補強するために、MathWorks® は、高信頼性アプリケーションに焦点を当てた一連のモデリング ガイドラインを公開しています。

高信頼性モデリング ガイドラインの多くには、モデルがガイドラインに準拠していることを検証するために使用できるモデル アドバイザー チェックが含まれています。次の表では、高信頼性モデリング ガイドラインを特定し、対応するモデル アドバイザー チェックを示します。すべてのモデリング ガイドラインに、対応するモデル アドバイザー チェックが含まれているわけではありません。

高信頼性ガイドラインモデル アドバイザー チェック
hisl_0001: Abs ブロックの使用法Check usage of Abs blocks (Simulink Check)
hisl_0002: 残余演算および逆数演算の使用Check usage of remainder and reciprocal operations (Simulink Check)
hisl_0005: Product ブロックの使用方法適用不可
hisl_0006: While Iterator ブロックの使用方法Check usage of While Iterator blocks (Simulink Check)
hisl_0008: For Iterator ブロックの使用方法Check usage of For Iterator blocks (Simulink Check)
hisl_0010: If ブロックと If Action Subsystem ブロックの使用方法Check usage of If blocks and If Action Subsystem blocks (Simulink Check)
hisl_0011: Switch Case ブロックと Action Subsystem ブロックの使用方法Check usage of Switch Case blocks and Switch Case Action Subsystem blocks (Simulink Check)
hisl_0016: 関係演算子を計算するブロックの使用方法Check relational comparisons on floating-point signals (Simulink Check)
hisl_0017: 関係演算子を計算するブロックの使用方法 (2)Check usage of Relational Operator blocks (Simulink Check)
hisl_0018: Logical Operator ブロックの使用方法Check usage of Logical Operator blocks (Simulink Check)
hisl_0019: ビット演算の使用方法Check usage of bit operation blocks (Simulink Check)
hisl_0020: MISRA C:2012 準拠で推奨されないブロック

Check for blocks not recommended for C/C++ production code deployment (Simulink Check)

MISRA C:2012 で推奨されないブロックをチェック

hisl_0029: Assignment ブロックの使用方法Check usage of Assignment blocks (Simulink Check)
hisl_0032: モデル オブジェクト名Check model object names (Simulink Check)
hisl_0045: [コンフィギュレーション パラメーター]、[数学とデータ型]、[boolean データ (対 double) として論理信号を処理]Check safety-related optimization settings for logic signals (Simulink Check)
hisl_0053: [コンフィギュレーション パラメーター]、[コード生成]、[最適化]、[範囲外の値をラップする浮動小数点から整数への変換コードを削除]Check safety-related optimization settings for data type conversions (Simulink Check)
hisl_0054: [コンフィギュレーション パラメーター]、[コード生成]、[最適化]、[除算演算の例外処理を防止するコードを削除]Check safety-related optimization settings for division arithmetic exceptions (Simulink Check)
hisl_0060: MISRA C:2012 準拠性を高めるコンフィギュレーション パラメーターMISRA C:2012 のコンフィギュレーション パラメーターをチェック
hisl_0061: 明確性のための一意の識別子Check Stateflow charts for uniquely defined data objects (Simulink Check)
hisl_0062: グラフィカル関数内のグローバル変数Check global variables in graphical functions (Simulink Check)
hisl_0063: MISRA C:2012 準拠性を高めるユーザー定義オブジェクト名の長さCheck for length of user-defined object names (Simulink Check)
hisl_0101: デッド ロジックが発生する演算を防止し、コード準拠性を高める適用不可
hisl_0102: MISRA C:2012 準拠性を高めるループ制御変数のデータ型Check data type of loop control variables (Simulink Check)
hisl_0314: [コンフィギュレーション パラメーター]、[診断]、[データ有効性]、[信号]Check safety-related diagnostic settings for signal data (Simulink Check)
hisf_0004: 再帰関数の呼び出しから保護してコードの準拠性を高める適用不可
hisf_0065: コード準拠性を高める Stateflow 型キャスト演算Check assignment operations in Stateflow Charts (Simulink Check)
hisf_0211: Stateflow チャートで単項演算子の使用を禁止してコード準拠性を高めるCheck Stateflow charts for unary operators (Simulink Check)

参考

|