Main Content

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.

Observe the relationship between:

  • A target and its reference target

  • A hardware board and the processor it includes

  • The target and hardware board they support

The relationship between a target, reference target, and hardware board identifies processor 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.

The relationship between a target, reference target, and hardware board identifies processor support.

Target Features

Application

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

Verification

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

Deployment

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

Summary

The table shows which of these features you can reuse when you develop a target from a MathWorks reference target.

FeatureMathWorks Reference TargetTarget Being Developed

Scheduling

Implemented

Reused

Code optimization

Implemented

Reused

I/O device driver blocks

Not implemented

Needs to be implemented

Processor-in-the-loop (PIL)

Implemented

Reused

External mode

Implemented

Reused

Profiling

Implemented

Reused

Application Deployment

Implemented

Reused

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 target features are activated by appropriate hardware information.

The following steps define the target development process:

  1. Gather the hardware information, which can include certain hardware-specific source files.

  2. Write MATLAB code using the support package’s Target SDK APIs to encode hardware information.

  3. The MATLAB code containing hardware information is translated to a set of hardware information files.

  4. The features use the hardware info files to support a particular hardware.

  5. The features generate code and execute it on the hardware.

There is a mapping between the features and the components of generated code.

The target features help define the code generation.

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.

Related Topics