Embedded Coder

Creating a Custom Processor-in-the-Loop (PIL) Configuration

In this demo you will create a custom PIL configuration using the target connectivity APIs. With a custom PIL configuration, you can run PIL simulations on custom embedded hardware.

You will learn how to:

  • Adapt the build process to support PIL
  • Configure a tool to use for downloading and starting execution of a PIL executable on the target embedded hardware
  • Configure a communication channel between host and target that is used to support cosimulation across the host and target processors

You will start with an incomplete PIL configuration that gives errors when you attempt to use it. This demo will guide you through the process of fixing these errors to create a fully working PIL configuration. To fix the errors, you can either:

  • Edit M-files and fix the errors yourself
  • Allow the demo to make the changes automatically

Contents

Preliminaries

You can execute the following commands to add the necessary directories for running this demo and reset any Simulink customizations:

% Later in this exercise you will add a directory to the path
sl_customization_path = fullfile(matlabroot,...
    'toolbox',...
    'rtw',...
    'rtwdemos',...
    'pil_demo');

% If this directory is already on the path, remove it
if strfind(path,sl_customization_path)
    rmpath(sl_customization_path)
end

% Reset any customizations
sl_refresh_customizations

Verify Generated Code Using Processor-in-the-Loop (PIL) Simulation

First run a simulation using the default, host-based PIL configuration. This uses PIL cosimulation to verify the generated code by comparing the simulation behavior with behavior of the corresponding generated code. With the default, host-based configuration, the generated code is compiled for and executed on your host workstation.

You can execute the following commands to make sure the demo model is freshly opened:

close_system('rtwdemo_pil',0);
close_system('rtwdemo_pil_component',0)
rtwdemo_pil

Note that the Model block CounterA has the text (PIL) displayed on it. This shows that the model referenced by this Model block is configured for PIL simulation.

Next, you can execute the following commands to run a simulation of this system:

sim('rtwdemo_pil')

### Checking for structural changes in rtwdemo_pil_component because the model 

###reference rebuild option is set to 'If any changes detected'. 

###Structural changes will cause the model reference SIM target to be rebuilt

### Updating model reference SIM target for model: rtwdemo_pil_component


### The Model Reference SIM target for rtwdemo_pil_component is up-to-date 

###because no functional changes exist in the referenced model.

### Checking for structural changes in rtwdemo_pil_component because 

###the model reference rebuild option is set to 'If any changes detected'. 

###Structural changes will cause the model reference RTW target to be rebuilt


### Starting Real-Time Workshop build procedure for model: rtwdemo_pil_component


### The Model Reference RTW target for rtwdemo_pil_component is up-to-date because 

###no functional changes exist in the referenced model.

### Connectivity configuration for PIL component "rtwdemo_pil_component": 

###<a href="matlab: targets_hyperlink_manager('run',1);">PIL Host Demo</a> 
###
.

### Processing Template Makefile: 

###C:\Applications\MATLAB\R2008b_RC1\rtw\c\ert\ert_lcc.tmf

### Creating rtwdemo_pil_component.mk from 

###C:\Applications\MATLAB\R2008b_RC1\rtw\c\ert\ert_lcc.tmf

### Building rtwdemo_pil_component: .\rtwdemo_pil_component.bat
 
