Register the Custom Toolchain
Before you register the custom toolchain, create and validate the ToolchainInfo
object, as described in Create and Validate ToolchainInfo Object.
Use the
save
function to create a MATLAB®-formatted binary file (MAT-file) from thecoder.make.ToolchainInfo
object in the MATLAB workspace variables. For example, enter:save newtoolchn_tc tc
The new
.mat
file appears in the Current Folder.Create a new MATLAB function called
rtwTargetInfo.m
.Copy and paste the following text into
rtwTargetInfo.m
:function rtwTargetInfo(tr) % RTWTARGETINFO Target info callback tr.registerTargetInfo(@loc_createToolchain); end % ------------------------------------------------------------------------- % Create the ToolchainInfoRegistry entries % ------------------------------------------------------------------------- function config = loc_createToolchain config(1) = coder.make.ToolchainInfoRegistry; config(1).Name = '<mytoolchain v#.#> | <buildartifact (platform)>'; config(1).FileName = fullfile('<yourdir>','<mytoolchain_tc.mat>'); config(1).TargetHWDeviceType = {'<devicetype>'}; config(1).Platform = {'<win64>'}; % To register more custom toolchains: % 1) Copy and paste the five preceding 'config' lines. % 2) Increment the index of config(). % 3) Replace the values between angle brackets. % 4) Remove the angle brackets. end
Replace the items between angle brackets with real values, and remove the angle brackets:
Name
— Provide a unique name for the toolchain definition file using the recommended format: name, version number, build artifact, and platform.FileName
— The full path and name of the MAT-file.TargetHWDeviceType
— The platform or platforms supported by the custom toolchain.Platform
— The host operating system supported by the custom toolchain. For all platforms, use the following wildcard:'*'
For more information, refer to the corresponding
ToolchainInfo
properties in Properties.Save the new
rtwTargetInfo.m
file to a folder that is on the MATLAB path.List all of the
rtwTargetInfo.m
files on the MATLAB path. Using the MATLAB Command Window, enter:which -all rtwTargetInfo
Verify that the
rtwTargetInfo.m
file you just created appears in the list of files.Reset
TargetRegistry
so it picks up the custom toolchain from thertwTargetInfo.m
file:RTW.TargetRegistry.getInstance('reset');
Next, use the custom toolchain, as described in Use the Custom Toolchain.