Main Task – Partition and Flow of ControlThis section describes how the different generated modules are put together into a single thread, and what is the control flow of the main task. The whole execution starts with an initialization phase, where all components are initialized: the timer, the threads scheduler (if needed) and other tasks are created. In addition the user_init procedure is called and the debugger tables are initialized (if needed).
After initialization phase, the main-task starts processing in a cyclic manner, where every cycle corresponds to a single “go-step." In every cycle, all the concurrent state-machines are traversed, process their inputs and generate outputs, issue timing requests and take the necessary state transitions.
As mentioned before, the main program is actually the body of the main task that activates all the state machines. The pr_initialize is the initialization procedure, and pr_make_step completes a single-step of the whole system, including tasks execution.