H:\Documents\Projects\RTW-EC\Custom_PIL\slprj\ert\rtwdemo_pil_component\pil>
set MATLAB=C:\Applications\MATLAB\R2008b_RC1 H:\Documents\Projects\RTW-EC\Custom_PIL\slprj\ert\rtwdemo_pil_component\pil>
"C:\Applications\MATLAB\R2008b_RC1\bin\win32\gmake"
-f rtwdemo_pil_component.mk GENERATE_REPORT=1 GENERATE_ASAP2=0 C:/APPLIC~1/MATLAB/R2008B~1\sys\lcc\bin\lcc
-c
-Fopil_interface_lib.obj
-DMODEL=rtwdemo_pil_component
-DNUMST=1
-DNCSTATES=0
-DMAT_FILE=0
-DINTEGER_CODE=0
-DONESTEPFCN=1
-DTERMFCN=0
-DHAVESTDIO
-DMULTI_INSTANCE_CODE=0
-DMT=0
-I.
-I../../../..
-IC:/APPLIC~1/MATLAB/R2008B~1\simulink\include
-IC:/APPLIC~1/MATLAB/R2008B~1\extern\include
-IC:/APPLIC~1/MATLAB/R2008B~1\rtw\c\src
-IC:/APPLIC~1/MATLAB/R2008B~1\rtw\c\libsrc
-IC:/APPLIC~1/MATLAB/R2008B~1\rtw\c\src\ext_mode\common
-IC:/APPLIC~1/MATLAB/R2008B~1\rtw\c\src\ext_mode\tcpip
-IC:/APPLIC~1/MATLAB/R2008B~1\rtw\c\src\ext_mode\serial
-IC:/APPLIC~1/MATLAB/R2008B~1\rtw\c\src\ext_mode\custom
-IH:/Documents/Projects/RTW-EC/Custom_PIL/slprj/ert/rtwdemo_pil_component
-IH:/Documents/Projects/RTW-EC/Custom_PIL
-IC:/APPLIC~1/MATLAB/R2008B~1/toolbox/rtw/rtwdemos
-IC:/APPLIC~1/MATLAB/R2008B~1/toolbox/rtw/targets/pil/c
-IH:/Documents/Projects/RTW-EC/Custom_PIL/slprj/ert/rtwdemo_pil_component/pil
-IC:/APPLIC~1/MATLAB/R2008B~1/rtw/c/src
-IC:/APPLIC~1/MATLAB/R2008B~1\sys\lcc\include
-I../../../../slprj/ert/_sharedutils
-IC:/APPLIC~1/MATLAB/R2008B~1\rtw\c\ert
-w
-noregistrylookup
C:/APPLIC~1/MATLAB/R2008B~1/toolbox/rtw/targets/pil/c/pil_interface_lib.c C:/APPLIC~1/MATLAB/R2008B~1\sys\lcc\bin\lcc
-c
-Fopil_interface.obj
-DMODEL=rtwdemo_pil_component
-DNUMST=1
-DNCSTATES=0
-DMAT_FILE=0
-DINTEGER_CODE=0
-DONESTEPFCN=1
-DTERMFCN=0
-DHAVESTDIO
-DMULTI_INSTANCE_CODE=0
-DMT=0
-I.
-I../../../..
-IC:/APPLIC~1/MATLAB/R2008B~1\simulink\include
-IC:/APPLIC~1/MATLAB/R2008B~1\extern\include
-IC:/APPLIC~1/MATLAB/R2008B~1\rtw\c\src
-IC:/APPLIC~1/MATLAB/R2008B~1\rtw\c\libsrc
-IC:/APPLIC~1/MATLAB/R2008B~1\rtw\c\src\ext_mode\common
-IC:/APPLIC~1/MATLAB/R2008B~1\rtw\c\src\ext_mode\tcpip
-IC:/APPLIC~1/MATLAB/R2008B~1\rtw\c\src\ext_mode\serial
-IC:/APPLIC~1/MATLAB/R2008B~1\rtw\c\src\ext_mode\custom
-IH:/Documents/Projects/RTW-EC/Custom_PIL/slprj/ert/rtwdemo_pil_component
-IH:/Documents/Projects/RTW-EC/Custom_PIL
-IC:/APPLIC~1/MATLAB/R2008B~1/toolbox/rtw/rtwdemos
-IC:/APPLIC~1/MATLAB/R2008B~1/toolbox/rtw/targets/pil/c
-IH:/Documents/Projects/RTW-EC/Custom_PIL/slprj/ert/rtwdemo_pil_component/pil
-IC:/APPLIC~1/MATLAB/R2008B~1/rtw/c/src
-IC:/APPLIC~1/MATLAB/R2008B~1\sys\lcc\include
-I../../../../slprj/ert/_sharedutils
-IC:/APPLIC~1/MATLAB/R2008B~1\rtw\c\ert
-w
-noregistrylookup pil_interface.c C:/APPLIC~1/MATLAB/R2008B~1\sys\lcc\bin\lcc
-c
-Fopil_rtio_data_stream.obj
-DMODEL=rtwdemo_pil_component
-DNUMST=1
-DNCSTATES=0
-DMAT_FILE=0
-DINTEGER_CODE=0
-DONESTEPFCN=1
-DTERMFCN=0
-DHAVESTDIO
-DMULTI_INSTANCE_CODE=0
-DMT=0
-I.
-I../../../..
-IC:/APPLIC~1/MATLAB/R2008B~1\simulink\include
-IC:/APPLIC~1/MATLAB/R2008B~1\extern\include
-IC:/APPLIC~1/MATLAB/R2008B~1\rtw\c\src
-IC:/APPLIC~1/MATLAB/R2008B~1\rtw\c\libsrc
-IC:/APPLIC~1/MATLAB/R2008B~1\rtw\c\src\ext_mode\common
-IC:/APPLIC~1/MATLAB/R2008B~1\rtw\c\src\ext_mode\tcpip
-IC:/APPLIC~1/MATLAB/R2008B~1\rtw\c\src\ext_mode\serial
-IC:/APPLIC~1/MATLAB/R2008B~1\rtw\c\src\ext_mode\custom
-IH:/Documents/Projects/RTW-EC/Custom_PIL/slprj/ert/rtwdemo_pil_component
-IH:/Documents/Projects/RTW-EC/Custom_PIL
-IC:/APPLIC~1/MATLAB/R2008B~1/toolbox/rtw/rtwdemos
-IC:/APPLIC~1/MATLAB/R2008B~1/toolbox/rtw/targets/pil/c
-IH:/Documents/Projects/RTW-EC/Custom_PIL/slprj/ert/rtwdemo_pil_component/pil
-IC:/APPLIC~1/MATLAB/R2008B~1/rtw/c/src
-IC:/APPLIC~1/MATLAB/R2008B~1\sys\lcc\include
-I../../../../slprj/ert/_sharedutils
-IC:/APPLIC~1/MATLAB/R2008B~1\rtw\c\ert
-w
-noregistrylookup
C:/APPLIC~1/MATLAB/R2008B~1/toolbox/rtw/targets/pil/c/pil_rtio_data_stream.c C:/APPLIC~1/MATLAB/R2008B~1\sys\lcc\bin\lcc
-c
-Fopil_host_main.obj
-DMODEL=rtwdemo_pil_component
-DNUMST=1
-DNCSTATES=0
-DMAT_FILE=0
-DINTEGER_CODE=0
-DONESTEPFCN=1
-DTERMFCN=0
-DHAVESTDIO
-DMULTI_INSTANCE_CODE=0
-DMT=0
-I.
-I../../../..
-IC:/APPLIC~1/MATLAB/R2008B~1\simulink\include
-IC:/APPLIC~1/MATLAB/R2008B~1\extern\include
-IC:/APPLIC~1/MATLAB/R2008B~1\rtw\c\src
-IC:/APPLIC~1/MATLAB/R2008B~1\rtw\c\libsrc
-IC:/APPLIC~1/MATLAB/R2008B~1\rtw\c\src\ext_mode\common
-IC:/APPLIC~1/MATLAB/R2008B~1\rtw\c\src\ext_mode\tcpip
-IC:/APPLIC~1/MATLAB/R2008B~1\rtw\c\src\ext_mode\serial
-IC:/APPLIC~1/MATLAB/R2008B~1\rtw\c\src\ext_mode\custom
-IH:/Documents/Projects/RTW-EC/Custom_PIL/slprj/ert/rtwdemo_pil_component
-IH:/Documents/Projects/RTW-EC/Custom_PIL
-IC:/APPLIC~1/MATLAB/R2008B~1/toolbox/rtw/rtwdemos
-IC:/APPLIC~1/MATLAB/R2008B~1/toolbox/rtw/targets/pil/c
-IH:/Documents/Projects/RTW-EC/Custom_PIL/slprj/ert/rtwdemo_pil_component/pil
-IC:/APPLIC~1/MATLAB/R2008B~1/rtw/c/src
-IC:/APPLIC~1/MATLAB/R2008B~1\sys\lcc\include
-I../../../../slprj/ert/_sharedutils
-IC:/APPLIC~1/MATLAB/R2008B~1\rtw\c\ert
-w
-noregistrylookup
C:/APPLIC~1/MATLAB/R2008B~1/toolbox/rtw/targets/pil/c/pil_host_main.c C:/APPLIC~1/MATLAB/R2008B~1\sys\lcc\bin\lcc
-c
-Fortiostream_tcpip.obj
-DMODEL=rtwdemo_pil_component
-DNUMST=1
-DNCSTATES=0
-DMAT_FILE=0
-DINTEGER_CODE=0
-DONESTEPFCN=1
-DTERMFCN=0
-DHAVESTDIO
-DMULTI_INSTANCE_CODE=0
-DMT=0
-I.
-I../../../..
-IC:/APPLIC~1/MATLAB/R2008B~1\simulink\include
-IC:/APPLIC~1/MATLAB/R2008B~1\extern\include
-IC:/APPLIC~1/MATLAB/R2008B~1\rtw\c\src
-IC:/APPLIC~1/MATLAB/R2008B~1\rtw\c\libsrc
-IC:/APPLIC~1/MATLAB/R2008B~1\rtw\c\src\ext_mode\common
-IC:/APPLIC~1/MATLAB/R2008B~1\rtw\c\src\ext_mode\tcpip
-IC:/APPLIC~1/MATLAB/R2008B~1\rtw\c\src\ext_mode\serial
-IC:/APPLIC~1/MATLAB/R2008B~1\rtw\c\src\ext_mode\custom
-IH:/Documents/Projects/RTW-EC/Custom_PIL/slprj/ert/rtwdemo_pil_component
-IH:/Documents/Projects/RTW-EC/Custom_PIL
-IC:/APPLIC~1/MATLAB/R2008B~1/toolbox/rtw/rtwdemos
-IC:/APPLIC~1/MATLAB/R2008B~1/toolbox/rtw/targets/pil/c
-IH:/Documents/Projects/RTW-EC/Custom_PIL/slprj/ert/rtwdemo_pil_component/pil
-IC:/APPLIC~1/MATLAB/R2008B~1/rtw/c/src
-IC:/APPLIC~1/MATLAB/R2008B~1\sys\lcc\include
-I../../../../slprj/ert/_sharedutils
-IC:/APPLIC~1/MATLAB/R2008B~1\rtw\c\ert
-w
-noregistrylookup
C:/APPLIC~1/MATLAB/R2008B~1/rtw/c/src/rtiostream/rtiostreamtcpip/rtiostream_tcpip.c C:/APPLIC~1/MATLAB/R2008B~1\sys\lcc\bin\lcclnk
-s
-LC:/APPLIC~1/MATLAB/R2008B~1\sys\lcc\lib
-o rtwdemo_pil_component.exe pil_interface_lib.obj pil_interface.obj
pil_rtio_data_stream.obj pil_host_main.obj rtiostream_tcpip.obj
..\rtwdemo_pil_component_rtwlib.lib @rtwdemo_pil_component_ref.rsp
C:/APPLIC~1/MATLAB/R2008B~1\sys\lcc\lib\wsock32.lib ### Created executable: rtwdemo_pil_component.exe rtw.connectivity.HostLauncher: started executable with host process identifier
<a href="matlab: targets_hyperlink_manager('run',3);">3872</a> rtw.connectivity.HostLauncher: stopped executable with host process identifier
<a href="matlab: targets_hyperlink_manager('run',3);">3872</a> ### PIL cosimulation for component "rtwdemo_pil_component" completed successfully.

