Main Content

Register the Custom Toolchain

Before you register the custom toolchain, create and validate the ToolchainInfo object, as described in Create and Validate ToolchainInfo Object.

  1. Use the save function to create a MATLAB®-formatted binary file (MAT-file) from the coder.make.ToolchainInfo object in the MATLAB workspace variables. For example, enter:

    save newtoolchn_tc tc

    The new .mat file appears in the Current Folder.

  2. Create a new MATLAB function called rtwTargetInfo.m.

  3. Copy and paste the following text into rtwTargetInfo.m:

    function rtwTargetInfo(tr)
    % RTWTARGETINFO Target info callback
    % -------------------------------------------------------------------------
    % 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.

  4. 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.

  5. Save the new rtwTargetInfo.m file to a folder that is on the MATLAB path.

  6. List all of the rtwTargetInfo.m files on the MATLAB path. Using the MATLAB Command Window, enter:

    which -all rtwTargetInfo

  7. Verify that the rtwTargetInfo.m file you just created appears in the list of files.

  8. Reset TargetRegistry so it picks up the custom toolchain from the rtwTargetInfo.m file:


Next, use the custom toolchain, as described in Use the Custom Toolchain.

Related Topics