Data type replacement
Method for replacing built-in data type names in generated code
Since R2023a
Model Configuration Pane: Code Generation / Data Type Replacement
Description
The Data type replacement parameter specifies the method for replacing Simulink® data types in generated code.
Settings
Use C data types with fixed-width integers
| Use coder typedefs
Use coder typedefs
The code generator creates the header file
rtwtypes.h
, which specifies Simulink Coder™ data types that are based on the C89 language standard. The generated code uses Simulink Coder data types for scalar and array variables. For example, the Simulink Coder typereal32_T
corresponds to the Simulink typesingle
.This option is selected if you open:
A GRT-based model and change System target file from
grt.tlc
toert.tlc
.A model that was last saved by using R2022b or an earlier release.
Use C data types with fixed-width integers
The generated code uses data types from the C99 language standard, which includes definitions from
stdint.h
andstdbool.h
.Selecting this option enables the Coder typedefs compatibility (
CoderTypedefsCompatibility
) check box. By default, the code generator does not creatertwtypes.h
because the generated code does not require definitions fromrtwtypes.h
. If you use custom code that requires Simulink Coder data type definitions, you can force the generation ofrtwtypes.h
by selecting the Coder typedefs compatibility check box.This option is selected if:
You open an Embedded Coder® template model.
For the Shared coder dictionary (
EmbeddedCoderDictionary
) configuration parameter, you specify a file that contains a service interface configuration.
Recommended Settings
Application | Setting |
---|---|
Debugging | No impact |
Traceability | No impact |
Efficiency | No impact |
Safety precaution | Use C data types with fixed-width integers improves compliance
with MISRA C™ and MISRA™ C++ standards. |
Programmatic Use
Parameter: DataTypeReplacement |
Type: character vector |
Value: 'CoderTypedefs' | 'CDataTypesFixedWidth' |
Version History
Introduced in R2023a