Review the output displayed above. In particular, note that a new process was launched at the start of the simulation and killed at the end of the simulation.

Start Work on a Custom PIL Configuration

In the previous step you ran a simulation using the default PIL configuration. You are now ready to start work on a custom PIL configuration. To do this, you will use a set of skeleton classes that must be modified to create the custom PIL configuration.

You can execute the following commands to make a local copy of the skeleton classes with new package directory name:

skeleton_package_dir = ...
    fullfile(matlabroot,'toolbox','rtw','rtw','+rtw','+mypil');

if exist(fullfile('.','+mypil'),'dir')
    rmdir('+mypil','s')
end

copyfile(skeleton_package_dir, '+mypil');

Next, you can execute the following commands to ensure the copied files are writeable

fileattrib('+mypil\*','+w');

After that, you can execute the following commands to update one of the class files to reflect the change of package name from rtw.mypil to mypil :

rtw.mypil.Utils.UpdateClassName(...
    './+mypil/@ConnectivityConfig/ConnectivityConfig.m',...
    'rtw.mypil',...
    'mypil');

Finally, you can execute the following commands to check that you now have a folder +mypil in the current directory with three sub-folders @Launcher, @TargetApplicationFramework, and @ConnectivityConfig:

dir './+mypil'
.                            @TargetApplicationFramework  
.. @Utils
@ConnectivityConfig CVS
@ExecutableFramework
@Launcher

View the Skeleton Classes

The skeleton classes in the directories you created represent a starting point that you will use for your custom PIL configuruation. Commented-out sections in these classes implement a full host-based PIL configuration. Later in this exercise you will edit these sections to activate this configuration.

You can execute the following commands to view these skeleton classes (but do not make any changes at this stage)

edit mypil.Launcher
edit mypil.TargetApplicationFramework
edit mypil.ConnectivityConfig

Use sl_customization to Register the Custom PIL Configuration

To use the new PIL configuration instead of the default host-based PIL, you must provide an sl_customization file. The sl_customization file registers your new PIL configuration and specifies the conditions that must be satisfied in order to use it. The conditions specified in this file may include the name of your System Target File and your Hardware Implementation settings.

You can execute the following commands to view the sl_customization file and add it to your MATLAB session. For this demo, there is no need to make any changes to this file.

edit(fullfile(sl_customization_path,'sl_customization.m'))

% Add the sl_customization directory to the path and refresh the
% customizations
addpath(sl_customization_path);
sl_refresh_customizations;

Try to Run a Simulation Using the Skeleton PIL Configuration Classes

You can execute the following commands to make sure the demo model is freshly opened before running the simulation. It is important to close and reopen the model; otherwise, the updated PIL configuration classes will not be picked up.

close_system('rtwdemo_pil',0)
rtwdemo_pil

% Attempt to run the simulation
try
    sim('rtwdemo_pil')
catch exceptionObj
    disp(' ')
    disp('What errors occurred? Review the error message above. The error')
    disp('message should indicate that there are some undefined functions:')
    disp('rtIOStreamOpen, rtIOStreamSend, rtIOStreamRecv. These are the')
    disp('names of functions needed by the PIL application running on')
    disp('the target; they are needed to communicate with the host machine.')
    disp('You must provide an implementation of these functions for your')
    disp('target hardware')
    disp(' ');
end
### Checking for structural changes in rtwdemo_pil_component because the model
### reference rebuild option is set to 'If any changes detected'. 
### Structural changes will cause the model reference SIM target to be rebuilt
### Updating model reference SIM target for model: rtwdemo_pil_component

### The Model Reference SIM target for rtwdemo_pil_component is up-to-date
### because no functional changes exist in the referenced model.
### Checking for structural changes in rtwdemo_pil_component because the 
###model reference rebuild option is set to 'If any changes detected'. 
###Structural changes will cause the model reference RTW target to be rebuilt

