Contents

Configuration Settings

hisl_0060: Configuration parameters that improve MISRA-C:2004 compliance

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

Set the following model configuration parameters as specified:

Pane / Configuration ParameterValue
Diagnostics > Data Validity 
   Model Verification block enablingDisable All
Code Generation pane 
   System target fileERT-based target
Code Generation > Interface pane 
   Support: non-finite numbersCleared (off)
   Support: continuous timeCleared (off)
   Support: non-inlined S-functionsCleared (off)
   MAT-file loggingCleared (off)
   Standard math libraryC89/C90 (ANSI)
   Code replacement libraryNone
Code Generation > Code Style pane 
   Parenthesis levelMaximum (Specify precedence with parentheses)
Code Generation > Symbols pane 
   Maximum identifier length31

Note

If you follow this and other modeling guidelines, you increase the likelihood of generating code that complies with the MISRA-C:2004 standard.

RationaleAImprove MISRA-C:2004 compliance of the generated code.
Model Advisor Checks

By Product > Embedded Coder > Check configuration parameters for MISRA-C:2004 compliance

References
  • MISRA-C:2004

Last ChangedR2011a

hisl_0312: Specify target specific configuration parameters to improve MISRA-C:2004 compliance

ID: Titlehisl_0312: Specify target specific configuration parameters to improve MISRA-C:2004 compliance
DescriptionTo improve MISRA-C:2004 compliance of generated code, use a consistent set of model parameters. The parameters include, but are not limited to:
AExplicitly setting model character encoding using the slCharacterEncoding(encoding) function.
BIn the Configuration Parameters dialog box, explicitly selecting a Hardware Implementation > Production hardware > Signed integer division rounds to: parameter.
 
 
CIf complex numbers are not required, deselecting the Code Generation > Interface > Software Environment > complex numbers parameter. 
NotesBase the selection of the integer division method on the target hardware and compiler. When available, in the Configuration Parameters dialog box, specify both of these parameters:
  • Hardware Implementation > Production hardware > Device vendor

  • Hardware Implementation > Production hardware > Device type

 
RationaleImprove MISRA-C:2004 compliance of the generated code. 
See Also 
References
  • MISRA-C: 2004 Rule 3.2

  • MISRA-C: 2004 Rule 3.3

  • MISRA-C: 2004 Rule 5.7

 
Last ChangedR2012a 

hisl_0313: Selection of bitfield data types to improve MISRA-C:2004 compliance

ID: Titlehisl_0313: Selection of bitfield data types to improve MISRA-C:2004 compliance
DescriptionTo improve MISRA-C:2004 compliance of generated code when bitfields are used, in the Configuration Parameters dialog box, set Optimization > Signals and Parameters > Code generation > Bitfield declarator type specifier to uint_T.
RationaleImprove MISRA-C:2004 compliance of the generated code.
NotesSet Bitfield declarator type specifier to 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

See Also
References
  • MISRA-C: 2004 Rule 6.4

Last ChangedR2012a

Was this topic helpful?