Why does the Stateflow Coder generate wrong code when the "Seperate arguments for input/out data" option is selected in Stateflow 4.1 (R12.1)?
If I select the "Seperate arguments for input/out data" option in Stateflow 4.1 (R12.1), Stateflow Coder will make the following chart.c function:
void chart(void) { { /* During: Chart */ if(chartInstance.State.is_active_chart == 0) { /* Entry: Chart */ chartInstance.State.is_active_chart = 1; /* Entry: a */ chartInstance.State.is_chart = IN_c1_s1_a; out = in; } } }
Now when I generate code on Stateflow 4.0, 4.0.1 or 4.0.2 (R12) with the following options:
* Uncheck the 'Pack input/output data into structures' option * Uncheck the 'Use global input/output data (no packing)' option(This is the same as the "Seperate arguments for input/out data" option in Stateflow 4.1).
Stateflow Coder will make the following code:
void chart(real_T in,real_T *sf_out_Ptr) { if(chartInstance.State.is_active_chart==0) { chartInstance.State.is_active_chart=1; chartInstance.State.is_chart=IN_c1_s1_a; out = in; } }
The generated code from Stateflow 4.1 (or 4.0.3 and 4.0.4) is not correct because the chart function has a "void" argument.
Best Answer