### Starting Real-Time Workshop build procedure for model: rtwdemo_pil_component

### The Model Reference RTW target for rtwdemo_pil_component is up-to-date
### because no functional changes exist in the referenced model.
### Connectivity configuration for PIL component "rtwdemo_pil_component":
### <a href="matlab: targets_hyperlink_manager('run',1);">My PIL Example</a> 
### .

### Processing Template Makefile: B:\matlab\rtw\c\ert\ert_vc.tmf
### Creating rtwdemo_pil_component.mk from B:\matlab\rtw\c\ert\ert_vc.tmf
### Building rtwdemo_pil_component: .\rtwdemo_pil_component.bat

 $CURRENT_DIR\slprj\ert\rtwdemo_pil_component\pil>set 
 MATLAB=B:\matlab

 $CURRENT_DIR\slprj\ert\rtwdemo_pil_component\pil>set 
 MSVCDir=c:\program files\microsoft 
 visual studio .net 2003\vc7

 $CURRENT_DIR\slprj\ert\rtwdemo_pil_component\pil>
 "B:\matlab\rtw\bin\win32\envcheck" 
 INCLUDE "c:\program files\microsoft visual studio .net 
 2003\vc7\platformsdk\include"

 $CURRENT_DIR\slprj\ert\rtwdemo_pil_component\pil>if 
 errorlevel 1 goto vcvars32

 $CURRENT_DIR\slprj\ert\rtwdemo_pil_component\pil>set 
 VSINSTALLDIR=c:\program files\microsoft 
 visual studio .net 2003\common7\ide

 $CURRENT_DIR\slprj\ert\rtwdemo_pil_component\pil>set 
 VCINSTALLDIR=c:\program files\microsoft 
 visual studio .net 2003

 $CURRENT_DIR\slprj\ert\rtwdemo_pil_component\pil>set 
 FrameworkSDKDir=c:\program files\microsoft 
 visual studio .net 2003\FrameworkSDK

 $CURRENT_DIR\slprj\ert\rtwdemo_pil_component\pil>set 
 FrameworkDir=c:\program files\microsoft 
 visual studio .net 2003\Framework

 $CURRENT_DIR\slprj\ert\rtwdemo_pil_component\pil>call 
 "B:\matlab\toolbox\rtw\rtw\private\vcvars32_710.bat"
 
 Setting environment for using Microsoft Visual Studio .NET 2003 tools.
 (If you have another version of Visual Studio or Visual C++ installed and wish
 to use its tools from the command line, run vcvars32.bat for that version.)
  
 $CURRENT_DIR\slprj\ert\rtwdemo_pil_component\pil>cd .

 $CURRENT_DIR\slprj\ert\rtwdemo_pil_component\pil>nmake 
 -f rtwdemo_pil_component.mk
 GENERATE_REPORT=1 GENERATE_ASAP2=0

 Microsoft (R) Program Maintenance Utility Version 7.10.3077
 Copyright (C) Microsoft Corporation.  All rights reserved.
 
 
### Compiling B:\matlab\toolbox\rtw\targets\pil\c\pil_interface_lib.c
	cl  -c -DCRTAPI1=_cdecl -DCRTAPI2=_cdecl -nologo -D_X86_=1  
       -DWIN32 -D_WIN32 -W3 -D_WINNT -D_WIN32_WINNT=0x0500 
       -D_WIN32_IE=0x0500 -DWINVER=0x0500  -D_MT -MT /Op
       /Od /Oy- -DMODEL=rtwdemo_pil_component -DNUMST=1 
       -DNCSTATES=0  -DMAT_FILE=0 -DINTEGER_CODE=0  
       -DONESTEPFCN=1 -DTERMFCN=0  -DHAVESTDIO 
       -DMULTI_INSTANCE_CODE=0 -DMT=0  
       B:\matlab\toolbox\rtw\targets\pil\c\pil_interface_lib.c
       pil_interface_lib.c
        
### Compiling pil_interface.c
	cl  -c -DCRTAPI1=_cdecl -DCRTAPI2=_cdecl -nologo -D_X86_=1  
       -DWIN32 -D_WIN32 -W3 -D_WINNT -D_WIN32_WINNT=0x0500 -D_WIN32_IE=0x0500 
       -DWINVER=0x0500  -D_MT -MT /Op
       /Od /Oy- -DMODEL=rtwdemo_pil_component -DNUMST=1 
       -DNCSTATES=0  -DMAT_FILE=0 -DINTEGER_CODE=0  -DONESTEPFCN=1 -DTERMFCN=0  
       -DHAVESTDIO -DMULTI_INSTANCE_CODE=0 -DMT=0  pil_interface.c 
       pil_interface.c
        
### Compiling B:\matlab\toolbox\rtw\targets\pil\c\pil_rtio_data_stream.c
	cl  -c -DCRTAPI1=_cdecl -DCRTAPI2=_cdecl -nologo -D_X86_=1  
       -DWIN32 -D_WIN32 -W3 -D_WINNT -D_WIN32_WINNT=0x0500 
       -D_WIN32_IE=0x0500 -DWINVER=0x0500  -D_MT -MT /Op
       /Od /Oy- -DMODEL=rtwdemo_pil_component -DNUMST=1 -DNCSTATES=0  
       -DMAT_FILE=0 -DINTEGER_CODE=0  -DONESTEPFCN=1 -DTERMFCN=0  
       -DHAVESTDIO -DMULTI_INSTANCE_CODE=0 -DMT=0  
       B:\matlab\toolbox\rtw\targets\pil\c\pil_rtio_data_stream.c
       pil_rtio_data_stream.c 
        
### Linking ...
	B:\matlab\sys\perl\win32\bin\perl B:\matlab\rtw\c\tools\mkvc_lnk.pl 
      rtwdemo_pil_component.lnk pil_interface_lib.obj 
      pil_interface.obj pil_rtio_data_stream.obj
      link /RELEASE  /INCREMENTAL:NO /NOLOGO -subsystem:console,4.0  
      kernel32.lib ws2_32.lib mswsock.lib advapi32.lib 
      libcpmt.lib  ..\rtwdemo_pil_component_rtwlib.lib   
      @rtwdemo_pil_component.lnk @rtwdemo_pil_component_ref.rsp 
      -out:rtwdemo_pil_component.exe 
      pil_rtio_data_stream.obj : error LNK2019: unresolved external symbol 
      _rtIOStreamOpen referenced in function _pilInit 
      pil_rtio_data_stream.obj : error LNK2019: unresolved external symbol 
      _rtIOStreamSend referenced in function _pilWriteData 
      pil_rtio_data_stream.obj : error LNK2019: unresolved external symbol 
      _rtIOStreamRecv referenced in function _pilReadData 
      LIBCMT.lib(crt0.obj) : error LNK2019: unresolved external symbol _main 
      referenced in function _mainCRTStartup 
