MATLAB: Does the Simulink Coder ignore the ‘remove zero initialization’ options, when the model for which code is generated contains a stateflow chart with Bus variables

Embedded Coder

I am using Simulink to generate C code that is part a framework. The Simulink section includes a Stateflow Chart, and it sends and recieves variables to and from the framework via buses (that end up as structures in C).
I am running into trouble because the Stateflow section of code initializes all the variables defined in the buses. It does this even when I check the optimization options: 'remove root I/O level zero initialization' and 'remove internal data zero intialization'.
Because of this, variables stored to nonvolatile memory on the microchip via the framework are overwriten by the initialized Simulink variables, as if they were updated.
Is there a way I can stop the generation of C code that initializes variables created by the Simulink code?

Best Answer

This is a known limitation with the Embedded Coder 6.3 (in R2012b).
The initialization code for the chart's buses is coupled with other important data. Therefore, the Coder does not remove zero initializations for charts containing Bus variables.
The workaround is to manually remove the unneeded initialization code from the generated code.