Main Content

Support Toolchain Approach with Custom Target

This section describes how to configure a custom system target file to support builds with the toolchain approach.

In the Configuration Parameters dialog box, on the Code Generation pane of, you can set the build controls for the toolchain approach or the template makefile approach. The model configuration parameters that contribute to determining which build controls appear include these parameters.

Model ParameterValueNotes
UseToolchainInfoCompliantonFor toolchain approach, set this parameter to 'on'. For TMF approach, set this parameter to 'off'.
GenerateMakefileonFor toolchain approach, set this parameter to 'on'.

When the dialog box detects that the selected target has these properties, the dialog box recognizes the target as toolchain-compliant and displays the build controls for the toolchain approach.

Because the custom target file cannot set these properties directly, use a SelectCallback function in the custom target file to set the properties. The SelectCallback function call in the RTW_OPTION section of the TLC file can take the form:

rtwgensettings.SelectCallback = 'enableToolchainCompliant(hSrc, hDlg)';

A corresponding callback function can contain:

function enableToolchainCompliant(hSrc, hDlg)
  % The following parameters enable toolchain compliance.
  slConfigUISetVal(hDlg, hSrc, 'UseToolchainInfoCompliant', 'on');
  slConfigUISetVal(hDlg, hSrc, 'GenerateMakefile','on');
  % The following parameters are not required for toolchain compliance.
  % But, it is recommended practice to set these default values and 
  % disable the parameters (as shown).
  slConfigUISetVal(hDlg, hSrc, 'RTWCompilerOptimization','off');
  slConfigUISetVal(hDlg, hSrc, 'MakeCommand','make_rtw');
  slConfigUISetEnabled(hDlg, hSrc, 'RTWCompilerOptimization',false);
  slConfigUISetEnabled(hDlg, hSrc, 'MakeCommand',false);
  hCS = hSrc.getConfigSet(); 

When you select your custom target, the configuration parameters dialog box displays the toolchain approach build controls. For an example, see Create a Custom Target Configuration.

For an example that shows how to configure custom target optional features, see Customize System Target Files.

Related Topics