rtwdemo_pil_component.exe : fatal error LNK1120: 4 unresolved externals
NMAKE : fatal error U1077: 'link' : return code '0x460' Stop. $CURRENT_DIR\slprj\ert\rtwdemo_pil_component\pil>echo The make command returned an error of 2 The make command returned an error of 2 $CURRENT_DIR\slprj\ert\rtwdemo_pil_component\pil> An_error_occurred_during_the_call_to_make 'An_error_occurred_during_the_call_to_make' is not recognized as an internal or external command, operable program or batch file. What errors occurred? Review the error message above. The error message should indicate that there are some undefined functions: rtIOStreamOpen, rtIOStreamSend, rtIOStreamRecv. These are the names of functions needed by the PIL application running on the target; they are needed to communicate with the host machine. You must provide an implementation of these functions for your target hardware

The error message above should indicate that there are some undefined functions: rtIOStreamOpen, rtIOStreamSend, rtIOStreamRecv. These are the names of functions needed by the PIL application running on the target; they are needed to communicate with the host machine. You must provide an implementation of these functions for your target hardware.

Review the Target-Side Communications Drivers

You can execute the following commands to view the file rtiostream_tcpip.c (but do not make any changes):

rtiostreamtcpip_dir=fullfile(matlabroot,'rtw','c','src','rtiostream',...
    'rtiostreamtcpip');

edit(fullfile(rtiostreamtcpip_dir,'rtiostream_tcpip.c'))

Scroll down to the end of this file and note that the file contains an implementation of the functions rtIOStreamOpen, rtIOStreamSend, and rtIOStreamRecv that were noted as 'undefined' in the error reported above. To fix the error message, this file must be added to the build.

Add Target-Side Communications Drivers to the PIL Configuration

The class that configures additional files to include in the build is mypil.TargetApplicationFramework. You can execute the following command to open this class in the editor:

edit mypil.TargetApplicationFramework

Review the commented lines ending with %UNCOMMENT. What files will be added to the build when these lines are uncommented?

Once you have completed this review, you can use the MATLAB Editor menu command Text->*Uncomment* to uncomment the lines ending with %UNCOMMENT. You can make these changes manually or they will be performed automatically in the next step.

Use the Target-Side Communications Drivers

You can execute the following commands to automatically uncomment sections in the file, if not already done manually, and run the simulation:

rtw.mypil.Utils.Uncomment(fullfile('./+mypil/@TargetApplicationFramework',...
    'TargetApplicationFramework.m'));

% Attempt to run the simulation
close_system('rtwdemo_pil',0)
rtwdemo_pil
try
    sim('rtwdemo_pil')
catch exceptionObj
    disp(' ')
    disp(exceptionObj.message)
    disp(' ')
    disp('What errors occurred? Review the error message above. The error')
    disp('message should indicate that there was a communications failure')
    disp('between the host and target. This is the error that occurs if')
    disp('the target application has not actually been launched. Was there')
    disp('any indication that a process for the PIL executable was started?')
    disp(' ')
end
## Checking for structural changes in rtwdemo_pil_component because the model
## reference rebuild option is set to 'If any changes detected'. Structural
## changes will cause the model reference SIM target to be rebuilt
### Updating model reference SIM target for model: rtwdemo_pil_component

### The Model Reference SIM target for rtwdemo_pil_component is up-to-date
### because no functional changes exist in the referenced model.
### Checking for structural changes in rtwdemo_pil_component because the model
### reference rebuild option is set to 'If any changes detected'.
### Structural changes will cause the model reference RTW target to be rebuilt

### Starting Real-Time Workshop build procedure for model: rtwdemo_pil_component

### The Model Reference RTW target for rtwdemo_pil_component is up-to-date
### because no functional changes exist in the referenced model.
### Connectivity configuration for PIL component "rtwdemo_pil_component": 
### <a href="matlab: targets_hyperlink_manager('run',1);">My PIL Example</a> ###
.
### Processing Template Makefile: B:\matlab\rtw\c\ert\ert_vc.tmf
### Creating rtwdemo_pil_component.mk from B:\matlab\rtw\c\ert\ert_vc.tmf
### Building rtwdemo_pil_component: .\rtwdemo_pil_component.bat

$CURRENT_DIR\slprj\ert\rtwdemo_pil_component\pil>set MATLAB=B:\matlab  

$CURRENT_DIR\slprj\ert\rtwdemo_pil_component\pil>set 
MSVCDir=c:\program files\microsoft visual studio .net 2003\vc7  

$CURRENT_DIR\slprj\ert\rtwdemo_pil_component\pil>"B:\matlab\rtw\bin\win32\envcheck" 
INCLUDE "c:\program files\microsoft visual studio .net 2003\vc7\platformsdk\include"  

$CURRENT_DIR\slprj\ert\rtwdemo_pil_component\pil>if errorlevel 1 
goto vcvars32  

$CURRENT_DIR\slprj\ert\rtwdemo_pil_component\pil>set 
VSINSTALLDIR=c:\program files\microsoft visual studio .net 2003\common7\ide  

$CURRENT_DIR\slprj\ert\rtwdemo_pil_component\pil>set 
VCINSTALLDIR=c:\program files\microsoft visual studio .net 2003  

$CURRENT_DIR\slprj\ert\rtwdemo_pil_component\pil>set 
FrameworkSDKDir=c:\program files\microsoft visual studio .net 2003\FrameworkSDK  

$CURRENT_DIR\slprj\ert\rtwdemo_pil_component\pil>set 
FrameworkDir=c:\program files\microsoft visual studio .net 2003\Framework  

$CURRENT_DIR\slprj\ert\rtwdemo_pil_component\pil>call 
"B:\matlab\toolbox\rtw\rtw\private\vcvars32_710.bat"  
Setting environment for using Microsoft Visual Studio .NET 2003 tools. 
(If you have another version of Visual Studio or Visual C++ installed and wish 
to use its tools from the command line, run vcvars32.bat for that version.) 

$CURRENT_DIR\slprj\ert\rtwdemo_pil_component\pil>cd .  

$CURRENT_DIR\slprj\ert\rtwdemo_pil_component\pil>nmake 
-f rtwdemo_pil_component.mk  GENERATE_REPORT=1 GENERATE_ASAP2=0  

