Using C99 types instead of rtwtypes with Embedded Coder

12 views (last 30 days)
Is there a way to use the standard C99 types defined in stdint.h and stdbool.h instead of using the Simulink-generated types in rtwtypes.h when using Embedded Coder? It seems that the purpose of rtwtypes.h has been redundant since C99 introduced fixed-width integer types that the system can use natively.
I've tried to use the 'Data Type Replacement' feature to replace all the Simulink-generated types with the standard C99 ones so that the generated code uses those types directly, but the use of standard C types is not allowed.

Answers (1)

Paras Gupta
Paras Gupta on 29 Jan 2024
Hi Felix,
I understand that you want to use the C99 data types in the generated code in MATLAB R2021b.
The 'Replace data type names in the generated code' configuration parameter in the 'Data Type Replacement' feature in MATLAB R2021b allow you to specify whether to replace built-in data type names with user-defined data type names in generated code. Activating the option and filling in the data type names could achieve data types matching the C99 data types.
Please refer to the following archived documentation for more information on the same.
The other workaround to achieve this is to upgrade the MATLAB version to R2023a or later, and use the new 'Data Type Replacement' feature and selecting the option that uses data types from the C99 language standard. The section "Replacement of Simulink data types with C99 data types" under "Code Generation" in the following Release Notes for MATLAB R2023a highlight the updates and the relavant documentation links.
Hope this helps.

Categories

Find more on Deployment, Integration, and Supported Hardware in Help Center and File Exchange

Products


Release

R2021b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!