主要内容

coder.make.upgradeToolchain

R2026b

Automate upgrading toolchain defined using coder.make.ToolchainInfo to Target Framework

Since R2026b

    Description

    coder.make.upgradeToolchain(originalToolchain) generates MATLAB® files that assist you in upgrading the coder.make.ToolchainInfo-defined toolchain, originalToolchain, to its target.Toolchain equivalent.

    coder.make.upgradeToolchain(originalToolchain,Name=Value) specifies options using one or more name-value arguments.

    The function generates:

    • A file that assists in defining a Target Framework target.Toolchain object that is equivalent to the original toolchain defined using coder.make.ToolchainInfo

    • A file that converts intrinsic macros in the original toolchain to MATLAB settings or environment variables, depending on the value of UseMATLABSettings

    These files might contain To do comments that provide additional information or enable you to amend the toolchain definition based on the requirements of your build.

    example

    Examples

    collapse all

    Open the example.

    openExample("coder/AutomateExistingToolchainToTargetFrameworkMigrationExample")

    Obtain the existing toolchain by using the exampleLegacyToolchain script.

    tc = exampleLegacyToolchain;

    Run coder.make.upgradeToolchain on the specified toolchain. Specify getUpgradedGCCToolchain.m as the name of the generated files. Specify Example upgraded GCC based toolchain as the name of the upgraded toolchain.

    coder.make.upgradeToolchain(tc, ...
        OutputFile="getUpgradedGCCToolchain.m", ...
        TargetToolchainName="Example upgraded GCC based toolchain");

    The function generates the files getUpgradedGCCToolchain.m and getUpgradedGCCToolchain_MATLABSettings.m.

    Input Arguments

    collapse all

    Name of one of the following, specified as a character vector or string:

    • The original toolchain, if it is already registered in the MATLAB environment

    • The coder.make.ToolchainInfo object defining the original toolchain

    Data Types: char | string

    Name-Value Arguments

    collapse all

    Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

    Example: coder.make.upgradeToolchain(tc,OutputFile="getUpgradedToolchain.m")

    Name of the MATLAB file that upgrades the toolchain, specified as a character vector or string.

    If you do not specify this option, the function uses the name getUpgradedtoolchain.m, where toolchain is the name specified in originalToolchain.

    Example: coder.make.upgradeToolchain(tc,OutputFile="getUpgradedToolchain.m") creates files getUpgradedToolchain.m and getUpgradeToolchain_MATLABSettings.m.

    Data Types: char | string

    Name of the Target Framework equivalent of the original toolchain, specified as a character vector or string.

    Example: coder.make.upgradeToolchain(tc,TargetToolchainName=tc.Name) uses the same name as the original toolchain.

    Data Types: char | string

    Select how to handle intrinsic macros from the original toolchain, specified as a numeric or logical 1 (true) or 0 (false).

    If you specify true, the function generates an OutputFile_MATLABSettings.m file that converts the macros to the corresponding MATLAB settings.

    If you specify false, the function generates an OutputFile_EnvironmentVariableSettings.m file that sets the macros as environment variables.

    Example: coder.make.upgradeToolchain(tc,UseMATLABSetting=false) treats intrinsic macros from tc as environment variables.

    Data Types: logical

    When UseMATLABSettings is true, name of the MATLAB settings group containing settings converted from macros in the original toolchain, specified as a character vector or string.

    Example: coder.make.upgradeToolchain(tc,SettingsGroup="tcSettings") uses the MATLAB settings group tcSettings.

    Data Types: char | string

    Version History

    Introduced in R2026b