Microsoft (R) Program Maintenance Utility Version 7.10.3077
Copyright (C) Microsoft Corporation.  All rights reserved. 

### Compiling B:\matlab\toolbox\rtw\targets\pil\c\pil_interface_lib.c 
	cl  -c -DCRTAPI1=_cdecl -DCRTAPI2=_cdecl -nologo -D_X86_=1
      -DWIN32 -D_WIN32 -W3 -D_WINNT -D_WIN32_WINNT=0x0500
      -D_WIN32_IE=0x0500 -DWINVER=0x0500  -D_MT -MT /Op
      /Od /Oy- -DMODEL=rtwdemo_pil_component -DNUMST=1 
      -DNCSTATES=0  -DMAT_FILE=0 -DINTEGER_CODE=0  -DONESTEPFCN=1 
      -DTERMFCN=0  -DHAVESTDIO -DMULTI_INSTANCE_CODE=0 -DMT=0  
      B:\matlab\toolbox\rtw\targets\pil\c\pil_interface_lib.c 
      pil_interface_lib.c 
      
### Compiling pil_interface.c 
	cl  -c -DCRTAPI1=_cdecl -DCRTAPI2=_cdecl -nologo -D_X86_=1
      -DWIN32 -D_WIN32 -W3 -D_WINNT -D_WIN32_WINNT=0x0500 
      -D_WIN32_IE=0x0500 -DWINVER=0x0500  -D_MT -MT /Op    
      /Od /Oy- -DMODEL=rtwdemo_pil_component -DNUMST=1 -DNCSTATES=0  
      -DMAT_FILE=0 -DINTEGER_CODE=0  -DONESTEPFCN=1 -DTERMFCN=0  
      -DHAVESTDIO -DMULTI_INSTANCE_CODE=0 -DMT=0  pil_interface.c 
      pil_interface.c
       
### Compiling B:\matlab\toolbox\rtw\targets\pil\c\pil_rtio_data_stream.c 
	cl  -c -DCRTAPI1=_cdecl -DCRTAPI2=_cdecl -nologo -D_X86_=1
      -DWIN32 -D_WIN32 -W3 -D_WINNT -D_WIN32_WINNT=0x0500 
      -D_WIN32_IE=0x0500 -DWINVER=0x0500  -D_MT -MT /Op    
      /Od /Oy- -DMODEL=rtwdemo_pil_component -DNUMST=1 -DNCSTATES=0  
      -DMAT_FILE=0 -DINTEGER_CODE=0  -DONESTEPFCN=1 -DTERMFCN=0  
      -DHAVESTDIO -DMULTI_INSTANCE_CODE=0 -DMT=0  
      B:\matlab\toolbox\rtw\targets\pil\c\pil_rtio_data_stream.c 
      pil_rtio_data_stream.c 
      
### Compiling B:\matlab\toolbox\rtw\targets\pil\c\pil_host_main.c 
	cl  -c -DCRTAPI1=_cdecl -DCRTAPI2=_cdecl -nologo -D_X86_=1
      -DWIN32 -D_WIN32 -W3 -D_WINNT -D_WIN32_WINNT=0x0500
      -D_WIN32_IE=0x0500 -DWINVER=0x0500  -D_MT -MT /Op    
      /Od /Oy- -DMODEL=rtwdemo_pil_component -DNUMST=1 -DNCSTATES=0  
      DMAT_FILE=0 -DINTEGER_CODE=0  -DONESTEPFCN=1 -DTERMFCN=0  
      -DHAVESTDIO -DMULTI_INSTANCE_CODE=0 -DMT=0  
      B:\matlab\toolbox\rtw\targets\pil\c\pil_host_main.c 
      pil_host_main.c 
      
### Compiling B:\matlab\rtw\c\src\rtiostream\rtiostreamtcpip\rtiostream_tcpip.c 
	cl  -c -DCRTAPI1=_cdecl -DCRTAPI2=_cdecl -nologo -D_X86_=1
      -DWIN32 -D_WIN32 -W3 -D_WINNT -D_WIN32_WINNT=0x0500 
      -D_WIN32_IE=0x0500 -DWINVER=0x0500  -D_MT -MT /Op    
      /Od /Oy- -DMODEL=rtwdemo_pil_component -DNUMST=1 -DNCSTATES=0  
      -DMAT_FILE=0 -DINTEGER_CODE=0  -DONESTEPFCN=1 -DTERMFCN=0  
      -DHAVESTDIO -DMULTI_INSTANCE_CODE=0 -DMT=0  
      B:\matlab\rtw\c\src\rtiostream\rtiostreamtcpip\rtiostream_tcpip.c 
      rtiostream_tcpip.c 
      
### Linking ... 
	B:\matlab\sys\perl\win32\bin\perl
      B:\matlab\rtw\c\tools\mkvc_lnk.pl rtwdemo_pil_component.lnk
      pil_interface_lib.obj pil_interface.obj pil_rtio_data_stream.obj 
      pil_host_main.obj rtiostream_tcpip.obj 
      link /RELEASE  /INCREMENTAL:NO /NOLOGO -subsystem:console,4.0  
      kernel32.lib  ws2_32.lib mswsock.lib advapi32.lib libcpmt.lib   
      ..\rtwdemo_pil_component_rtwlib.lib   @rtwdemo_pil_component.lnk 
      @rtwdemo_pil_component_ref.rsp -out:rtwdemo_pil_component.exe 
    
### Created executable rtwdemo_pil_component.exe 

$CURRENT_DIR\slprj\ert\rtwdemo_pil_component\pil>exit /B 0  


Error in 'rtwdemo_pil/TmpSFcnForModelReference_CounterA' while executing 
C MEX S-function 'rtwdemo_pil_component_psf', (mdlStart), at time 0. 
MATLAB error message:
Error using ==> runtime at 92
An error occurred while calling into the PIL implementation.

Caused by:
   Error using ==> <a href="matlab: opentoline(
   'B:\matlab\toolbox\rtw\rtw\+rtw\+connectivity\
   @RtIOStreamHostCommunicator\RtIOStreamHostCommunicator.m',142,0)
   ">RtIOStreamHostCommunicator.RtIOStreamHostCommunicator>
   RtIOStreamHostCommunicator.writeData at 142</a>
   Communications error: failed to send data to the target.

The error message above should indicate that there was a communications failure between the host and target. This is the error that occurs if the target application has not actually been launched. Was there any indication that a process for the PIL executable was started?

Implement Code to Launch the PIL Executable

