This example shows how to register and use a toolchain to build an executable file. This example uses the Intel® compiler. However, the concepts and programming interface apply for other toolchains. Once you register a toolchain, you can configure a model such that the code generator uses the toolchain to build an executable file for the model.
A toolchain is a collection of tools required to compile and link code for a specified platform. A toolchain consists of multiple tools, such as a compiler, linker, and archiver. You can configure the tools in a toolchain with multiple options and group tool specifications into types of configurations.
The following code creates a folder in your current working folder (pwd). The new folder contains files for this example. If you do not want to affect the current folder, or cannot generate files in this folder, change your working folder before invoking the command.
copyfile(fullfile(matlabroot,'toolbox','rtw','rtwdemos','toolchain_demo'),'toolchain_demo','f') cd toolchain_demo
Open the rtwdemo_counter
model. By default, this model is configured to use the Generic Real-Time Target (GRT) configuration and the toolchain approach for building an executable file. The capability demonstrated in this example is available for models configured to use the toolchain approach.
model = 'rtwdemo_counter';
open_system(model)
Open the Configuration Parameters dialog box. Select Code Generation. The Toolchain settings section contains parameters for configuring a toolchain. From the Toolchain drop-down list, select the toolchain installed on your development system for building an executable file from the code generated from your model.
By default, the Faster Runs build configuration is selected. Click Show settings to see the toolchain flags specified for building the generated code. Choose a build configuration based on your current application development goal.
Close the Configuration Parameters dialog box.
This example shows how you can register a custom toolchain and add it as a selectable Toolchain option.
The first step to registering a custom toolchain is to create a ToolchainInfo
object that contains information about the toolchain. Methods are available to set toolchain specifications. You can share a ToolchainInfo
object across installations.
Open the toolchain definition file for an Intel compiler. This file creates a ToolchainInfo
object that contains information about the Intel toolchain on a 64-bit Windows® platform.
edit intel_tc type intel_tc
function tc = intel_tc %INTEL_TC Creates an Intel v18 ToolchainInfo object. % This file can be used as a template to define other toolchains on Windows. % Copyright 2012-2019 The MathWorks, Inc. tc = coder.make.ToolchainInfo('BuildArtifact', 'nmake makefile'); tc.Name = 'Intel v18 | nmake makefile (64-bit Windows)'; tc.Platform = 'win64'; tc.SupportedVersion = '18'; tc.addAttribute('TransformPathsWithSpaces'); tc.addAttribute('RequiresCommandFile'); tc.addAttribute('RequiresBatchFile'); % ------------------------------ % Setup % ------------------------------ % Below we are using %ICPP_COMPILER18% as root folder where Intel Compiler is installed. % You can either set an environment variable or give full path to the % compilervars.bat file tc.ShellSetup{1} = 'call %ICPP_COMPILER18%\bin\compilervars.bat intel64'; % ------------------------------ % Macros % ------------------------------ tc.addMacro('MW_EXTERNLIB_DIR', ['$(MATLAB_ROOT)\extern\lib\' tc.Platform '\microsoft']); tc.addMacro('MW_LIB_DIR', ['$(MATLAB_ROOT)\lib\' tc.Platform]); tc.addMacro('CFLAGS_ADDITIONAL', '-D_CRT_SECURE_NO_WARNINGS'); tc.addMacro('CPPFLAGS_ADDITIONAL', '-EHs -D_CRT_SECURE_NO_WARNINGS'); tc.addMacro('LIBS_TOOLCHAIN', '$(conlibs)'); tc.addMacro('CVARSFLAG', ''); tc.addIntrinsicMacros({'ldebug', 'conflags', 'cflags'}); % ------------------------------ % C Compiler % ------------------------------ tool = tc.getBuildTool('C Compiler'); tool.setName( 'Intel C Compiler'); tool.setCommand( 'icl'); tool.setPath( ''); tool.setDirective( 'IncludeSearchPath', '-I'); tool.setDirective( 'PreprocessorDefine', '-D'); tool.setDirective( 'OutputFlag', '-Fo'); tool.setDirective( 'Debug', '-Zi'); tool.setFileExtension( 'Source', '.c'); tool.setFileExtension( 'Header', '.h'); tool.setFileExtension( 'Object', '.obj'); tool.setCommandPattern('|>TOOL<| |>TOOL_OPTIONS<| |>OUTPUT_FLAG<||>OUTPUT<|'); % ------------------------------ % C++ Compiler % ------------------------------ tool = tc.getBuildTool('C++ Compiler'); tool.setName( 'Intel C++ Compiler'); tool.setCommand( 'icl'); tool.setPath( ''); tool.setDirective( 'IncludeSearchPath', '-I'); tool.setDirective( 'PreprocessorDefine', '-D'); tool.setDirective( 'OutputFlag', '-Fo'); tool.setDirective( 'Debug', '-Zi'); tool.setFileExtension( 'Source', '.cpp'); tool.setFileExtension( 'Header', '.hpp'); tool.setFileExtension( 'Object', '.obj'); tool.setCommandPattern('|>TOOL<| |>TOOL_OPTIONS<| |>OUTPUT_FLAG<||>OUTPUT<|'); % ------------------------------ % Linker % ------------------------------ tool = tc.getBuildTool('Linker'); tool.setName( 'Intel C/C++ Linker'); tool.setCommand( 'xilink'); tool.setPath( ''); tool.setDirective( 'Library', '-L'); tool.setDirective( 'LibrarySearchPath', '-I'); tool.setDirective( 'OutputFlag', '-out:'); tool.setDirective( 'Debug', ''); tool.setFileExtension( 'Executable', '.exe'); tool.setFileExtension( 'Shared Library', '.dll'); tool.setCommandPattern('|>TOOL<| |>TOOL_OPTIONS<| |>OUTPUT_FLAG<||>OUTPUT<|'); % ------------------------------ % C++ Linker % ------------------------------ tool = tc.getBuildTool('C++ Linker'); tool.setName( 'Intel C/C++ Linker'); tool.setCommand( 'xilink'); tool.setPath( ''); tool.setDirective( 'Library', '-L'); tool.setDirective( 'LibrarySearchPath', '-I'); tool.setDirective( 'OutputFlag', '-out:'); tool.setDirective( 'Debug', ''); tool.setFileExtension( 'Executable', '.exe'); tool.setFileExtension( 'Shared Library', '.dll'); tool.setCommandPattern('|>TOOL<| |>TOOL_OPTIONS<| |>OUTPUT_FLAG<||>OUTPUT<|'); % ------------------------------ % Archiver % ------------------------------ tool = tc.getBuildTool('Archiver'); tool.setName( 'Intel C/C++ Archiver'); tool.setCommand( 'xilib'); tool.setPath( ''); tool.setDirective( 'OutputFlag', '-out:'); tool.setFileExtension( 'Static Library', '.lib'); tool.setCommandPattern('|>TOOL<| |>TOOL_OPTIONS<| |>OUTPUT_FLAG<||>OUTPUT<|'); % ------------------------------ % Builder % ------------------------------ tc.setBuilderApplication(tc.Platform); % -------------------------------------------- % BUILD CONFIGURATIONS % -------------------------------------------- optimsOffOpts = {'/c /Od'}; optimsOnOpts = {'/c /O2'}; cCompilerOpts = '$(cflags) $(CVARSFLAG) $(CFLAGS_ADDITIONAL)'; cppCompilerOpts = '$(cflags) $(CVARSFLAG) $(CPPFLAGS_ADDITIONAL)'; linkerOpts = {'$(ldebug) $(conflags) $(LIBS_TOOLCHAIN)'}; sharedLinkerOpts = horzcat(linkerOpts, '-dll -def:$(DEF_FILE)'); archiverOpts = {'/nologo'}; % Get the debug flag per build tool debugFlag.CCompiler = '$(CDEBUG)'; debugFlag.CppCompiler = '$(CPPDEBUG)'; debugFlag.Linker = '$(LDDEBUG)'; debugFlag.CppLinker = '$(CPPLDDEBUG)'; debugFlag.Archiver = '$(ARDEBUG)'; % Set the toolchain flags for 'Faster Builds' build configuration cfg = tc.getBuildConfiguration('Faster Builds'); cfg.setOption( 'C Compiler', horzcat(cCompilerOpts, optimsOffOpts)); cfg.setOption( 'C++ Compiler', horzcat(cppCompilerOpts, optimsOffOpts)); cfg.setOption( 'Linker', linkerOpts); cfg.setOption( 'C++ Linker', linkerOpts); cfg.setOption( 'Shared Library Linker', sharedLinkerOpts); cfg.setOption( 'Archiver', archiverOpts); % Set the toolchain flags for 'Faster Runs' build configuration cfg = tc.getBuildConfiguration('Faster Runs'); cfg.setOption( 'C Compiler', horzcat(cCompilerOpts, optimsOnOpts)); cfg.setOption( 'C++ Compiler', horzcat(cppCompilerOpts, optimsOnOpts)); cfg.setOption( 'Linker', linkerOpts); cfg.setOption( 'C++ Linker', linkerOpts); cfg.setOption( 'Shared Library Linker', sharedLinkerOpts); cfg.setOption( 'Archiver', archiverOpts); % Set the toolchain flags for 'Debug' build configuration cfg = tc.getBuildConfiguration('Debug'); cfg.setOption( 'C Compiler', horzcat(cCompilerOpts, optimsOffOpts, debugFlag.CCompiler)); cfg.setOption( 'C++ Compiler', horzcat(cppCompilerOpts, optimsOffOpts, debugFlag.CppCompiler)); cfg.setOption( 'Linker', horzcat(linkerOpts, debugFlag.Linker)); cfg.setOption( 'C++ Linker', horzcat(linkerOpts, debugFlag.CppLinker)); cfg.setOption( 'Shared Library Linker', horzcat(sharedLinkerOpts, debugFlag.Linker)); cfg.setOption( 'Archiver', horzcat(archiverOpts, debugFlag.Archiver)); tc.setBuildConfigurationOption('all', 'Make Tool', '-f $(MAKEFILE)');
You can display the errors and warnings in the diagnostics messages pane from builds generated by custom compilers. For more information, see Diagnostic Message Pane.
Run the toolchain definition file to generate the ToolchainInfo
object.
tc = intel_tc;
Save the ToolchainInfo
object tc
to a MAT file.
save intel_tc tc
After you create the ToolchainInfo
object for the new toolchain, register it. Register a toolchain in RTW.TargetRegistry
. To register the toolchain, write an rtwTargetInfo.m
file. Then, add that file to the MATLAB path so the system loads it automatically.
type rtwTargetInfo
function rtwTargetInfo(tr) %RTWTARGETINFO Registration file for custom toolchains. % Copyright 2012-2019 The MathWorks, Inc. tr.registerTargetInfo(@loc_createToolchain); end % ------------------------------------------------------------------------- % Create the ToolchainInfoRegistry entries % ------------------------------------------------------------------------- function config = loc_createToolchain config(1) = coder.make.ToolchainInfoRegistry; config(1).Name = 'Intel v18 | nmake makefile (64-bit Windows)'; config(1).FileName = fullfile(fileparts(mfilename('fullpath')), 'intel_tc.mat'); config(1).TargetHWDeviceType = {'*'}; config(1).Platform = {computer('arch')}; end
Reset the TargetRegistry
to use the new rtwTargetInfo.m
file.
RTW.TargetRegistry.getInstance('reset');
Reopen the Configuration Parameters dialog box. Click Toolchain. You should see the new toolchain in the list. Select the Intel v18
toolchain.
Programmatically, you can accomplish the same task with the following commands:
cs = getActiveConfigSet(model);
set_param(cs, 'Toolchain', tc.Name)
Verify your selection.
toolchain = get_param(cs, 'Toolchain')
toolchain = 'Intel v18 | nmake makefile (64-bit Windows)'
You can now build the model with the new custom toolchain.
Note: If you do not have the Intel toolchain installed, you can use the following command to generate the code and makefile only.
set_param(cs, 'GenCodeOnly', 'on')
Build the model to generate the code and makefile that uses the new toolchain.
slbuild(model)
### Starting build procedure for: rtwdemo_counter ### Successful completion of code generation for: rtwdemo_counter Build Summary Top model targets built: Model Action Rebuild Reason =================================================================================== rtwdemo_counter Code generated Code generation information file does not exist. 1 of 1 models built (0 models already up to date) Build duration: 0h 0m 26.094s
Obtain the build directory information.
dirInfo = RTW.getBuildDir(model);
Examine the generated makefile.
type(fullfile(dirInfo.BuildDirectory, [model '.mk']))
########################################################################### ## Makefile generated for component 'rtwdemo_counter'. ## ## Makefile : rtwdemo_counter.mk ## Generated on : Mon Jan 11 20:31:42 2021 ## Final product: $(RELATIVE_PATH_TO_ANCHOR)\rtwdemo_counter.exe ## Product type : executable ## ########################################################################### ########################################################################### ## MACROS ########################################################################### # Macro Descriptions: # PRODUCT_NAME Name of the system to build # MAKEFILE Name of this makefile # COMPILER_COMMAND_FILE Compiler command listing model reference header paths # CMD_FILE Command file PRODUCT_NAME = rtwdemo_counter MAKEFILE = rtwdemo_counter.mk MATLAB_ROOT = D:\JOBARC~1\Bdoc21a\2W09AA~J\matlab MATLAB_BIN = D:\JOBARC~1\Bdoc21a\2W09AA~J\matlab\bin MATLAB_ARCH_BIN = $(MATLAB_BIN)\win64 START_DIR = C:\Users\johnr\ONEDRI~1\DOCUME~1\MATLAB\Examples\SIMULI~1\TOOLCH~1 SOLVER = SOLVER_OBJ = CLASSIC_INTERFACE = 0 TGT_FCN_LIB = None MODEL_HAS_DYNAMICALLY_LOADED_SFCNS = 0 RELATIVE_PATH_TO_ANCHOR = .. COMPILER_COMMAND_FILE = rtwdemo_counter_comp.rsp CMD_FILE = rtwdemo_counter.rsp C_STANDARD_OPTS = CPP_STANDARD_OPTS = ########################################################################### ## TOOLCHAIN SPECIFICATIONS ########################################################################### # Toolchain Name: Intel v18 | nmake makefile (64-bit Windows) # Supported Version(s): 18 # ToolchainInfo Version: 2021a # Specification Revision: 1.0 # #------------------------------------------- # Macros assumed to be defined elsewhere #------------------------------------------- # ldebug # conflags # cflags #----------- # MACROS #----------- MW_EXTERNLIB_DIR = $(MATLAB_ROOT)\extern\lib\win64\microsoft MW_LIB_DIR = $(MATLAB_ROOT)\lib\win64 CFLAGS_ADDITIONAL = -D_CRT_SECURE_NO_WARNINGS CPPFLAGS_ADDITIONAL = -EHs -D_CRT_SECURE_NO_WARNINGS LIBS_TOOLCHAIN = $(conlibs) TOOLCHAIN_SRCS = TOOLCHAIN_INCS = TOOLCHAIN_LIBS = #------------------------ # BUILD TOOL COMMANDS #------------------------ # C Compiler: Intel C Compiler CC = icl # Linker: Intel C/C++ Linker LD = xilink # C++ Compiler: Intel C++ Compiler CPP = icl # C++ Linker: Intel C/C++ Linker CPP_LD = xilink # Archiver: Intel C/C++ Archiver AR = xilib # MEX Tool: MEX Tool MEX_PATH = $(MATLAB_ARCH_BIN) MEX = "$(MEX_PATH)\mex" # Download: Download DOWNLOAD = # Execute: Execute EXECUTE = $(PRODUCT) # Builder: NMAKE Utility MAKE = nmake #------------------------- # Directives/Utilities #------------------------- CDEBUG = -Zi C_OUTPUT_FLAG = -Fo LDDEBUG = OUTPUT_FLAG = -out: CPPDEBUG = -Zi CPP_OUTPUT_FLAG = -Fo CPPLDDEBUG = OUTPUT_FLAG = -out: ARDEBUG = STATICLIB_OUTPUT_FLAG = -out: MEX_DEBUG = -g RM = @del ECHO = @echo MV = @ren RUN = @cmd /C #---------------------------------------- # "Faster Builds" Build Configuration #---------------------------------------- ARFLAGS = /nologo CFLAGS = $(cflags) $(CVARSFLAG) $(CFLAGS_ADDITIONAL) \ /c /Od CPPFLAGS = $(cflags) $(CVARSFLAG) $(CPPFLAGS_ADDITIONAL) \ /c /Od CPP_LDFLAGS = $(ldebug) $(conflags) $(LIBS_TOOLCHAIN) CPP_SHAREDLIB_LDFLAGS = DOWNLOAD_FLAGS = EXECUTE_FLAGS = LDFLAGS = $(ldebug) $(conflags) $(LIBS_TOOLCHAIN) MEX_CPPFLAGS = MEX_CPPLDFLAGS = MEX_CFLAGS = MEX_LDFLAGS = MAKE_FLAGS = -f $(MAKEFILE) SHAREDLIB_LDFLAGS = $(ldebug) $(conflags) $(LIBS_TOOLCHAIN) \ -dll -def:$(DEF_FILE) ########################################################################### ## OUTPUT INFO ########################################################################### PRODUCT = $(RELATIVE_PATH_TO_ANCHOR)\rtwdemo_counter.exe PRODUCT_TYPE = "executable" BUILD_TYPE = "Top-Level Standalone Executable" ########################################################################### ## INCLUDE PATHS ########################################################################### INCLUDES_BUILDINFO = INCLUDES = $(INCLUDES_BUILDINFO) ########################################################################### ## DEFINES ########################################################################### DEFINES_BUILD_ARGS = -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DTERMFCN=0 -DONESTEPFCN=1 -DMAT_FILE=0 -DMULTI_INSTANCE_CODE=0 -DINTEGER_CODE=0 -DMT=0 DEFINES_CUSTOM = DEFINES_OPTS = -DTID01EQ=0 DEFINES_STANDARD = -DMODEL=rtwdemo_counter -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -DMODEL_HAS_DYNAMICALLY_LOADED_SFCNS=0 DEFINES = $(DEFINES_BUILD_ARGS) $(DEFINES_CUSTOM) $(DEFINES_OPTS) $(DEFINES_STANDARD) ########################################################################### ## SOURCE FILES ########################################################################### SRCS = $(START_DIR)\rtwdemo_counter_ert_rtw\rtwdemo_counter.c MAIN_SRC = $(START_DIR)\rtwdemo_counter_ert_rtw\ert_main.c ALL_SRCS = $(SRCS) $(MAIN_SRC) ########################################################################### ## OBJECTS ########################################################################### OBJS = rtwdemo_counter.obj MAIN_OBJ = ert_main.obj ALL_OBJS = $(OBJS) $(MAIN_OBJ) ########################################################################### ## PREBUILT OBJECT FILES ########################################################################### PREBUILT_OBJS = ########################################################################### ## LIBRARIES ########################################################################### LIBS = ########################################################################### ## SYSTEM LIBRARIES ########################################################################### SYSTEM_LIBS = ########################################################################### ## ADDITIONAL TOOLCHAIN FLAGS ########################################################################### #--------------- # C Compiler #--------------- CFLAGS_BASIC = $(DEFINES) @$(COMPILER_COMMAND_FILE) CFLAGS = $(CFLAGS) $(CFLAGS_BASIC) #----------------- # C++ Compiler #----------------- CPPFLAGS_BASIC = $(DEFINES) @$(COMPILER_COMMAND_FILE) CPPFLAGS = $(CPPFLAGS) $(CPPFLAGS_BASIC) ########################################################################### ## INLINED COMMANDS ########################################################################### ########################################################################### ## PHONY TARGETS ########################################################################### .PHONY : all build buildobj clean info prebuild download execute set_environment_variables all : build @cmd /C "@echo ### Successfully generated all binary outputs." build : set_environment_variables prebuild $(PRODUCT) buildobj : set_environment_variables prebuild $(OBJS) $(PREBUILT_OBJS) @cmd /C "@echo ### Successfully generated all binary outputs." prebuild : download : $(PRODUCT) execute : download @cmd /C "@echo ### Invoking postbuild tool "Execute" ..." $(EXECUTE) $(EXECUTE_FLAGS) @cmd /C "@echo ### Done invoking postbuild tool." set_environment_variables : @set INCLUDE=$(INCLUDES);$(INCLUDE) @set LIB=$(LIB) ########################################################################### ## FINAL TARGET ########################################################################### #------------------------------------------- # Create a standalone executable #------------------------------------------- $(PRODUCT) : $(OBJS) $(PREBUILT_OBJS) $(MAIN_OBJ) @cmd /C "@echo ### Creating standalone executable "$(PRODUCT)" ..." $(LD) $(LDFLAGS) -out:$(PRODUCT) @$(CMD_FILE) $(SYSTEM_LIBS) $(TOOLCHAIN_LIBS) @cmd /C "@echo ### Created: $(PRODUCT)" ########################################################################### ## INTERMEDIATE TARGETS ########################################################################### #--------------------- # SOURCE-TO-OBJECT #--------------------- .c.obj : $(CC) $(CFLAGS) -Fo"$@" "$<" .cpp.obj : $(CPP) $(CPPFLAGS) -Fo"$@" "$<" {$(RELATIVE_PATH_TO_ANCHOR)}.c.obj : $(CC) $(CFLAGS) -Fo"$@" "$<" {$(RELATIVE_PATH_TO_ANCHOR)}.cpp.obj : $(CPP) $(CPPFLAGS) -Fo"$@" "$<" {$(START_DIR)}.c.obj : $(CC) $(CFLAGS) -Fo"$@" "$<" {$(START_DIR)}.cpp.obj : $(CPP) $(CPPFLAGS) -Fo"$@" "$<" {$(START_DIR)\rtwdemo_counter_ert_rtw}.c.obj : $(CC) $(CFLAGS) -Fo"$@" "$<" {$(START_DIR)\rtwdemo_counter_ert_rtw}.cpp.obj : $(CPP) $(CPPFLAGS) -Fo"$@" "$<" {$(MATLAB_ROOT)\rtw\c\src}.c.obj : $(CC) $(CFLAGS) -Fo"$@" "$<" {$(MATLAB_ROOT)\rtw\c\src}.cpp.obj : $(CPP) $(CPPFLAGS) -Fo"$@" "$<" {$(MATLAB_ROOT)\simulink\src}.c.obj : $(CC) $(CFLAGS) -Fo"$@" "$<" {$(MATLAB_ROOT)\simulink\src}.cpp.obj : $(CPP) $(CPPFLAGS) -Fo"$@" "$<" ert_main.obj : $(START_DIR)\rtwdemo_counter_ert_rtw\ert_main.c $(CC) $(CFLAGS) -Fo"$@" $(START_DIR)\rtwdemo_counter_ert_rtw\ert_main.c rtwdemo_counter.obj : $(START_DIR)\rtwdemo_counter_ert_rtw\rtwdemo_counter.c $(CC) $(CFLAGS) -Fo"$@" $(START_DIR)\rtwdemo_counter_ert_rtw\rtwdemo_counter.c ########################################################################### ## DEPENDENCIES ########################################################################### $(ALL_OBJS) : rtw_proj.tmw $(COMPILER_COMMAND_FILE) $(MAKEFILE) ########################################################################### ## MISCELLANEOUS TARGETS ########################################################################### info : @cmd /C "@echo ### PRODUCT = $(PRODUCT)" @cmd /C "@echo ### PRODUCT_TYPE = $(PRODUCT_TYPE)" @cmd /C "@echo ### BUILD_TYPE = $(BUILD_TYPE)" @cmd /C "@echo ### INCLUDES = $(INCLUDES)" @cmd /C "@echo ### DEFINES = $(DEFINES)" @cmd /C "@echo ### ALL_SRCS = $(ALL_SRCS)" @cmd /C "@echo ### ALL_OBJS = $(ALL_OBJS)" @cmd /C "@echo ### LIBS = $(LIBS)" @cmd /C "@echo ### MODELREF_LIBS = $(MODELREF_LIBS)" @cmd /C "@echo ### SYSTEM_LIBS = $(SYSTEM_LIBS)" @cmd /C "@echo ### TOOLCHAIN_LIBS = $(TOOLCHAIN_LIBS)" @cmd /C "@echo ### CFLAGS = $(CFLAGS)" @cmd /C "@echo ### LDFLAGS = $(LDFLAGS)" @cmd /C "@echo ### SHAREDLIB_LDFLAGS = $(SHAREDLIB_LDFLAGS)" @cmd /C "@echo ### CPPFLAGS = $(CPPFLAGS)" @cmd /C "@echo ### CPP_LDFLAGS = $(CPP_LDFLAGS)" @cmd /C "@echo ### CPP_SHAREDLIB_LDFLAGS = $(CPP_SHAREDLIB_LDFLAGS)" @cmd /C "@echo ### ARFLAGS = $(ARFLAGS)" @cmd /C "@echo ### MEX_CFLAGS = $(MEX_CFLAGS)" @cmd /C "@echo ### MEX_CPPFLAGS = $(MEX_CPPFLAGS)" @cmd /C "@echo ### MEX_LDFLAGS = $(MEX_LDFLAGS)" @cmd /C "@echo ### MEX_CPPLDFLAGS = $(MEX_CPPLDFLAGS)" @cmd /C "@echo ### DOWNLOAD_FLAGS = $(DOWNLOAD_FLAGS)" @cmd /C "@echo ### EXECUTE_FLAGS = $(EXECUTE_FLAGS)" @cmd /C "@echo ### MAKE_FLAGS = $(MAKE_FLAGS)" clean : $(ECHO) "### Deleting all derived files..." @if exist $(PRODUCT) $(RM) $(PRODUCT) $(RM) $(ALL_OBJS) $(ECHO) "### Deleted all derived files."
If Intel compilers are installed, then when the build process is complete, you can run the executable file.
if ispc system([model '.exe']) else system(model) end
You can optionally remove the folder you created earlier.
cd .. rmdir('toolchain_demo', 's')
Reset the TargetRegistry
to remove the toolchain that you registered above.
RTW.TargetRegistry.getInstance('reset');
Close the model.
close_system(model, 0)
Clear the variables introduced in the workspace.
clear INC K LIMIT RESET model tc cs toolchain