Documentation

Configuration Settings

hisl_0060: Configuration parameters that improve MISRA C:2012 compliance

ID: Titlehisl_0060: Configuration parameters that improve MISRA C:2012 compliance
DescriptionTo improve MISRA C:2012 compliance of the generated code,

Set the following model configuration parameters as specified:

Configuration ParameterValue
Optimization > Simulation and code generation:  
Use division for fixed-point net slope computationon or Use division for reciprocals of integers only
Optimization > Signals and Parameters > Code generation: 
Bitfield declarator type specifier

uint_T if any of the following Optimization parameters are enabled:

  • Optimization > Signals and Parameters > Code Generation > Pack Boolean data into bitfields

  • Optimization > Stateflow > Code Generation > Use bitsets for storing state configuration

  • Optimization > Stateflow > Code Generation > Use bitsets for storing Boolean data

Diagnostics: 
Model Verification block enablingDisable all
Diagnostics > Data Validity > Signals: 
Wrap on overflowwarning or error
Inf or NaN block outputwarning or error
Hardware Implementation > Device details: 
Production hardware signed integer division rounds toZero or Floor
Simulation Target: 
Dynamic memory allocation in MATLAB Function blocksCleared (off)
Code Generation > Target selection: 
System target fileERT-based target
Code Generation > Symbols > Auto-generated identifier naming rules:  
Maximum identifier lengthThis should be set to the implementation dependent limit. The default is 31.
System-generated identifiersShortened
Code Generation > Interface > Software environment:  
Code replacement libraryNone or AUTOSAR 4.0
Shared code placementShared location
Support non-finite numbersCleared (off)
Support complex numbersCleared (off) if you do not need complex number support
Support continuous timeCleared (off)
Code Generation > Code Style > Code Style: 
Parentheses levelMaximum (Specify precedence with parentheses)
Replace multiplications by powers of two with signed bitwise shiftsCleared (off)
Casting modesStandards Compliant
Code Generation: 
Generate shared constantsCleared (off)
Mat-file loggingCleared (off)
Standard math libraryC89/C90 (ANSI) or C99 (ISO) depending on toolchain
Support non-inlined S-functionsCleared (off)
Use dynamic memory allocation for model initialization

Cleared (off)

Select only when Code Generation > Interface > Code Interface > Code Interface Packaging is set to Reusable Function.

ERTFilePackagingFormat is set to Modular.

Use get_param to set ERTFilePackagingFormat to CompactWithDataFile or Compact.

If you click Modify to automatically fix the parameter setting, the value is set to Compact.

PreserveStaticInFcnDecls is set to off.

Use get_param to set PreserveStaticInFcnDecls to on.

To set this value, ERTFilePackagingFormat must be set to CompactWithDataFile or Compact.

RationaleImprove MISRA C:2012 compliance of the generated code.
Model Advisor Checks
  • By Task > Modeling Guidelines for MISRA C:2012 > Check configuration parameters for MISRA C:2012 compliance

  • By Task > Modeling Standards for DO-178C/DO-331 > High-Integrity Systems > Code > Check configuration parameters for MISRA C:2012 compliance

  • By Task > Modeling Standards for IEC 61508 > High-Integrity Systems > Code > Check configuration parameters for MISRA C:2012 compliance

  • By Task > Modeling Standards for IEC 62304 > High-Integrity Systems > Code > Check configuration parameters for MISRA C:2012 compliance

  • By Task > Modeling Standards for EN 50128 > High-Integrity Systems > Code > Check configuration parameters for MISRA C:2012 compliance

  • By Task > Modeling Standards for ISO 26262 > High-Integrity Systems > Code > Check configuration parameters for MISRA C:2012 compliance

For Modeling Guidelines for MISRA C:2012, see Check configuration parameters for MISRA C:2012

For DO-178C/DO-331 check details, see Check configuration parameters for MISRA C:2012.

For IEC 61508, IEC 62304, EN 50128, and ISO 26262 check details, see Check configuration parameters for MISRA C:2012.

References
  • MISRA C:2012

Last ChangedR2017b
Was this topic helpful?