Design Cases
Develop a Target That Creates PIL and External Mode Features from Scratch
This example shows how to develop targets for two fictitious
hardware boards, ABC Ventures Cortex-M3
board and ABC
Ventures Cortex-M1
board. You create the target using the ARM®
Cortex®-M target as a reference.
The target will support the ABC CORTEX-M3
and ABC
CORTEX-M1
hardware board. For both hardware boards, the deployer and
appropriate bare-metal schedulers will be taken from the reference target. The
external mode and profiler features will be defined by the target and applied to
both boards.
The hardware to feature mapping of the new target is shown in the following table.
Name | Hardware | |
---|---|---|
ABC Ventures Cortex-M3 Board New | ABC Ventures Cortex-M1 Board New | |
My Serial External Mode | New | New |
My Serial PIL | New | New |
GNU Tools for ARM Embedded Processors | From reference | From reference |
SysTick Scheduler | From reference | N/A |
m0m1m0plus SysTick Scheduler | N/A | From reference |
Identify reference target, name the new target, and create the framework in the specified root folder.
referenceTargetName = 'ARM Cortex-M'; myNewTargetName = 'Target for ABC Ventures Cortex-M Boards'; myNewTargetRootFolder = 'c:/abcventures'; myNewTarget = createTarget(myNewTargetName,referenceTargetName,myNewTargetRootFolder);
Define the hardware that you want to support.
myNewHardwareName1 = 'ABC-CORTEX-M3'; myNewHardware1 = createHardware(myNewHardwareName1); myNewHardware1.DeviceID = 'ARM Cortex-M3'; ioInterfaceName = 'My Serial Connection 1'; serialInterface1 = addNewSerialInterface(myNewHardware1,ioInterfaceName); serialInterface1.AvailablePorts = {'COM1','COM2'}; serialInterface1.DefaultPort = 'COM1'; map(myNewTarget,myNewHardware1, 'ABC Ventures Cortex-M3 Board'); myNewHardwareName2 = 'ABC-CORTEX-M1'; myNewHardware2 = createHardware(myNewHardwareName2); myNewHardware2.DeviceID = 'ARM Cortex-M1'; ioInterfaceName = 'My Serial Connection 2'; serialInterface2 = addNewSerialInterface(myNewHardware2,ioInterfaceName); serialInterface2.AvailablePorts = {'COM1','COM2'}; serialInterface2.DefaultPort = 'COM2'; map(myNewTarget,myNewHardware2, 'ABC Ventures Cortex-M1 Board');
Define the new feature configuration.
myRefSchedulers = getBaremetalScheduler(myNewTarget,'reference'); myNewExtMode = addNewExternalMode(myNewTarget,'My Serial External Mode'); myNewExtMode.SourceFiles = {'$(TARGET_ROOT)/src/abc_rtiostream_serial.c'}; myNewExtMode.PreConnectFcn = 'pause(2)'; myNewPIL = addNewPIL(myNewTarget,'My Serial PIL'); refDeployer = getDeployer(myNewTarget,'name','GNU Tools for ARM Embedded Processors');
Use the new feature configuration for the supported hardware.
map(myNewTarget,myNewHardware1,{refDeployer,myRefSchedulers{1}}); map(myNewTarget,myNewHardware1,myNewPIL,'My Serial Connection 1'); map(myNewTarget,myNewHardware1,myNewExtMode,'My Serial Connection 1'); map(myNewTarget,myNewHardware2,{refDeployer,myRefSchedulers{2}}); map(myNewTarget,myNewHardware2,myNewPIL,'My Serial Connection 2'); map(myNewTarget,myNewHardware2,myNewExtMode,'My Serial Connection 2');
Save the new target.
saveTarget(myNewTarget);