Which is the best way to replace the typedefs of rtwtypes.h with the ones defined in my firmware?

조회 수: 9 (최근 30일)
I want to use the typedefs that I defined in my firmware. I see that it is possible to use the Data Type Replacement in the Model configuration. Doing this way I only change the names in the rtwtypes.h. Then, after I changed the names with the ones from the firmware, I need to change manually the includes. I need to include the .h file from my firmware and to remove the rtwtypes.h. Am I right?
Is there any way more clean? A way that doesn't rely on manual modifications after the code generation procedure? Can you give me some hints on where find examples and documentation?
  댓글 수: 1
Bogdan Bodnarescu
Bogdan Bodnarescu 2022년 1월 25일
You can import the .h file that is defining the types in your firmware as a Datatype in the Model Workspace or a Simulink Data Dictionary.
Then when you use the Datatype Replacement inside rtwtypes.h you will have an include to that file.
I suppose you still have to copy rtwtypes.h with the files that you are compiling and then the compilation should work.

댓글을 달려면 로그인하십시오.

답변 (1개)

Life is Wonderful
Life is Wonderful 2021년 10월 14일
편집: Life is Wonderful 2021년 10월 14일
You can have one of the following approach to get rid of rtwtypes.h
  • Use standard ANSI complaint #include <stdint.h> and #include <stdtype.h>, based on your requirement
  • You can define in enable custom data type tab during code generation Like uint8 to uint8_t
  • You can import custom types as well for your project
Example

카테고리

Help CenterFile Exchange에서 Simulink Coder에 대해 자세히 알아보기

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by