Using C99 types instead of rtwtypes with Embedded Coder

조회 수: 12 (최근 30일)
Felix Van Oost
Felix Van Oost 2022년 3월 24일
답변: Paras Gupta 2024년 1월 29일
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.

답변 (1개)

Paras Gupta
Paras Gupta 2024년 1월 29일
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.

카테고리

Help CenterFile Exchange에서 Deployment, Integration, and Supported Hardware에 대해 자세히 알아보기

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by