Main Content

Set Up PIL Connectivity by Using target Package

Before you can run processor-in-the-loop (PIL) simulations, you must set up connectivity between Simulink® and your target hardware. The connectivity enables the PIL simulation to:

  • Build the target application.

  • Download, start, and stop the application on the target hardware.

  • Support communication between Simulink and the target hardware.

Use one of these workflows.

WorkflowWhen to use
target package with rtiostream API

Use this workflow if your target application has large I/O requirements that need high-bandwidth communication.

For more information, see Use rtiostream API for PIL Target Connectivity.

target package with debugger

Use this workflow if:

  • You want a single debugger integration to provide PIL connectivity for target hardware systems that are supported by the debugger. This workflow requires little or no target-specific code.

  • The I/O requirements of the target application are small. For example, unit tests on a component. If you use this workflow for a target application that has large I/O requirements, the execution of the application is slower.

For more information, see Use Debugger for PIL Target Connectivity.

Use rtiostream API for PIL Target Connectivity

To provide PIL connectivity between Simulink and the target hardware, you can use the target Package with the rtiostream API. In this example, your development computer is the target hardware.

  1.  Create the board description

  2.  Associate the board with a processor

  3.  Specify execution information for the target hardware

  4.  Create the communication interface for the target hardware

  5.  Specify PIL protocol information

  6.  Add profiling timer

  7.  Specify connection between development computer and target hardware

  8.  Make board and connection objects persist across MATLAB sessions

  9.  Specify board for model

Use Debugger for PIL Target Connectivity

To provide PIL connectivity between Simulink and the target hardware, you can use the target Package with a debugger, for example, the GNU® Debugger.

  1.  Implement the target.DebugIOTool debugger abstraction interface

  2.  Create the board description

  3.  Associate the board with a processor

  4.  Describe the debugger execution service implementation

  5.  Associate debugger execution service with the board

  6.  Make board object persist across MATLAB sessions

  7.  Specify board for model

DebugIOTool Template

This section provides a pseudocode example of target.DebugIOTool debugger abstraction. Use a target.DebugIOTool object to:

  • Control the lifetime of an application running in the debugger.

  • Automate common debugger actions. For example, applying breakpoints and continuing execution from a paused state.

  • Read and write to memory that the application uses.

For interactions with the debugger, you can use MATLAB external language interfaces to APIs, which the debugger vendor supplies.

 target.DebugIOTool debugger abstraction example

See Also

Related Topics