To support code generation, associate the board with a
target.Processor object that contains a language
implementation. For this example, create a
target.Processor object and reuse an existing
target.LanguageImplementation object. For information
about setting up a custom target.LanguageImplementation
object, see Register New Hardware Devices.
Create an object that contains details about executing the target
application. The object describes the tool that is required to run the
target application on the target hardware. To capture system commands for
starting and stopping the target application, you can use the
SystemCommandExecutionTool class .
Create a Command object for downloading and running the
target application. Assign the string variable '$(EXE)'
to the String property as a place holder for the target
application name, which is not known until execution.
This step is optional. A PIL simulation uses a communication protocol for
the transfer of data between Simulink and the target hardware. The target.PILProtocol class describes the parameters of the
protocol. For this example, you can improve target run-time performance by
increasing the I/O buffer size that the protocol uses.
Create a target.PILProtocol object and specify I/O
You can configure a PIL simulation to produce execution-time profiles for
the generated code. To support code execution profiling, you must create a
timer object that describes the retrieval of current time from generated
code running on the target hardware. The timer object description must
include a description of the function that retrieves time and its
This example uses a C function, timestamp_x86, which
returns the current time as a uint64 data type.
The previous steps created target hardware support for communications and
running the target application. Now, set up a connection between your
development computer and the target hardware by creating a
TargetConnection object. Specify:
The communication channel, which is the same channel specified
in the target hardware communication interface –– see step
The connection properties.
The target, which is the board description specified in
To register the connectivity in MATLAB, use the target.add function to add the target hardware and
connection information to MATLAB memory. By default, the information is only available for the
current MATLAB session. To make the registration persist across MATLAB sessions, specify the name-value pair 'UserInstall',
You can now specify your development computer as the target hardware for
PIL simulations. Before you run a PIL simulation, in the Configuration
Parameters dialog box, set Hardware board to
Example Intel Board.