Main Content

Design Case for ARM Cortex-R Processors

Develop a Target That Reuses Toolchain and Operating System Features

This example shows how to develop a target for a fictitious hardware board, ABC Ventures Cortex-R7 board. You create the target using the ARM® Cortex®-R target as a reference.

The target will support the ABC CORTEX-R7 hardware board with the toolchain and operating system taken from the reference target. The deployer and external mode features will be defined for the target and applied to the hardware board.

The hardware to feature mapping of the new target is shown in the following table.


ABC Ventures Cortex-R7 Board


My Serial External Mode


My Serial PIL


My Deployer


GNU Tools for ARM Embedded Processors (Toolchain)

From reference

FreeRTOS (Operating System)

From reference

Identify reference target, name the new target, and create the framework in the specified root folder.

referenceTargetName = 'ARM Cortex-R';
myNewTargetName = 'Target for ABC Ventures Cortex-R Board';
myNewTargetRootFolder = 'c:/abcventures';
myNewTarget = createTarget(myNewTargetName, referenceTargetName, myNewTargetRootFolder);


Define the new hardware that you want to support.

myNewHardwareName = 'ABC-CORTEX-R7';
myNewHardware = createHardware(myNewHardwareName);
myNewHardware.DeviceID = 'ARM Cortex-R7';
map(myNewTarget, myNewHardware, 'ABC Ventures Cortex-R7 Board');

Define the new Deployer feature configuration.

myNewDeployerName = 'My Deployer';
myNewDeployer = addNewDeployer(myNewTarget, myNewDeployerName);

Use the Toolchain from the reference target.

referencDeployer = getDeployer(myNewTarget);  
myNewDeployer.Toolchains{1} = referencDeployer{1}.Toolchains{2}; 

Modify the BuildConfiguration of the Toolchain for your target. You can inspect the BuildConfiguration properties inherited from the reference Toolchain object.


Define new Loader for the Deployer.

myNewLoaderName = 'My Loader';
myNewLoader = addNewLoader(myNewDeployer,myNewLoaderName);
myNewLoader.LoadCommand = 'matlab:myLoadAndRunWrapper';

Add tokens, main include files, and hardware initialization functions.

myNewDeployer.Tokens{1} = referencDeployer{1}.Tokens{2};
myNewDeployer.MainIncludeFiles{1} = 'MyARMCortex7_init.h';
myNewDeployer.HardwareInitializationFcn{1} = 'myHardware_init();';

Use FreeRTOS from the reference target.

referenceOS = getOperatingSystem(myNewTarget);
map(myNewTarget,myNewHardware, {myNewDeployer, referenceOS{1}});

Define the new hardware serial connection configuration.

ioInterfaceName = 'My Serial Connection';
mySerialInterface = addNewSerialInterface(myNewHardware, ioInterfaceName);
mySerialInterface.AvailablePorts = {'COM1','COM6'};
mySerialInterface.DefaultPort = 'COM1';

Define the new PIL feature configuration.

myNewPIL = addNewPIL(myNewTarget,'My Serial PIL');

Define the new External mode feature configuration.

myNewExternalMode = addNewExternalMode(myNewTarget,'My Serial External Mode');
myNewExternalMode.SourceFiles = {'$(TARGET_ROOT)/src/abc_rtiostream_serial.c'};
myNewExternalMode.PreConnectFcn = 'pause(2)';
map(myNewTarget, myNewHardware, myNewExternalMode, ioInterfaceName);

Show the new target and supported features.


Save the new target.