simulink coder typedef struct naming related problem

5 次查看(过去 30 天)
Hi,
I have a Simulink generated code like below:
33 /* Macros for accessing real-time model data structure */
34
35 /* Block signals (auto storage) */
36 typedef struct {
37 int8_T inputevents[6]; /* '<S1>/Chart' */
38 } BlockIO;
39
40 /* Block states (auto storage) for system '<Root>' */
41 typedef struct {
42 int32_T sfEvent; /* '<S1>/Chart' */
43 uint8_T is_c1_Subsystem; /* '<S1>/Chart' */
44 } D_Work;
45
46 /* Zero-crossing (trigger) state */
47 typedef struct {
48 ZCSigState Chart_Trig_ZCE[6]; /* '<S1>/Chart' */
49 }
And I got an error when I try to compile it with a cross compiler(8051 microcontroller based) about struct size expectation thats related to naming. The compiler does not have any option to fix this error.
So, I have to change the generated code like this: (Naming is not important)
33 /* Macros for accessing real-time model data structure */
34
35 /* Block signals (auto storage) */
36 typedef struct BlockIO_tag{
37 int8_T inputevents[6]; /* '<S1>/Chart' */
38 } BlockIO;
39
40 /* Block states (auto storage) for system '<Root>' */
41 typedef struct D_Work_tag{
42 int32_T sfEvent; /* '<S1>/Chart' */
43 uint8_T is_c1_Subsystem; /* '<S1>/Chart' */
44 } D_Work;
45
46 /* Zero-crossing (trigger) state */
47 typedef struct ZCSigState_struct{
48 ZCSigState Chart_Trig_ZCE[6]; /* '<S1>/Chart' */
49 } ZCSigState_type;
How can I generate the code with the format like upper? (typedef struct's fully named)
I think older versions of Simulink(2002 - 2003) was generated the global types like this but not the newer versions(2008 or upper).
Regards, James

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Deployment, Integration, and Supported Hardware 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by