Main Content

Code Generation of Software Tasks

A Simulink® model containing a Task Manager block simulates task execution. When a model gets deployed to an SoC hardware board, the SoC Blockset™ automatically creates and assigns the tasks to threads, links interrupts, messages, and system events to the generated code of the model.

Timer-Driven Tasks

An SoC Blockset model, when implemented onto hardware as generated and compiled code, uses an operating system (OS) timer to drive the base-rate time step of the model. All time based signals derive their time steps, known as sub-rates, from the base-rate time step of the model. A timer-driven task, created from the Task Manager block, uses a counter that increments at each base-rate timer step. When the counter reaches an integer multiple of the base-rate, the generated code posts to the semaphore associated with that task. Posting to the semaphore unblocks the thread and executes the task.

Event-Driven Task

Each event-driven task created from the Task Manager block gets a unique semaphore. A unique event elsewhere in the system posts to that semaphore and puts the task thread into the running state. OS kernel handles the management of the task thread until it returns to the waiting state.

See Also

|

Related Topics