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 typedefsUse coder typedefsThe 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_Tcorresponds to the Simulink typesingle.This option is selected if you open:
A GRT-based model and change System target file from
grt.tlctoert.tlc.A model that was last saved by using R2022b or an earlier release.
Use C data types with fixed-width integersThe generated code uses data types from the C99 language standard, which includes definitions from
stdint.handstdbool.h.Selecting this option enables the Coder typedefs compatibility (
CoderTypedefsCompatibility) check box. By default, the code generator does not creatertwtypes.hbecause the generated code does not require definitions fromrtwtypes.h. The filertwtypes.his generated in some cases because it might be needed by static source code located undermatlabroot. If you use custom code that requires Simulink Coder data type definitions, you can force the generation ofrtwtypes.hby 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