Borrar filtros
Borrar filtros

Enumeration Code Generation with Embedded Coder (autosar.tlc)

37 visualizaciones (últimos 30 días)
Yu Zhao
Yu Zhao el 3 de Jul. de 2018
Comentada: Arian el 11 de Sept. de 2022
does anyone have a clue what causes the following error message and how I can overcome this problem? I have a Simulink model that uses the enumeration defined in "State_Car.m"
classdef State_Car < Simulink.IntEnumType
The error message I get during build process is:
### Build procedure for model: 'swc_heat_2017b' aborted due to an error.
The header file of the enumerated type State_Car, should be set to Rte_Type.h. To fix this error, update the getHeaderFile method of the enumeration type to return Rte_Type.h

Respuesta aceptada

Lucas Lebert
Lucas Lebert el 5 de Jul. de 2018
Editada: Lucas Lebert el 20 de Ag. de 2020
Hi Yu Zhao!
As per the AUTOSAR standard, all data types must have a definition generated in Rte_type.h. This is the reason for the error and it is not possible to use a different header when doing AUTOSAR code generation.
For data types used solely inside of a SWC (not in the definition of a port) you only need to specify the header file as Rte_type.h only if you want the data type to be exported as an IncludedDataTypeSet.
Here's a small example for the implementation of the getHeaderFile method:
classdef State_Car < Simulink.IntEnumType
methods (Static = true)
function retVal = getHeaderFile()
retVal = 'Rte_Type.h';
Have a great day!
  7 comentarios
Hailin Ren
Hailin Ren el 9 de Dic. de 2020
I will take this feedback to my colleagues to be considered as an enhancement.
Arian el 11 de Sept. de 2022
I have added this method to my enumeration type but the Simulink could not compile the model for simulation ( after Ctrl + D).

Iniciar sesión para comentar.

Más respuestas (2)

Manuel Stumpf
Manuel Stumpf el 16 de Jul. de 2018
It looks like I have a similar problem: Is it possible to use a RTE data type inside a referenced subsystem (e.g. in state flow)? I want to use the same data types inside of referenced subsystems and the external interface of my SWC. Right now I keep getting error messages like above.
Regards, Manuel
  2 comentarios
Lucas Lebert
Lucas Lebert el 16 de Jul. de 2018
Hi, Manuel!
I would need to have a closer look at this. Could you please submit a help request to so I or one of my colleagues can have a look at this?
Thanks! ~Lucas
Manuel Stumpf
Manuel Stumpf el 16 de Jul. de 2018
Thanks Lucas,
your answer to Yu's question gave me the hint that I needed. Code generation for Autosar is successful now! Thanks again, Manuel

Iniciar sesión para comentar.

Zhenwei Sun
Zhenwei Sun el 11 de Sept. de 2018
hi, i'm with same issues. i don't need the data def in "Rte_Types.h" due to this class is only for my SWC used. anyone have fix this problem?
  1 comentario
Tarun Jhamnani
Tarun Jhamnani el 31 de Ag. de 2020
classdef (Enumeration) EnColor < uint8
Red (0)
Green (1)
Blue (2)
methods (Static = true)
function retValue = getDefaultValue()
retValue = EnColor.Red;
Define enum as above, you can change the base data type as you like. Secondly, What Lucas recommended setting.
Generated code will be something like below :
typedef uint8_T EnColor;
#define Red ((EnColor)0)
#define Green ((EnColor)1)
#define Blue ((EnColor)2)

Iniciar sesión para comentar.




Community Treasure Hunt

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

Start Hunting!

Translated by