The class that configures a tool for launching the PIL executable is mypil.Launcher. You can execute the following command to open this class in the editor:

edit mypil.Launcher

Review the commented lines ending with %UNCOMMENT. Note the method setArgString that allows additional command line parameters to be supplied to the executable; these parameters may include a TCP/IP port number; for implementation on an embedded processor, it could be more difficult to supply start-up parameters and you may choose to have these settings hard-coded. Note the disp commands within the setArgString method that display debugging information to indicate when this method is called and the name of the calling file.

Remove the comment characters when you have understood the purpose of the commented out sections.

Use the Custom Launcher to Start the PIL Executable

You can execute the following commands to automatically uncomment lines in the file Launcher.m and run the simulation:

rtw.mypil.Utils.Uncomment('./+mypil/@Launcher/Launcher.m')

% Attempt to run the simulation
close_system('rtwdemo_pil',0)
rtwdemo_pil
try
    sim('rtwdemo_pil')
catch exceptionObj
    disp(' ')
    disp(exceptionObj.message)
    disp(' ')
    disp('What errors occurred? Carefully review the build log above. Was')
    disp('a process for the PIL application started successfully? You should')
    disp('see that although the PIL application started there was still a failure')
    disp('communicating with the target. Was the setArgString method called? If')
    disp('the setArgString method was not called, the host-target communications')
    disp('were not fully configured.')
    disp(' ')
end
### Checking for structural changes in rtwdemo_pil_component because the model
### reference rebuild option is set to 'If any changes detected'.
### Structural changes will cause the model reference SIM target to be rebuilt

### Updating model reference SIM target for model: rtwdemo_pil_component

### The Model Reference SIM target for rtwdemo_pil_component is up-to-date
### because no functional changes exist in the referenced model.

### Checking for structural changes in rtwdemo_pil_component because the
### model reference rebuild option is set to 'If any changes detected'.
### Structural changes will cause the model reference RTW target to be rebuilt

### Starting Real-Time Workshop build procedure for model: rtwdemo_pil_component

### The Model Reference RTW target for rtwdemo_pil_component is up-to-date
### because no functional changes exist in the referenced model.
### Connectivity configuration for PIL component "rtwdemo_pil_component": 
### <a href="matlab: targets_hyperlink_manager('run',1);">My PIL Example</a> 
### .
### Processing Template Makefile: B:\matlab\rtw\c\ert\ert_vc.tmf
### rtwdemo_pil_component.mk which is generated from
### B:\matlab\rtw\c\ert\ert_vc.tmf is up to date
### Building rtwdemo_pil_component: .\rtwdemo_pil_component.bat


$CURRENT_DIR\slprj\ert\rtwdemo_pil_component\pil>set MATLAB=B:\matlab  

$CURRENT_DIR\slprj\ert\rtwdemo_pil_component\pil>set 
MSVCDir=c:\program files\microsoft visual studio .net 2003\vc7  

$CURRENT_DIR\slprj\ert\rtwdemo_pil_component\pil>"B:\matlab\rtw\bin\win32\envcheck" 
INCLUDE "c:\program files\microsoft visual studio .net 2003\vc7\platformsdk\include"  

$CURRENT_DIR\slprj\ert\rtwdemo_pil_component\pil>if errorlevel 1 
goto vcvars32  

$CURRENT_DIR\slprj\ert\rtwdemo_pil_component\pil>set 
VSINSTALLDIR=c:\program files\microsoft visual studio .net 2003\common7\ide  

$CURRENT_DIR\slprj\ert\rtwdemo_pil_component\pil>set 
VCINSTALLDIR=c:\program files\microsoft visual studio .net 2003  

$CURRENT_DIR\slprj\ert\rtwdemo_pil_component\pil>set 
FrameworkSDKDir=c:\program files\microsoft visual studio .net 2003\FrameworkSDK  

$CURRENT_DIR\slprj\ert\rtwdemo_pil_component\pil>set 
FrameworkDir=c:\program files\microsoft visual studio .net 2003\Framework  

$CURRENT_DIR\slprj\ert\rtwdemo_pil_component\pil>call 
"B:\matlab\toolbox\rtw\rtw\private\vcvars32_710.bat"  

Setting environment for using Microsoft Visual Studio .NET 2003 tools. 

(If you have another version of Visual Studio or Visual C++ installed and wish 

to use its tools from the command line, run vcvars32.bat for that version.) 


$CURRENT_DIR\slprj\ert\rtwdemo_pil_component\pil>cd .  

$CURRENT_DIR\slprj\ert\rtwdemo_pil_component\pil>nmake 
-f rtwdemo_pil_component.mk  GENERATE_REPORT=1 GENERATE_ASAP2=0  

Microsoft (R) Program Maintenance Utility Version 7.10.3077 
Copyright (C) Microsoft Corporation.  All rights reserved. 


### Linking ... 
	B:\matlab\sys\perl\win32\bin\perl 
       B:\matlab\rtw\c\tools\mkvc_lnk.pl rtwdemo_pil_component.lnk
       pil_interface_lib.obj pil_interface.obj pil_rtio_data_stream.obj 
       pil_host_main.obj rtiostream_tcpip.obj 

	   link /RELEASE  /INCREMENTAL:NO /NOLOGO -subsystem:console,4.0  
       kernel32.lib  ws2_32.lib mswsock.lib advapi32.lib libcpmt.lib   
       ..\rtwdemo_pil_component_rtwlib.lib   @rtwdemo_pil_component.lnk 
       @rtwdemo_pil_component_ref.rsp -out:rtwdemo_pil_component.exe 

### Created executable rtwdemo_pil_component.exe 

$CURRENT_DIR\slprj\ert\rtwdemo_pil_component\pil>exit /B 0  

DEMO: startApplication

Started new process, pid = 2576

DEMO: stopApplication

Terminated process, pid = 2576



Error in 'rtwdemo_pil/TmpSFcnForModelReference_CounterA' while executing 
C MEX S-function 'rtwdemo_pil_component_psf', (mdlStart), at time 0. 
MATLAB error message:

Error using ==> runtime at 92

An error occurred while calling into the PIL implementation.

Caused by:

    Error using ==> <a href="matlab: opentoline(
    'B:\matlab\toolbox\rtw\rtw\+rtw\+connectivity\
    @RtIOStreamHostCommunicator\RtIOStreamHostCommunicator.m',142,0)">
    RtIOStreamHostCommunicator.RtIOStreamHostCommunicator>
    RtIOStreamHostCommunicator.writeData at 142</a>

    Communications error: failed to send data to the target. 

