Register Custom Launcher
Note
The use of a custom launcher to set up connectivity between Simulink® and your target hardware is not recommended. Use the
target namespace instead. For more information, see Set Up External Mode Connectivity Between Simulink and Target Hardware
To support the one-click workflow or Deploy step for custom hardware, register your custom launcher for the target application.
Create an
rtw.connectivity.Config(Embedded Coder) subclass, which requiresmyCustomLauncher, a launcher that you provide.myCustomLauncheris a subclass ofrtw.connectivity.Launcher(Embedded Coder). InmyCustomLauncher, to support one-click functionality, provide an implementation of thegetApplicationStatusmethod. For the communicator and builder subclasses, you can use dummy classes.classdef myTargetConnectivityConfig < rtw.connectivity.Config methods % Constructor function this = myTargetConnectivityConfig(componentArgs) % Launcher with port 0 argument to start TCP/IP server on free port modelName = componentArgs.getModelName(); bDirInfo = RTW.getBuildDir(modelName); exeName = fullfile(bDirInfo.CodeGenFolder, modelName); if ispc exeName = [exeName, '.exe']; end launcher = myCustomLauncher(componentArgs); launcher.setExe(exeName); % Create dummy communicator and builder communicator = rtw.connectivity.RtIOStreamHostCommunicator.empty(); builder = rtw.connectivity.MakefileBuilder.empty(); % Call super class constructor to register components this@rtw.connectivity.Config(componentArgs, builder, launcher, communicator); end end endTo register the implementation in Simulink, create an
sl_customization.mfile.See Create sl_customization.m File (Embedded Coder).function sl_customization(cm) cm.registerTargetInfo(@loc_createConfig); end % local function function config = loc_createConfig config = rtw.connectivity.ConfigRegistry; config.ConfigClass = 'myTargetConnectivityConfig'; % Specify compatible model configuration. For example, % through SystemTargetFile and TargetHWDeviceType properties. config.SystemTargetFile = {'ert.tlc'}; config.TargetHWDeviceType = { 'ARM Compatible->ARM Cortex' }; endAdd the folder containing
sl_customization.mto the search path and refresh your customizations.addpath(sl_customization_path); sl_refresh_customizations;