target.create - Create target object - MATLAB (original) (raw)

Syntax

Description

[targetObject](#mw%5F1fa104c4-8cc1-4537-9a16-2a767e7f168a) = target.create([targetType](#mw%5F20aaed32-7b0a-4819-8274-005984ae8a8b)) creates and returns an object of the specified class.

example

[targetObject](#mw%5F1fa104c4-8cc1-4537-9a16-2a767e7f168a) = target.create([targetType](#mw%5F20aaed32-7b0a-4819-8274-005984ae8a8b),[Name,Value](#namevaluepairarguments)) configures the object using one or more name-value arguments.

example

Examples

collapse all

Specify Hardware Implementation for New Device

This example shows how to register a new hardware device.

Create a target.Processor object for the new hardware device.

myProc = target.create("Processor",Name="MyProcessor", ... Manufacturer="MyManufacturer");

Create a target.LanguageImplementation object for language implementation details.

myLanguageImplementation = target.create("LanguageImplementation", ... Name="MyProcessorImplementation");

Specify language implementation details.

myLanguageImplementation.Endianess = target.Endianess.Little;

myLanguageImplementation.AtomicIntegerSize = 64; myLanguageImplementation.AtomicFloatSize = 64; myLanguageImplementation.WordSize = 64;

myLanguageImplementation.DataTypes.Char.Size = 8; myLanguageImplementation.DataTypes.Short.Size = 16; myLanguageImplementation.DataTypes.Int.Size = 32; myLanguageImplementation.DataTypes.Long.Size = 64; myLanguageImplementation.DataTypes.LongLong.IsSupported = true; myLanguageImplementation.DataTypes.LongLong.Size = 64; myLanguageImplementation.DataTypes.Float.Size = 32; myLanguageImplementation.DataTypes.Double.Size = 64;

myLanguageImplementation.DataTypes.Pointer.Size = 32;

myLanguageImplementation.DataTypes.SizeT.Size = 64; myLanguageImplementation.DataTypes.PtrDiffT.Size = 64;

Associate the language implementation with the hardware device.

myProc.LanguageImplementations = myLanguageImplementation;

Add the target.Processor object to an internal database.

objectsAdded = target.add(myProc);

"target.add" summary:

Objects added to internal database for current MATLAB session:
    target.LanguageImplementation    "MyProcessorImplementation"
    target.Processor                 "MyManufacturer-MyProcessor"

To remove the objects from the internal database, enter:

target.remove(objectsAdded)

"target.remove" summary:

Objects removed from internal database:
    target.LanguageImplementation    "MyProcessorImplementation"
    target.Processor                 "MyManufacturer-MyProcessor"

Create Hardware Implementation by Modifying Existing Implementation

If an existing hardware implementation contains most of the values that you want in a new hardware implementation, you can quickly create the new implementation by creating and modifying a copy of the existing implementation.

Create a target.Processor object for the new hardware device.

myProc = target.create("Processor",Name="MyProcessor", ... Manufacturer="MyManufacturer");

Create a target.LanguageImplementation object that copies an existing language implementation.

myCopiedImplementation = target.create("LanguageImplementation", ... Name="MyCopiedImplementation", ... Copy="Atmel-AVR");

Specify the required language implementation details. For example, byte ordering.

myCopiedImplementation.Endianess = target.Endianess.Big;

Associate the language implementation with the hardware device.

myProc.LanguageImplementations = myCopiedImplementation;

Add the target.Processor object to an internal database.

objectsAdded = target.add(myProc);

"target.add" summary:

Objects added to internal database for current MATLAB session:
    target.LanguageImplementation    "MyCopiedImplementation"
    target.Processor                 "MyManufacturer-MyProcessor"

To remove the objects from the internal database, enter:

target.remove(objectsAdded)

"target.remove" summary:

Objects removed from internal database:
    target.LanguageImplementation    "MyCopiedImplementation"
    target.Processor                 "MyManufacturer-MyProcessor"

Create Hardware Implementation by Reusing Existing Implementation

If your hardware device requires the same hardware implementation as an existing implementation, you can reuse the existing implementation.

Create a target.Processor object for the new hardware device.

myProc = target.create( "Processor",Name="MyProcessor", ... Manufacturer="MyManufacturer");

Retrieve the existing implementation by using the identifier for the device vendor and type.

existingImplementation = target.get("LanguageImplementation", ... "ARM Compatible-ARM Cortex");

Associate the language implementation with the hardware device.

myProc.LanguageImplementations = existingImplementation;

Add the target.Processor object to an internal database.

objectsAdded = target.add(myProc);

"target.add" summary:

Objects added to internal database for current MATLAB session:
    target.Processor                 "MyManufacturer-MyProcessor"
Objects not added because they already exist:
    target.LanguageImplementation    "ARM Compatible-ARM Cortex"

To remove the objects from the internal database, enter:

target.remove(objectsAdded);

"target.remove" summary:

Objects removed from internal database:
    target.Processor    "MyManufacturer-MyProcessor"

Input Arguments

collapse all

targetType — Target type

character vector | string

Specify class of object. For example, specifying:

For the full list of supported types, see target.

Example: 'Processor'

Name-Value Arguments

Specify optional pairs of arguments asName1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Before R2021a, use commas to separate each name and value, and enclose Name in quotes.

Example: myProc = target.create('Processor', 'Name', 'myProcessor', 'Manufacturer', 'myProcessorManufacturer');

Copy — Copy existing target feature object

character vector | string

Create a target object by copying values from an existing target object. For example:

myLangImp = target.create('LanguageImplementation', ... 'Name', 'myLanguageImplementation', ... 'Copy', 'ARM Compatible-ARM Cortex');

IDPrefix — ID prefix

character vector | string

Add a prefix to the IDs generated by target.create.

_`propertyName`_ — Property name

character vector | string

Create the target object with properties that are set to values that you specify.

Output Arguments

collapse all

targetObject — Target object

object

The object that is created and returned. For example, the object is a:

Version History

Introduced in R2019a