Main Content

Model Advisor Checks for MISRA C:2012 Coding Standards

To check the likelihood that your model or subsystem can generate MISRA C:2012 compliant code, open the Model Advisor and run the checks in By Task > Modeling Standards for MISRA C:2012.

Execution of the below checks requires both Embedded Coder® and Simulink® Check™.

Model Advisor CheckCheck ID
Check configuration parameters for MISRA C:2012mathworks.misra.CodeGenSettings
Check for blocks not recommended for C/C++ production code deploymentmathworks.codegen.PCGSupport
Check for blocks not recommended for MISRA C:2012mathworks.misra.BlkSupport
Check for unsupported block namesmathworks.misra.BlockNames
Check usage of Assignment blocksmathworks.misra.AssignmentBlocks
Check for switch case expressions without a default casemathworks.misra.SwitchDefault
Check for missing error ports for AUTOSAR receiver interfacesmathworks.misra.AutosarReceiverInterface
Check for bitwise operations on signed integersmathworks.misra.CompliantCGIRConstructions
Check for recursive function callsmathworks.misra.RecursionCompliance
Check for equality and inequality operations on floating-point valuesmathworks.misra.CompareFloatEquality
Check for missing const qualifiers in model functionsmathworks.misra.ModelFunctionInterface
Check integer word lengthsmathworks.misra.IntegerWordLengths

Check bus object names that are used as bus element names

mathworks.misra.BusElementNames
Check for variant blocks that do not have a default choicemathworks.misra.DefaultChoiceVariantChecks

To access the High-Integrity checks supported by the MISRA C:2012 standards, go to By Task > Modeling Standards for MISRA C:2012 > High-Integrity Systems folder.

Note

The High-Integrity modeling guidelines are intended to provide compliance with selected aspects of MISRA C:2012 modeling.

Furthermore, the High-Integrity Systems include sub-folders that contain High-Integrity checks based on their functionality, listed as follows:

By Task > Modeling Standards for MISRA C:2012 > High-Integrity Systems > Configuration

By Task > Modeling Standards for MISRA C:2012 > High-Integrity Systems > MATLAB

Model Advisor CheckCheck IDHigh-Integrity System Modeling Guidelines
Check switch statements in MATLAB Function blocksmathworks.hism.himl_0007himl_0007: MATLAB code switch / case / otherwise patterns

By Task > Modeling Standards for MISRA C:2012 > High-Integrity Systems > Naming

Model Advisor CheckCheck IDHigh-Integrity System Modeling Guidelines
Check model object namesmathworks.hism.hisl_0032hisl_0032: Model element names

By Task > Modeling Standards for MISRA C:2012 > High-Integrity Systems > Simulink

Model Advisor CheckCheck IDHigh-Integrity System Modeling Guidelines
Check usage of Abs blocksmathworks.hism.hisl_0001hisl_0001: Usage of Abs block
Check usage of square root operationsmathworks.hism.hisl_0003hisl_0003: Usage of square root operations
Check usage of While Iterator blocksmathworks.hism.hisl_0006hisl_0006: Usage of While Iterator blocks
Check usage of For and While Iterator subsystemsmathworks.hism.hisl_0007hisl_0007: Usage of For Iterator or While Iterator subsystems
Check usage of For Iterator blocksmathworks.hism.hisl_0008hisl_0008: Usage of For Iterator Blocks
Check usage of If blocks and If Action Subsystem blocksmathworks.hism.hisl_0010hisl_0010: Usage of If blocks and If Action Subsystem blocks
Check usage of Switch Case blocks and Switch Case Action Subsystem blocksmathworks.hism.hisl_0011hisl_0011: Usage of Switch Case blocks and Action Subsystem blocks
Check usage of Relational Operator blocksmathworks.hism.hisl_0017hisl_0017: Usage of blocks that compute relational operators (2)
Check usage of Logical Operator blocksmathworks.hism.hisl_0018hisl_0018: Usage of Logical Operator block
Check usage of bit operation blocksmathworks.hism.hisl_0019hisl_0019: Usage of bitwise operations
Check for blocks not recommended for C/C++ production code deploymentmathworks.hism.hisl_0020hisl_0020: Blocks not recommended for MISRA C:2012 compliance
Check usage of Reciprocal Sqrt blocksmathworks.hism.hisl_0028hisl_0028: Usage of Reciprocal Square Root blocks
Check usage of Assignment blocksmathworks.hism.hisl_0029hisl_0029: Usage of Assignment blocks
Check usage of Signal Routing blocksmathworks.hism.hisl_0034hisl_0034: Usage of Signal Routing blocks
Check global variables in graphical functionsmathworks.hism.hisl_0062hisl_0062: Global variables in graphical functions
Check for length of user-defined object namesmathworks.hism.hisl_0063hisl_0063: Length of user-defined object names to improve MISRA C:2012 compliance
Check for divide-by-zero calculationsmathworks.hism.hisl_0067hisl_0067: Protect against divide-by-zero calculations
Check usage of bit-shift operationsmathworks.hism.hisl_0073hisl_0073: Usage of bit-shift operations
Check safety-related diagnostic settings for variantsmathworks.hism.hisl_0074hisl_0074: Configuration Parameters > Diagnostics > Modeling issues related to variants
Check for dead logicmathworks.hism.hisl_0101hisl_0101: Prevent operations that result in dead logic to improve code compliance
Check data type of loop control variablesmathworks.hism.hisl_0102hisl_0102: Data type of loop control variables to improve MISRA C:2012 compliance
Check usage of remainder and reciprocal operationsmathworks.sldv.hism.hisl_0002hisl_0002: Usage of remainder and reciprocal operations
Check usage of log and log10 operationsmathworks.sldv.hism.hisl_0004hisl_0004: Usage of natural logarithm and base 10 logarithm operations

By Task > Modeling Standards for MISRA C:2012 > High-Integrity Systems > Stateflow