What Is a Target?
A target deploys MATLAB® and Simulink® designs to embedded hardware. With a target, you can prototype, verify, and deploy your application by generating processor-specific code, integrating real-time operating systems and device drivers, and profiling execution on your embedded hardware.
Hierarchy of Targets
You can develop a target by using an existing target. The existing target is then a reference target of the target being developed. This guide shows you how to develop a target using a MathWorks® reference target.
Targets support hardware at the processor or board level. A hardware board includes one or more processors, and perhaps external memory, I/O devices, and other electronic components.
The figure shows the relationship between:
A target and its reference target
A hardware board and the processor it includes
The target and hardware board they support
A target for a processor provides features that are related to the processor, such as assembly language optimizations. A target for a hardware board provides features related to the board, including its processor and any of its additional components, such as I/O device drivers.
Each hardware board includes a processor. When a target for a hardware board is developed, the target for the hardware board's processor is often used as the reference target.
For example, a BeagleBone Black board includes an ARM Cortex-A8 processor. Assume a target for BeagleBone Black boards supports the BeagleBone Black board, and a target for ARM Cortex-A processors supports the processor. Then you can develop a target for BeagleBone Black boards using the target for ARM Cortex-A processors as its reference target.
These features generate application components that enable algorithm code to execute on hardware.
Scheduling — Generates code that executes algorithm code based on sample times specified in the model
Code optimizations — Generate code that improves the execution performance of algorithm code
I/O device driver blocks — Generate code that sends and receives data for algorithm code
These features generate instrumentation code that helps verify algorithm code as it executes on hardware.
Processor-in-the-loop (PIL) — Generates server code that is used to verify algorithm code “in the loop” with a Simulink model
External mode — Generates server code that is used to validate algorithm code by enabling parameter tuning and signal monitoring
Profiling — Generates server code that measures execution performance of algorithm code
These features allow generated code from a Simulink model to execute on hardware.
Application deployment — Uses third-party software tools to compile and link generated code, and then download and run the executable code
The table shows which of these features you can reuse when you develop a target from a MathWorks reference target.
|MathWorks Reference Target
|Target Being Developed
I/O device driver blocks
Needs to be implemented
A hardware board includes a processor. Similarly, the target for a hardware board can share the features included in the target for the processor. Therefore, when you develop a target for a hardware board by using a MathWorks reference target, you can reuse most of the features from the reference target, as shown in the previous table. I/O devices, however, reside on the board and are not part of the processor, so support for I/O devices must be developed for a new target.
How a Target Works
The standard features of a target are included in the foundation code base that ships with Embedded Coder®. These features are activated by appropriate hardware information, which directs the features to support the particular hardware that the information describes. In that sense, the development of a target for a given hardware distills down to providing hardware information in a form that the features understand.
The following steps define the target development process:
Gather the hardware information, which can include certain hardware-specific source files.
Write MATLAB code using the support package’s Target SDK APIs to encode hardware information.
The MATLAB code containing hardware information is translated to a set of hardware information files.
The features use the hardware info files to support a particular hardware.
The features generate code and execute it on the hardware.
The figure shows the mapping between the features and the components of generated code.
Features use hardware information to specialize the generated code for that given hardware. Hardware information can include the type of I/O interfaces, the configuration of timers, the source code for interrupt service routine, and run-time libraries, for example, code optimizations and device drivers.
Application features generate application code that enables algorithm code to execute on hardware. Verification features generate instrumentation code that verifies application code. The deployment feature uses third-party software tools to compile, link, download, and execute generated code.
To develop a target using the key concepts described here, see Implement a Target.