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 target | Use |
---|---|
| C or C++ source files that integrate with generated code. |
| C or C++ header files that integrate with generated code. |
| Libraries that integrate with generated code. |
| XML files that define your target. The Target SDK creates these files. Do not edit or delete these files manually. |
| MATLAB files that you write to implement target-specific utilities. Target SDK determines the folder name from the name of your target. |
Create a
Target
object by callingcreateTarget
with the name you have chosen for your target, for example,'My ARM Cortex M Board Target'
, the name of the reference target'ARM Cortex-M'
, and the root folder of the target, for example,'c:/mytarget'
.tgt = createTarget('My ARM Cortex M Board Target','ARM Cortex-M','c:/mytarget');
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 usesaveTarget
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.View the properties of the
Target
object,tgt
.tgt
tgt = Target with properties: Name: 'My ARM Cortex M 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.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 eitherFAILED
or isINCOMPLETE
, 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.