coder.Hardware - Create hardware board configuration object for C/C++ code generation from

    MATLAB code - MATLAB ([original](https://www.mathworks.com/help/ecoder/ref/coder.hardware.html)) ([raw](?raw))

Main Content

Create hardware board configuration object for C/C++ code generation fromMATLAB code

Description

The coder.hardware function creates acoder.Hardware object that contains hardware board parameters for C/C++ code generation from MATLABĀ® code.

To use a coder.Hardware object for code generation, assign it to theHardware property of a coder.CodeConfig or coder.EmbeddedCodeConfig object that you pass tocodegen. Assigning a coder.Hardware object to theHardware property customizes the associated coder.HardwareImplementation object and other configuration parameters for the particular hardware board.

Note

The code generator enables you to extend the range of supported hardware by using thetarget.create and target.add functions to register new devices. After you register a new device, you can create acoder.Hardware object for this new device as well.

Creation

Syntax

Description

coder.hardware([boardname](#mw%5Fde2f239d-12f2-480d-ae76-c15fe2171617)) creates acoder.Hardware object for the specified hardware board. The board must be supported by an installed support package. To see a list of available boards, call coder.hardware without input parameters.

example

coder.hardware() returns a cell array of names of boards supported by installed support packages.

example

Input Arguments

expand all

Hardware board name, specified as a character vector or a string scalar.

Example: 'Raspberry Pi'

Example: "Raspberry Pi"

Properties

expand all

Name of hardware board, specified as a character vector or a string scalar. Thecoder.hardware function sets this property using theboardname argument.

Clock rate of hardware board, specified as a double scalar.

Examples

collapse all

Configure code generation for a Raspberry Pi board and generate code for a function foo.

hwlist = coder.hardware(); if ismember('Raspberry Pi',hwlist) hw = coder.hardware('Raspberry Pi'); cfg = coder.config('lib'); cfg.Hardware = hw; codegen foo -config cfg -report end

Before creating a coder.Hardware object for a hardware board, check that the board is supported by an installed support package.

List all boards for which a support package is installed.

hwlist = coder.hardware()

Test for an installed support package for a particular board.

hwlist = coder.hardware(); if ismember('Raspberry Pi',hwlist) hw = coder.hardware('Raspberry Pi'); end

Tips

Version History

Introduced in R2015b