In the build log above, you should see that although the PIL application started, there was still a failure communicating with the target. Was the setArgString method called? If the setArgString method was not called, the host-target communications were not fully configured.

Configure the Communications Channel

To complete the configuration of the host-target communications channel, you can execute the following commands to edit the class mypil.ConnectivityConfig :

edit mypil.ConnectivityConfig

Review the lines ending with %UNCOMMENT. You should be able to identify

  • a call to the setArgString method of Launcher that configures the target side of the communications channel
  • configuration of the host-side of communications channel

When you are satisfied, remove the comment characters.

Use the Newly Configured Host-Target Communications

You can execute the following commands to automatically uncomment lines in the file and run the simulation:

rtw.mypil.Utils.Uncomment('./+mypil/@ConnectivityConfig/ConnectivityConfig.m')

% Attempt to run the simulation
close_system('rtwdemo_pil',0)
rtwdemo_pil
sim('rtwdemo_pil')
### Checking for structural changes in rtwdemo_pil_component because the model
### reference rebuild option is set to 'If any changes detected'.
### Structural changes will cause the model reference SIM target to be rebuilt
### Updating model reference SIM target for model: rtwdemo_pil_component

### The Model Reference SIM target for rtwdemo_pil_component is up-to-date
### because no functional changes exist in the referenced model.
### Checking for structural changes in rtwdemo_pil_component because the model
### reference rebuild option is set to 'If any changes detected'.
### Structural changes will cause the model reference RTW target to be rebuilt

### Starting Real-Time Workshop build procedure for model: rtwdemo_pil_component

### The Model Reference RTW target for rtwdemo_pil_component is up-to-date because 
### no functional changes exist in the referenced model.
### Connectivity configuration for PIL component "rtwdemo_pil_component": 
### <a href="matlab: targets_hyperlink_manager('run',1);
### ">My PIL Example</a>
###
EXECUTING METHOD SETARGSTRING

SETARGSTRING called from line 73 of ConnectivityConfig.m

.

### Processing Template Makefile: B:\matlab\rtw\c\ert\ert_vc.tmf

### rtwdemo_pil_component.mk which is generated from
### B:\matlab\rtw\c\ert\ert_vc.tmf is up to date

### Building rtwdemo_pil_component: .\rtwdemo_pil_component.bat

 
$CURRENT_DIR\slprj\ert\rtwdemo_pil_component\pil>set MATLAB=B:\matlab  
 
$CURRENT_DIR\slprj\ert\rtwdemo_pil_component\pil>set 
MSVCDir=c:\program files\microsoft visual studio .net 2003\vc7  
 
$CURRENT_DIR\slprj\ert\rtwdemo_pil_component\pil>"B:\matlab\rtw\bin\win32\envcheck" 
INCLUDE "c:\program files\microsoft visual studio .net 2003\vc7\platformsdk\include"  
 
$CURRENT_DIR\slprj\ert\rtwdemo_pil_component\pil>if errorlevel 1 
goto vcvars32  
 
$CURRENT_DIR\slprj\ert\rtwdemo_pil_component\pil>set 
VSINSTALLDIR=c:\program files\microsoft visual studio .net 2003\common7\ide  
 
$CURRENT_DIR\slprj\ert\rtwdemo_pil_component\pil>set 
VCINSTALLDIR=c:\program files\microsoft visual studio .net 2003  
 
$CURRENT_DIR\slprj\ert\rtwdemo_pil_component\pil>set 
FrameworkSDKDir=c:\program files\microsoft visual studio .net 2003\FrameworkSDK  
 
$CURRENT_DIR\slprj\ert\rtwdemo_pil_component\pil>set 
FrameworkDir=c:\program files\microsoft visual studio .net 2003\Framework  
 
$CURRENT_DIR\slprj\ert\rtwdemo_pil_component\pil>call 
"B:\matlab\toolbox\rtw\rtw\private\vcvars32_710.bat"  

Setting environment for using Microsoft Visual Studio .NET 2003 tools. 

(If you have another version of Visual Studio or Visual C++ installed and wish 

to use its tools from the command line, run vcvars32.bat for that version.) 
 
$CURRENT_DIR\slprj\ert\rtwdemo_pil_component\pil>cd .  
 
$CURRENT_DIR\slprj\ert\rtwdemo_pil_component\pil>nmake 
-f rtwdemo_pil_component.mk  GENERATE_REPORT=1 GENERATE_ASAP2=0  
 
Microsoft (R) Program Maintenance Utility Version 7.10.3077 

Copyright (C) Microsoft Corporation.  All rights reserved. 
 
### Linking ... 

	B:\matlab\sys\perl\win32\bin\perl B:\matlab\rtw\c\tools\mkvc_lnk.pl
       rtwdemo_pil_component.lnk    pil_interface_lib.obj pil_interface.obj 
       pil_rtio_data_stream.obj pil_host_main.obj rtiostream_tcpip.obj 

	link /RELEASE  /INCREMENTAL:NO /NOLOGO -subsystem:console,4.0
       kernel32.lib  ws2_32.lib mswsock.lib advapi32.lib libcpmt.lib   
       ..\rtwdemo_pil_component_rtwlib.lib   @rtwdemo_pil_component.lnk 
       @rtwdemo_pil_component_ref.rsp -out:rtwdemo_pil_component.exe 

### Created executable rtwdemo_pil_component.exe 
 
$CURRENT_DIR\slprj\ert\rtwdemo_pil_component\pil>exit /B 0  

DEMO: startApplication

Started new process, pid = 4084

DEMO: stopApplication

Terminated process, pid = 4084

### PIL cosimulation for component "rtwdemo_pil_component" completed successfully

You can review the output from the above execution. There may be errors if you tried making your own edits; in this case you should review your changes and try to identify the problem. To diagnose and fix the problem, it may be helpful to:

  • use the command "netstat -a", from a command prompt on the host computer, to check for any TCP/IP connections left open on port 14646
  • kill any zombie processes on your host computer called by rtwdemo_pil_component

If the simulation ran successfully and there were no errors, congratulations, you have implemented a custom, host-based PIL configuration! In this case you can now use the same APIs to implement a PIL configuration for your own combination of embedded processor, download tool and communications channel.

Clean Up

Finally, you can execute the following commands to remove the path that was added temporarily, reset any customizations, and close all models:

rmpath(sl_customization_path)
% Reset any customizations
sl_refresh_customizations

% Close the models
close_system('rtwdemo_pil',0)
close_system('rtwdemo_pil_component',0)

製品評価版の入手または製品の購入