Real-Time Workshop | ![]() ![]() |
Downloading and Running the Executable
Interactively
If automatic downloading is disabled, you must use the Tornado tools to complete the process. This involves three steps:
Connecting to the VxWorks Target
After completing the build process, you are ready to connect the host workstation to the VxWorks target. The first step is starting the target server that is used for communication between the Tornado tools on the host and the target agent on the target. This is done either from the DOS command line or from within the Tornado development environment. From the DOS command line use
Downloading the Real-Time Program
To download the real-time program, use the VxWorks ld
routine from within WindSh
. WindSh
(wind shell) can also be run from the command line or from within the Tornado development environment. (For example, if you want to download the file vx_equal.lo
, which is in the /home/my_working_dir
directory, use the following commands at the WindSh
prompt.
You will also need to load the StethoScope libraries if the StethoScope option was selected during the build. The Tornado User's Guide describes the ld
library routine.
Running the Program
The real-time program defines a function, rt_main()
, that spawns the tasks to execute the model code and communicate with Simulink (if you selected external mode during the build procedure.) It also initializes StethoScope if you selected this option during the build procedure.
The rt_main
function is defined in the rt_main.c
application module. This module is located in the matlabroot
/rtw/c/tornado
directory.
The rt_main
function takes six arguments, and is defined by the following ANSI C function prototype.
RT_MODEL * (*model_name)(void), char_T *optStr, char_T *scopeInstallString, int_T scopeFullNames, int_T priority, int_T port
Table 12-1 lists the arguments to this function.
Argument |
Description |
model_name |
A pointer to the entry point function in the generated code. This function has the same name as the Simulink model. It registers the local functions that implement the model code by adding function pointers to the model's |
optStr |
The options string used to specify a stop time ( The |
scopeInstallString |
A character string that determines which signals are installed to StethoScope. Possible values are:
Specifying any other string installs signals from blocks whose names start with that string. |
scopeFullNames |
This argument determines whether StethoScope uses full hierarchical block names for the signals it accesses or just the individual block name. Possible values are: It is important to use full block names if your program has multiple instances of a model or S-function. |
priority |
The priority of the program's highest priority task ( |
port |
The port number that the external mode sockets connection should use. The valid range is 256 to 65535. When nothing is specified, the port number defaults to 17725. |
Passing optStr Via the Template Makefile. You can also pass the -w
and -tf
options (see optStr
in Table 12-1)
to rt_main
by using the PROGRAM_OPTS
macro in tornado.tmf
. PROGRAM_OPTS
passes a string of the form
In the following examples, the PROGRAM_OPTS
directive sets an infinite stop time and instructs the program to wait for a message from Simulink before starting the simulation. Note that the argument string must be delimited by single quotes nested within double quotes:
Including the extra single quotes ensures that the argument string will be passed to the target program correctly, under both Windows and UNIX.
Calling rt_main. To begin program execution, call rt_main
from WindSh
. For example,
vx_equal
model
tBaseRate
task
![]() | Building the Program | Asynchronous Support | ![]() |