Failed to generate binary outputs when generating code for c2000 processor using s function builder block and simstruct.h

1 view (last 30 days)
Am getting these errors
"../ssfuntest_wrapper.c", line 85: warning: variable "tempX" was declared but never referenced
"../ssfuntest_wrapper.c", line 86: warning: variable "A" was declared but never referenced
"../ssfuntest_wrapper.c", line 87: error: expected a "}"
"../ssfuntest_wrapper.c", line 87: error: identifier "C" is undefined
"../ssfuntest_wrapper.c", line 87: error: identifier "L" is undefined
"../ssfuntest_wrapper.c", line 88: error: identifier "S" is undefined
"../ssfuntest_wrapper.c", line 90: warning: this declaration has no storage class or type specifier
"../ssfuntest_wrapper.c", line 90: error: identifier "A" is undefined
"../ssfuntest_wrapper.c", line 90: error: identifier "xD" is undefined
"../ssfuntest_wrapper.c", line 90: error: identifier "V" is undefined
"../ssfuntest_wrapper.c", line 90: error: expression must have a constant value
"../ssfuntest_wrapper.c", line 90: error: expression must have a constant value
"../ssfuntest_wrapper.c", line 91: warning: this declaration has no storage class or type specifier
"../ssfuntest_wrapper.c", line 91: error: variable "tempX" has already been initialized
"../ssfuntest_wrapper.c", line 91: error: expression must have a constant value
"../ssfuntest_wrapper.c", line 91: error: expression must have a constant value
"../ssfuntest_wrapper.c", line 92: warning: this declaration has no storage class or type specifier
"../ssfuntest_wrapper.c", line 92: error: expression must have a constant value
"../ssfuntest_wrapper.c", line 92: error: expression must have a constant value
"../ssfuntest_wrapper.c", line 93: warning: this declaration has no storage class or type specifier
"../ssfuntest_wrapper.c", line 93: error: variable "xD" has already been initialized
"../ssfuntest_wrapper.c", line 93: error: expression must have a constant value
"../ssfuntest_wrapper.c", line 93: error: expression must have a constant value
"../ssfuntest_wrapper.c", line 95: error: expected a declaration
18 errors detected in the compilation of "../ssfuntest_wrapper.c".
The code wrapper was generated automatically by the s-function builder block, and works fine in normal mode, when generating the code to run in external mode it returns these errors. This is the code.
71 void ssfuntest_Update_wrapper(const real_T *V,
72 real_T *Vc,
73 real_T *dVc,
74 real_T *xD,
75 const real_T *R, const int_T p_width0,
76 const real_T *L, const int_T p_width1,
77 const real_T *C, const int_T p_width2,
78 const real_T *I0, const int_T p_width3,
79 const real_T *Vc0, const int_T p_width4,
80 const int_T y_width,
81 const int_T u_width,
82 SimStruct *S)
83 {
84 /* %%%-SFUNWIZ_wrapper_Update_Changes_BEGIN --- EDIT HERE TO _END */
85 real_T tempX[2] = {0.0, 0.0};
86 real_T A[2][2]= {{0,1},{-1/(C[0]*L[0]),-R[0]/L[0]}};;
87 real_T B[2]={0,1/(C[0]*L[0])};
88 long double t = ssGetSampleTime(S, 0);
89
90 tempX[0]=(A[0][0]*xD[0]+A[0][1]*xD[1]+B[0]*V[0])*t;
91 tempX[1]=(A[1][0]*xD[0]+A[1][1]*xD[1]+B[1]*V[0])*t;
92 xD[0]=xD[0]+tempX[0];
93 xD[1]=xD[1]+tempX[1];
94 /* %%%-SFUNWIZ_wrapper_Update_Changes_END --- EDIT HERE TO _BEGIN */
95 }
I can't seem to find what's worng with it. I find it strange to have all the erros in the update method. This is a simple RLC circuit dynamic response function for test purposes.
Thank you in advance for any help.

Answers (0)

Products


Release

R2018a

Community Treasure Hunt

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

Start Hunting!