Hello haoxue1027@qq.com,
The Stateflow that you are mentioning in the question is located in the main model. A function call is triggering the Speed_Measure subsystem that contains the Stateflow code. So you are expecting like the code to be executed every infinite loop iteration that is running up at 200MHz, right?

Well, the Simulink generates the code in a different way than you are expecting. Let me explain. Simulink is a time-driven environment, which means that the code from the main model (obviously with the subsystem called from there) will be executed at the specific time interval. For now, the model time execution is computed automatically by the Simulink. To specify the time interval, you have to go to the Model Settings, Solver, and there set the interval in seconds.

For the embedded target, Simulink generates three main functions (you can see this in the generated code):
- Initialize function - this function is called only once and here the clocks and all the required peripherals are initialized
- Step function - basically this is the function where all the code goes (obviously, without the interrupts routines which have to be treated asynchronously). This Step function is triggered at the period mentioned in the Model Settings (specified or automatically set) by a board timer ( in our case is the PIT 0).
- Terminate function - not used.
So the model will not generate any code in the main loop function.
If you need to trigger s-functions (like the one mentioned in your question) at different timebase than the one for the step function, you can use other PIT timers to generates interrupts faster or not for the code required.
Obviously, you can also change the entire Model Sample Time as required.
I hope this helps you to understand why the model is not running as expected.
Hope this helps,
Marius