Main Content

Create the Framework

Each target must have a framework, which is a set of folders and files that implement the basic structure of a target. MathWorks® code generation software uses this framework to recognize the target and to tailor the code generation process.

The framework is created in the target root folder or <targetrootfolder> by Target SDK. For a complete list of the functions and classes in the target SDK, see Develop a Target. For information about the relationships between classes, see Class Diagram for the Target SDK.

The table below describes the subfolders that are created as part of the framework. The <targetrootfolder> and <targetrootfolder>/registry are added to the MATLAB® path by Target SDK.

Subfolder of the folder for the targetUse

src

C or C++ source files that integrate with generated code.

include

C or C++ header files that integrate with generated code.

lib

Libraries that integrate with generated code.

registry

XML files that define your target. The Target SDK creates these files. Do not edit or delete these files manually.

+matlabshared/+target/+<targetfoldername>

MATLAB files that you write to implement target-specific utilities. Target SDK determines the folder name from the name of your target.

  1. Create a Target object by calling createTarget with the name you chose for your target, for example, 'My ARM Cortex A Board Target', the name of the reference target 'ARM Cortex-A', and the root folder of the target, for example, 'c:/mytarget'.

    tgt = createTarget('My ARM Cortex A Board Target','ARM Cortex-A','c:/mytarget');
  2. Save the information that describes a target to its framework.

    saveTarget(tgt);

    saveTarget creates the target folders and save the new target framework into that location. You can use saveTarget at any time to incrementally update and save your work.

    Note

    The files present in the root folder at the time of the saveTarget call are deleted.

  3. View the properties of the Target object, tgt.

    tgt
    tgt = 
    
      Target with properties:
    
                       Name: 'My ARM Cortex A Board Target'
                     Folder: 'c:/mytarget'
           ReferenceTargets: {[1x1 matlabshared.targetsdk.Target]}
                  Deployers: [0x0 matlabshared.targetsdk.Deployer]
        BaremetalSchedulers: {}
           OperatingSystems: {}
                        PIL: {}
               ExternalMode: {}
                  Profilers: {}

    You set the values of the properties of the Target object in a later step.

  4. Test that the framework for your target has been created successfully.

    testTarget(tgt,'framework');

    Upon completion of the test, a summary result is displayed. If the test PASSED, then you can proceed with adding the next feature. Otherwise, if the test either FAILED or is INCOMPLETE, a link to the test diagnostic logs is shown below the test summary.

    Note

    To test all features for all hardware supported by the target, call testTarget without a second argument. However, testing all features can take a long time. Consider running only the tests for individual features as you are implementing your target. It is recommend you test all features once the target is fully implemented.