WR VX Simulator Users Guide 6.1 PDF
WR VX Simulator Users Guide 6.1 PDF
WR VX Simulator Users Guide 6.1 PDF
Wind River ®
VxWorks Simulator
®
U S E R ’S G U I D E
6.1
Copyright © 2005 Wind River Systems, Inc.
All rights reserved. No part of this publication may be reproduced or transmitted in any
form or by any means without the prior written permission of Wind River Systems, Inc.
Wind River, the Wind River logo, Tornado, and VxWorks are registered trademarks of
Wind River Systems, Inc. Any third-party trademarks referenced are the property of their
respective owners. For further information regarding Wind River trademarks, please see:
http://www.windriver.com/company/terms/trademark.html
This product may include software licensed to Wind River by third parties. Relevant
notices (if any) are provided in your product installation at the following location:
installDir/product_name/3rd_party_licensor_notice.pdf.
Wind River may refer to third-party documentation by listing publications or providing
links to third-party Web sites for informational purposes. Wind River accepts no
responsibility for the information provided in such third-party documentation.
Corporate Headquarters
Wind River Systems, Inc.
500 Wind River Way
Alameda, CA 94501-1153
U.S.A.
For additional contact information, please visit the Wind River URL:
http://www.windriver.com
For information on how to contact Customer Support, please visit the following URL:
http://www.windriver.com/support
20 May 05
Part #: DOC-15486-ZD-00
Contents
1 Overview ............................................................................................... 1
iii
Wind River VxWorks Simulator
User’s Guide, 6.1
iv
Contents
v
Wind River VxWorks Simulator
User’s Guide, 6.1
vi
Contents
vii
Wind River VxWorks Simulator
User’s Guide, 6.1
viii
1
Overview
1.1 Introduction 1
1.2 Supported Features and Compatibility 2
1.3 Limitations 3
1.1 Introduction
The Wind River VxWorks Simulator is a simulated hardware target for use as a
prototyping and test-bed environment for VxWorks. The VxWorks simulator
allows you to develop, run, and test VxWorks applications on your host system,
reducing the need for target hardware during development. The VxWorks
simulator also allows you to set up a simulated target network for developing and
testing complex networking applications.
For external applications needing to interact with a VxWorks target, the
capabilities of a VxWorks simulator instance are identical to those of a VxWorks
system running on target hardware. A VxWorks simulator instance supports a
standard set of VxWorks features, such as network applications and target and
host VxWorks shells. Building these features into a VxWorks simulator image is no
different than building them into any VxWorks cross-development environment
using a standard BSP.
The goal of this document is to quickly familiarize you with the VxWorks
simulator. The early chapters discuss basic configuration information, instructions
1
Wind River VxWorks Simulator
User’s Guide, 6.1
for building a VxWorks image based on the VxWorks simulator BSP, instructions
for launching the VxWorks simulator from the Wind River Workbench or
command line, and information on building applications. Later chapters provide
more detailed usage information as well as instructions and tutorials for setting up
a network of VxWorks simulator instances.
This document provides instructions for all supported VxWorks simulator host
types including Linux, Solaris, and Windows-based simulators.
Applications developed using the VxWorks simulator can take advantage of the
following VxWorks features:
■ Real-Time Processes (RTPs)
■
Error Detection and Reporting
■
ISR Stack Protection (Solaris and Linux hosts only)
■
Shared Data Regions
■
Shared Libraries (Windows and Linux hosts only)
■
ROMFS
■
VxMP (shared-memory objects)
■
VxFusion (distributed message queues)
■
Wind River System Viewer
For more information on these features, see the VxWorks Kernel Programmer’s Guide.
2
1 Overview
1.3 Limitations
1.3 Limitations
The VxWorks simulator is not suitable for all prototyping needs. The VxWorks
simulator executes on the host machine and does not attempt the simulation of
machine-level instructions for a target architecture. For this reason, the VxWorks
simulator is not a suitable basis on which to develop hardware device drivers.
However, the VxWorks simulator includes MMU support and implements the
architecture-specific part of a memory management unit in order to provide the
same level of feature support as hardware-based targets.
3
Wind River VxWorks Simulator
User’s Guide, 6.1
4
2
Getting Started
2.1 Introduction 5
2.2 System Requirements 6
2.3 Configuring and Building a VxWorks Image 6
2.4 Launching the VxWorks Simulator 8
2.5 Where to Go Next 15
2.1 Introduction
This chapter briefly describes how to set up and configure standard features into a
VxWorks image for use with the VxWorks simulator. It also includes instructions
for launching the VxWorks simulator from your development environment. For
more information on configuring and building VxWorks, see the VxWorks Kernel
Programmer’s Guide and the Wind River Workbench User’s Guide or Wind River
Workbench Command-Line User’s Guide.
5
Wind River VxWorks Simulator
User’s Guide, 6.1
The VxWorks simulator default configuration includes support for many VxWorks
features including:
■
the kernel shell (and its C and command interpreters)
■
the Wind River System Viewer
■
kernel hardening features (such as text segment write protection)
■ error detection and reporting features
■
the ROM-based file system (ROMFS)
■
shared libraries and shared data regions
■
POSIX support
■ C++ support
■
basic memory management support (INCLUDE_MMU_BASIC). (See
3.4.1 Memory Management Unit, p.22.)
■ real time process (RTP) support
■ the network stack
■
virtual disk support. (See 4.3.2 Virtual Disk Support, p.37.)
■
non-volatile RAM. (See 4.3.3 Non-Volatile RAM Support, p.38.)
6
2 Getting Started
2.3 Configuring and Building a VxWorks Image
For more information on these features, see the VxWorks Kernel Programmer’s Guide
and the VxWorks Application Programmer’s Guide. For information on using these
features with the VxWorks simulator, see 4. Using the VxWorks Simulator. 2
The VxWorks simulator provides optional support for the following VxWorks
features. To take advantage of these features, you must configure and build a new
VxWorks image for the VxWorks simulator. For more information on building and
configuring a VxWorks image, see 2.3.3 Building Your VxWorks Image, p.7.
VxMP
The VxWorks simulator optionally includes shared memory END driver support
(smEnd). To include smEnd driver support, the macro INCLUDE_SM_NET must be
defined into the BSP configuration. To define the smEnd driver IP address, use the
following VxWorks simulator command line option
> vxsim -b backplaneAddress
or:
> vxsim -backplane backplaneAddress
The process for configuring and building a VxWorks image is the same for the
VxWorks simulator as it is for target hardware. The VxWorks simulator BSP is
comparable to a standard VxWorks BSP for a hardware target architecture and uses
a standard VxWorks Makefile. However, the BSP makefile builds only the images
7
Wind River VxWorks Simulator
User’s Guide, 6.1
vxWorks and vxWorks.st (standalone VxWorks). Your VxWorks image can be built
using either the Wind River Compiler or the Wind River GNU Compiler.
To build a default VxWorks image, you can create a VxWorks image project using
the Wind River Workbench New VxWorks Image Project wizard. To open the
wizard, select File > New > VxWorks Image Project. You should base your project
on the appropriate VxWorks simulator BSP for your host type. Table 2-1 lists the
available simulator BSPs.
Windows simpc
Solaris solaris
Linux linux
For more information on building VxWorks image projects, see the Wind River
Workbench User’s Guide: VxWorks Image Projects.
You can also build a VxWorks image project from the command line using the
command line project facility, vxprj. For more information on building a VxWorks
image project using vxprj, see the Wind River Workbench Command Line User’s
Guide: Building Applications and Libraries.
8
2 Getting Started
2.4 Launching the VxWorks Simulator
NOTE: To preserve boot line parameters after a reboot, you must use the
bootChange( ) routine. For more information, see 4.2.1 Boot Parameters, p.34.
9
Wind River VxWorks Simulator
User’s Guide, 6.1
-hostname hostName Host machine to boot from. The default value for
-hn hostName this option on a Windows system is host. On a
UNIX system, the default value is always the
actual host name.
10
2 Getting Started
2.4 Launching the VxWorks Simulator
To start a VxWorks simulator instance from the command line, use the vxsim
command. Using this command is similar to using a boot program to load an
image. As options, vxsim lets you specify values for the parameters typically
supplied in a boot line (use vxsim -help to list the option descriptions).
11
Wind River VxWorks Simulator
User’s Guide, 6.1
NOTE: You must use the bootChange( ) routine in order to make boot-parameter
changes that survive a reboot. Even if non-volatile RAM support is included, boot
parameters will be lost once the simulator is exited because boot parameters are
derived from the VxWorks simulator command line.
To start a VxWorks simulator using the default configuration values, use vxsim as
follows:
> vxsim -f pathToVxWorksImage
If you run vxsim from the directory containing the VxWorks image you want to
load, you can simply type:
> vxsim
If your path does not include vxsim, ensure that your VxWorks environment is
properly set. For more information, see the Wind River Workbench Command-Line
User's Guide: Creating a Development Shell with wrenv.
If you intend to use network services, do not start a VxWorks simulator instance
until after the VxWorks simulator network daemon is started and has completed
its initialization (for more information, see 5.3 Setting Up the Network Daemon,
p.48). For the most part, you need only concern yourself with those devices related
to the network interface, specifically, the simnet device, and its address
information (IP address and network mask). If a simulator requires only a single
interface, you can specify simnet as the boot device and its IP address using the -e
parameter. For example:
> vxsim -d simnet -e 192.168.200.1
> vxsim -d simnet -e 192.168.200.2 -p 1
The two vxsim commands shown above start two VxWorks simulator instances
that attach to the default subnet 192.168.200.0. In the second vxsim command, the
-p parameter assigns the value 1 as a “processor number,” to the second VxWorks
simulator instance. If you do not specify a -p number, the default value of 0 is
applied.
12
2 Getting Started
2.4 Launching the VxWorks Simulator
The VxWorks simulator can be launched from the Workbench. To do this, you must
create a VxWorks simulator target connection using the Target Manager. This is
accomplished by launching the Workbench New Connection wizard. Select
Target > New Connection... and select Wind River VxWorks Simulator
Connection as your connection type. You can then use the wizard to configure
your VxWorks simulator.
For more information on creating a VxWorks simulator connection, refer to the
Wind River Workbench Users's Guide: New VxWorks Simulator Connections. For
information on establishing a target connection, refer to the Wind River Workbench
Users's Guide: Connecting to Targets. More detailed instructions are also provided as
part of the tutorials in 6. Networking Tutorials.
As with other targets, the VxWorks simulator can be rebooted by typing Ctrl+X in
the VxWorks simulator console window. On Windows systems, the VxWorks
simulator can be exited by closing the VxWorks simulator window. On Solaris and
Linux systems, you must type Ctrl+\ in the VxWorks simulator console window
to exit.
NOTE: Issuing the exit command in the target shell terminates the shell session
only and cannot be used to exit the VxWorks simulator. To programmatically exit
the VxWorks simulator (which may be useful for scripting), you can reboot
(BOOT_NO_AUTOBOOT). If you wish to use this option, you must start the
VxWorks simulator with the -exitOnError option.
13
Wind River VxWorks Simulator
User’s Guide, 6.1
You can access a VxWorks simulator target from a remote host (a host other than
the one running the VxWorks simulator instance) using the following process:
1. Enable IP forwarding on the host that will be running the VxWorks simulator
instance.
■
On Windows hosts, start the Routing and Remote Access service.
■
On Solaris hosts, run the following with root permissions:
> # ndd -set /dev/tcp ip_forwarding 1
■
On Linux hosts, run the following with root permissions:
> # echo "1" > /proc/sys/net/ipv4/ip_forward
This sets a route that enables the VxWorks simulator instance to send a packet
to any host reachable from 90.0.0.1.
4. On the remote host, specify the route to access the VxWorks simulator
instance. The gateway is the address of the host running the VxWorks
simulator instance on the remote host subnet.
You should now be able to connect to the VxWorks simulator instance from the
remote host.
14
2 Getting Started
2.5 Where to Go Next
■
detailed information on building applications for the VxWorks simulator as
well as a detailed information regarding the VxWorks simulator target
architecture (see 3. Introduction to the VxWorks Simulator Environment).
■
additional configuration information, information on hardware simulation,
and basic guidelines for migrating a VxWorks simulator application to a target
hardware environment (see 4. Using the VxWorks Simulator).
■
information on setting up a simulated subnet for developing networking
applications, as well as tutorials for setting up a simulated subnet (see
5. Networking with the VxWorks Simulator and 6. Networking Tutorials).
For information on getting started with VxWorks and Workbench, see your
Platform getting started. For general information and tutorials for building and
running applications, see the Wind River Workbench User’s Guide.
15
Wind River VxWorks Simulator
User’s Guide, 6.1
16
3
Introduction to the
VxWorks Simulator
Environment
3.1 Introduction 17
3.2 VxWorks Simulator BSP 18
3.3 Building Applications 19
3.4 Interface Variations 21
3.5 Architecture Considerations 25
3.1 Introduction
This chapter discusses the differences between the VxWorks simulator
development environment and the standard VxWorks development environment.
In general, the VxWorks simulator environment differs very little from the
development environment for any other target hardware system. The most notable
differences are the addition of the VxWorks simulator network daemon, which is
discussed in 5.3 Setting Up the Network Daemon, p.48, and variations in the
VxWorks simulator BSP and architecture behavior, which are discussed in the
following sections.
17
Wind River VxWorks Simulator
User’s Guide, 6.1
sysLib.c
Standard I/O
The file winSio.c (or unixSio.c for Linux and Solaris systems) ultimately calls the
host OS read( ) and write( ) routines on the process’s standard input and output.
Nevertheless, it supports all the functionality provided by tyLib.c.
config.h
Makefile
The Makefile is the standard version for VxWorks BSPs. It does not build boot
ROM images (although the makefile rules remain intact); it can only build
vxWorks and vxWorks.st (standalone) images. The final linking does not arrange
for the TEXT segment to be loaded at a fixed area in RAM, but follows the usual
loading model. The makefile macro MACH_EXTRA is provided so that users can
easily link their application modules into the VxWorks image if they are using
manual build methods.
18
3 Introduction to the VxWorks Simulator Environment
3.3 Building Applications
The Workbench build mechanism for the VxWorks simulator uses two
preprocessor constants, CPU and TOOL, to define compiler options for a specific
build target. The CPU variable ensures that VxWorks and your applications are
compiled with the appropriate features enabled. The TOOL variable defines the
toolchain to use for compiling and linking modules.
VxWorks simulator modules can be built with either the Wind River Compiler or
the GNU compiler. To build modules using the Wind River Compiler, define TOOL
as diab. To build modules using the GNU compiler, define TOOL as gnu.
NOTE: Modules built with either gnu or diab can be linked together in any
combination, except for modules that require C++ support. Cross-linking of C++
modules is not supported in this release.
Applications for the VxWorks simulator can be built to run in either the VxWorks
kernel or a VxWorks RTP.
Table 3-1 lists the available CPU and TOOL definitions for the VxWorks simulator.
It also provides sample command line options specific to the VxWorks simulator
architecture. For more information on the available compiler options, see the
compiler documentation for Pentium (Windows and Linux hosts) or SPARC
(Solaris hosts).
Host
CPU Definition (Run Type) TOOL Compiler Command-Line Options
19
Wind River VxWorks Simulator
User’s Guide, 6.1
Host
CPU Definition (Run Type) TOOL Compiler Command-Line Options
For example, to specify CPU for an application that will be run in an RTP on a
Windows (or Linux) host, use the following command line option when you
invoke the compiler:
-DCPU=SIMPENTIUM
On all hosts, the VxWorks simulator uses ELF object module format (OMF). Your
VxWorks installation also includes a VxWorks simulator binary for each supported
host system. You can use this binary as a boot loader for a VxWorks image which
you can configure and build using exactly the same compiler options you use to
build a VxWorks image for a hardware target architecture. Thus, if you are
compiling a VxWorks image for a Linux or Windows VxWorks simulator, you
should use the same compiler as the Intel Architecture. If you are compiling for the
Solaris VxWorks simulator, you compile for the SPARC architecture.
For information on available compiler options, see the Wind River Compiler for x86
User's Guide or the Wind River Compiler for SPARC User's Guide.
20
3 Introduction to the VxWorks Simulator Environment
3.4 Interface Variations
To compile C and C++ modules for debugging, you must use the -g flag to generate
debug information. An example command line for the Wind River Compiler is as
3
follows:
% dcc -tX86LH:vxworks61 -DCPU=SIMNT -IinstallDir/target/h \
-g test.cpp
In this example, installDir is the location of your VxWorks tree and -DCPU specifies
the CPU type.
An equivalent example for the Wind River GNU Compiler is as follows:
% ccpentium -mcpu=i486 -march=i486 -DCPU=SIMNT -IinstallDir/target/h \
-g test.cpp
21
Wind River VxWorks Simulator
User’s Guide, 6.1
For complete documentation, see the reference entries for the libraries,
subroutines, and tools discussed in the following sections.
This section describes the memory management unit implementation for the
VxWorks simulator and how it varies from the standard VxWorks MMU
implementation.
MMU Simulation
22
3 Introduction to the VxWorks Simulator Environment
3.4 Interface Variations
The page size used by the VxWorks simulator is limited by the host operating
system routines used to map and unmap pages. On Solaris and Linux-based
3
simulators, this page size is 8 KB. On Windows simulators, this page size is 64 KB.
MMU limitations
The VxWorks simulator MMU implementation does not provide support for
supervisor/user mode.
The VxWorks simulator can be configured to run without an MMU. For more
information on how to configure your VxWorks image for this type of operation,
see the VxWorks Kernel Programmers's Guide: Memory Management.
To run the VxWorks simulator without an MMU, Wind River recommends that
you change the MMU page size (VM_PAGE_SIZE parameter) in your VxWorks
image to 0x1000 (the default value is 0x2000 on Solaris and Linux simulators and
0x10000 on Windows simulators) in order to limit the amount of physical memory
required to run your applications.
This section discusses the file systems supported by the VxWorks simulator. For
more information on file systems, see the VxWorks Kernel Programmer’s Guide.
23
Wind River VxWorks Simulator
User’s Guide, 6.1
The VxWorks simulator provides virtual disk support which allows you to
simulate a disk block device. The simulated disk block device can be used to access
any file system supported by VxWorks. For more information on virtual disk
support for the VxWorks simulator, refer to 4.3.2 Virtual Disk Support, p.37.
The VxWorks simulator supports the WDB pipe and WDB RPC target agent
communication back ends; the WDB pipe back end is used by default. If network
support is enabled on your VxWorks simulator target, the WDB RPC back end can
also be used.
24
3 Introduction to the VxWorks Simulator Environment
3.5 Architecture Considerations
The Solaris simulator uses a big-endian environment. The Windows and Linux
simulators use a little-endian environment.
25
Wind River VxWorks Simulator
User’s Guide, 6.1
The following floating-point routines are not available on the VxWorks simulator:
cbrt( ) ciel( ) infinity( ) irint( )
iround( ) log2( ) round( ) sincos( )
trunc( ) cbrtf( ) infinityf( ) irintf( )
iroundf( ) log2f( ) roundf( ) sincosf( )
truncf( )
In addition, the following single-precision routines are not available:
acosf( ) asinf( ) atanf( ) atan2f( )
cielf( ) cosf( ) expf( ) fabsf( )
floorf( ) fmodf( ) logf( ) log10f( )
powf( ) sinf( ) sinhf( ) sqrtf( )
tanf( ) tanhf( )
ISR stack overflow and underflow protection is supported on Solaris and Linux
simulators. The VxWorks simulator does not require ISR stack overflow and
underflow protection on Windows simulators because the Windows operating
system automatically detects this type of error condition and handles it before
VxWorks can take action.
For more information on ISR stack protection, see the VxWorks Kernel Programmer’s
Guide: Memory Management.
3.5.5 Interrupts
This section discusses interrupt simulation on the VxWorks simulator and how
interrupts are handled in the simulator environment.
26
3 Introduction to the VxWorks Simulator Environment
3.5 Architecture Considerations
NOTE: Not all VxWorks routines can be called from ISRs. For more information,
see the VxWorks Kernel Programmer's Guide.
To run ISR code during a future system clock interrupt, use the watchdog timer
facilities. To run ISR code during auxiliary clock interrupts, use the
sysAuxClkxxx( ) functions.
Table 3-2 shows how the Linux and Solaris simulator interrupt vector tables are set
up.
1 Host signal 1
...
SIGUSR1 User signal 1
SIGUSR2 User signal 2
...
32 Host signal 32
On Linux:
> intConnect (12, logMsg, "Help!\n")
27
Wind River VxWorks Simulator
User’s Guide, 6.1
Next, send the SIGUSR2 signal to the VxWorks simulator from the host. This can
be done using the kill command. The ISR (logMsg( ) in this case) runs every time
the signal is received.
Only SIGUSR1 and SIGUSR2 can be used to represent user-defined interrupts (see
Table 3-3).
SIGUSR1 16 10
SIGUSR2 17 12
Windows Systems
NOTE: Not all VxWorks routines can be called from ISRs. For more information,
see the VxWorks Kernel Programmer's Guide.
To run ISR code during a future system clock interrupt, use the watchdog timer
facilities. To run ISR code during auxiliary clock interrupts, use the
sysAuxClkxxx( ) functions.
Table 3-4 shows how the Windows simulator interrupt vector table is set up.
28
3 Introduction to the VxWorks Simulator Environment
3.5 Architecture Considerations
The user interrupt range can be used by the host side user application. For more
information on using user interrupts, refer to A. Accessing Host Resources.
29
Wind River VxWorks Simulator
User’s Guide, 6.1
The VxWorks memory layout is the same for all VxWorks simulators. Figure 3-1
shows the memory layout, labeled as follows:
Boot Line
ASCII string of boot parameters.
Exception Message
ASCII string of the fatal exception message.
System Image
The VxWorks system image itself (three sections: text, data, and bss). The entry
point for VxWorks is at the start of this region.
Host Memory Pool
Memory allocated by the host tools. The size depends on the WDB_POOL_SIZE
macro.
System Memory Pool
Size depends on the size of the system image. The sysMemTop( ) routine
returns the address of the end of the free memory pool.
Interrupt Stack
Size is defined by ISR_STACK_SIZE under INCLUDE_KERNEL. The location
depends on the system image size.
Interrupt Vector Table
Table of interrupt vectors.
Shared Memory Address Space
Address space reserved for shared memory; this includes the shared memory
anchor, the shared memory pool, and the address space for VxMP shared
memory objects (if included) or the shared memory TIPC pool (if included).
Networking Address Space
Address space for VxWorks simulator networking (if network support is
included).
30
3 Introduction to the VxWorks Simulator Environment
3.5 Architecture Considerations
LOCAL_MEM_LOCAL_ADRS
sysBootLine = BOOT_LINE_ADRS = 3
Boot Line LOCAL_MEM_LOCAL_ADRS+BOOT_LINE_OFFSET
(BOOT_LINE_SIZE)
sysExcMsg = EXC_MSG_ADRS =
Exception Message LOCAL_MEM_LOCAL_ADRS+EXC_MSG_OFFSET
RAM_LOW_ADRS = LOCAL_MEM_LOCAL_ADRS+0x10000
System Image
text
data
bss KEY
_end
Host Memory Pool
(WDB_POOL_SIZE) Available
_end + WDB_POOL_SIZE
Interrupt Stack
(ISR_STACK_SIZE)
intVecBaseGet( )
Interrupt Vector Table
sysMemTop( )=LOCAL_MEM_LOCAL_ADRS+LOCAL_MEM_SIZE-
User Reserved Memory (USER_RESERVED_MEM+PM_RESERVED_MEM)
(USER_RESERVED_MEM)
sysMemTop( )=LOCAL_MEM_LOCAL_ADRS+
ED&R Persistent Memory LOCAL_MEM_SIZE- PM_RESERVED_MEM
(PM_RESERVED_MEM)
SM_ANCHOR_ADRS=
LOCAL_MEM_LOCAL_ADRS+LOCAL_MEM_SIZE
Shared Memory Address Space
(SM_TOTAL_SIZE)
SIMNET_MEM_ADRS= SM_MEM_ADRS+SM_TOTAL_SIZE
Networking Address Space
(SIMNET_MEM_SIZE)
SIMNET_MEM_ADRS + SIMNET_MEM_SIZE
31
Wind River VxWorks Simulator
User’s Guide, 6.1
32
4
Using the VxWorks Simulator
4.1 Introduction 33
4.2 VxWorks Simulator Configuration 33
4.3 Hardware Simulation 36
4.4 Migrating Applications to a Hardware-Based System 43
4.1 Introduction
This chapter discusses how to use the VxWorks simulator for VxWorks
development. It includes information on configuration, hardware simulation, and
basic guidelines and limitations for migrating your application to a target
hardware system.
33
Wind River VxWorks Simulator
User’s Guide, 6.1
All parameters available in the standard VxWorks boot line can be specified on a
VxWorks simulator target using the command-line interface. However, these
parameters are lost when the simulator instance is exited even if non-volatile RAM
support is included. This occurs because boot parameters are derived from the
VxWorks simulator command line.
Once the VxWorks simulator is started, you can use the VxWorks bootChange( )
routine to modify boot line parameters. The new parameters will be preserved and
taken into account on the next reboot.
NOTE: The bootChange( ) routine can be used to boot another VxWorks image.
However, the new image must be built with the same memory configuration. That
is, the LOCAL_MEM_SIZE and LOCAL_MEM_LOCAL_ADRS macros in the BSP
config.h file must be identical.
The VxWorks simulator memory settings are displayed at startup as shown in the
following example:
Virtual Base Address: 0x10000000
Virtual Top Address: 0x50000000 Virtual Size: 0x40000000 (1024Mb)
Physical Base Address: 0x10000000
Physical Top Address: 0x12000000 Physical Size: 0x02000000 (32Mb)
The following sections discuss the VxWorks simulator memory parameters and
describe how the parameters can be modified.
34
4 Using the VxWorks Simulator
4.2 VxWorks Simulator Configuration
NOTE: If you modify LOCAL_MEM_ADRS, you may need to use the -vaddr
command line option to set a virtual address value that is coherent with the
physical memory address space.
4
Virtual Memory Address Space
The VxWorks simulator virtual memory size is limited to 1 GB and has the
following characteristics:
On Windows:
NOTE: Depending on your host configuration, you may obtain less than 1 GB of
virtual memory.
The default settings for the virtual memory base address and the virtual memory
size should work for most host configurations. However, you may need to modify
the virtual memory values in order to avoid a conflict between the VxWorks
simulator address space and the host system DLL load addresses. You may also
need to decrease the base address in order to get a larger address space. The default
values for the virtual memory base address and the virtual memory size can be
overridden using the -vaddr and -vsize command line options.
NOTE: If you decide to modify the virtual memory base address or virtual memory
size, you must ensure that the values are coherent with the physical memory
address space.
The VxWorks simulator allows you to specify a memory protection level using the
-prot-level option. This level can be set to min, max, or an intermediate integer
35
Wind River VxWorks Simulator
User’s Guide, 6.1
NOTE: Currently, only one protection level is provided. See Table 4-1.
The default file system for the VxWorks simulator is the pass-through file system
(passFS). This file system is unique to the VxWorks simulator. The
INCLUDE_PASSFS component is included by default and mounts this file system
on startup. passFS is a file-oriented device driver that provides easy access to the
host file system. To specify the passFS device name (the default is your system host
name), use the following command-line option:
> vxsim -hn hostname
or
> vxsim -hostname hostname
36
4 Using the VxWorks Simulator
4.3 Hardware Simulation
On Linux or Solaris hosts, the default value for the passFS device name is the name
of the host on which the simulator is running. On Windows, for backward
compatibility with previous releases, the default value is host.
The VxWorks syntax for accessing a host file system is summarized in Table 4-2.
4
Table 4-2 VxWorks Syntax for Accessing passFS
NOTE: passFS uses UNIX-style path separators (/) even on the Windows simulator.
To simulate access to file systems, either the file system supplied with VxWorks or
one you have implemented yourself, the VxWorks simulator includes support for
virtual disks. A virtual disk converts all read and write accesses to read and write
accesses to a file on the host file system. However, to an application running in a
VxWorks image, accessing the virtual disk looks no different than any other disk
in a VxWorks I/O system.
NOTE: Virtual disk support replaces the UNIX disk driver library (unixDrv)
included in earlier versions of the VxWorks simulator.
37
Wind River VxWorks Simulator
User’s Guide, 6.1
This code creates C:, a 200 KB DOS disk with 512-byte blocks, and only one track.
In support of this virtual disk, the virtualDiskCreate( ) call creates the file
c:/tmp/filesys1 (if the file does not already exist). Do not delete this file while the
virtual disk is open (to close a virtual disk, call the virtualDiskClose( ) routine). To
check whether this code has successfully created a virtual disk, you can call devs( ),
which should return the following:
drv name
0 /null
1 /tyCo/0
5 host:
6 /vio
3 C:
By default, a VxWorks image includes support for non-volatile RAM, which has a
default size of 256 bytes. This memory is dedicated to storing boot line
information. To store anything else in NVRAM, use the NV_RAM_SIZE macro to
increase the size of NVRAM. To access NVRAM, use sysNvRamSet( ) and
sysNvRamGet( ).
To simulate NVRAM, the VxWorks simulator uses a file on the host system. By
default, this file resides in the same directory that contains the VxWorks image. To
specify another location, use the -nvram command-line option:
> vxsim -nvram pathToFileForNVRAM
38
4 Using the VxWorks Simulator
4.3 Hardware Simulation
An SIO driver is provided with VxWorks simulator BSPs to handle standard input
and output. On Windows simulators, this is the winSio.c file. On Linux and Solaris
simulators, it is the unixSio.c file.
4
Linux and Solaris Simulators
On Linux and Solaris simulators, UNIX job control characters are enabled even
when the I/O is in raw mode. Trapping of control characters like ^Z is UNIX-shell
specific and does not conform to the usual VxWorks tyLib conventions. Trapping
of the ^C character is performed by the kernel shell (when it is included in your
image).
4.3.5 Timers
Similar to any VxWorks target, the VxWorks simulator provides a system clock and
an auxiliary clock. The macros SYS_CLK_RATE_MIN, SYS_CLK_RATE_MAX,
AUX_CLK_RATE_MIN, and AUX_CLK_RATE_MAX are defined to provide
parameter checking for the sysClkRateSet( ) and sysAuxClkRateSet( ) routines.
39
Wind River VxWorks Simulator
User’s Guide, 6.1
A sample host serial I/O driver (hostSio) is provided with the VxWorks simulator.
This driver provides access to a host serial device from the VxWorks simulator.
This feature is not included in the default VxWorks simulator. To add host serial
device support, the INCLUDE_HOST_SIO component must be defined in the BSP
configuration. The macro HOST_SIO_PORT_NUMBER can be used to select which
host serial device to use. For more information, see A. Accessing Host Resources.
You can configure a VxWorks system where multiple CPU boards are connected
using a common backplane (for example, a VMEbus configuration). This allows
the target boards to communicate through shared memory. VxWorks provides a
standard network driver to access shared memory such that all higher-level
network protocols are available over the backplane. In a typical configuration, one
of the CPU boards (CPU 0) communicates with the host using Ethernet. The rest of
the CPU boards communicate with each other, and the host, using the shared
memory network. In this configuration, CPU 0 acts as a gateway to the outside
network.
This type of hardware configuration can be emulated using the VxWorks
simulator. In this case, Multiple VxWorks simulator instances are configured to use
a host shared-memory region as the basis for the shared-memory network.
40
4 Using the VxWorks Simulator
4.3 Hardware Simulation
192.168.200.1
vxsimnetd
Ethernet
You must also enable IP forwarding between the simulator interfaces. To enable IP
forwarding, set the IPFORWARDING_CFG parameter to TRUE.
You can reconfigure your image using either the vxprj command line utility or
using the Workbench kernel configuration tool. For more information, see the
Workbench User’s Guide or the Workbench Command-Line User’s Guide.
The master simulator is used to communicate with the host through the simnet
device. You can specify the shared-memory network address for the master
simulator by starting the VxWorks simulator instance with the -backplane (or -b)
option as follows:
> vxsim -p 0 -d simnet -e 192.168.200.1 -b 161.27.0.1:ffffff00
41
Wind River VxWorks Simulator
User’s Guide, 6.1
NOTE: Because it is responsible for initializing the shared memory region, the
master simulator must always be started first. You must also reboot all slave
instances each time the master instance is rebooted.
Once the master simulator instance is started, slave simulator instances can be
started with a gateway set to the master simulator using the -gateway (or -g)
option as follows:
> vxsim -p 1 -b 161.27.0.2:ffffff00 -g 161.27.0.1
> vxsim -p 2 -b 161.27.0.3:ffffff00 -g 161.27.0.1
and then add a network route to specify which gateway should be used for
communication. This is done from the VxWorks simulator target shell as follows:
-> routec "add -net 0.0.0.0 161.27.0.1"
NOTE: If you choose to use the alternative option described above, you must
include the INCLUDE_ROUTECMD component in your VxWorks image.
Before your host system can communicate with the master simulator, you must
configure your host routing table with the new subnet information. The routing
information can be configured as follows:
For Windows hosts, enter the following command from a Windows command
shell:
> route add 161.27.0.0 MASK 255.255.255.0 192.168.200.1
For Solaris or Linux hosts, enter the following command from your host shell:
% route add -net 161.27.0.0 192.168.200.1
42
4 Using the VxWorks Simulator
4.4 Migrating Applications to a Hardware-Based System
To migrate your application, change your project build specifications to reflect the
new hardware-based system. This involves recompiling your code using the
appropriate CPU type for your target hardware.
For more information on building applications for your target architecture, see the
appropriate VxWorks architecture supplement. For general application build
instructions, see the Wind River Workbench User’s Guide.
43
Wind River VxWorks Simulator
User’s Guide, 6.1
44
5
Networking with the
VxWorks Simulator
5.1 Introduction 45
5.2 Building Network Simulations 46
5.3 Setting Up the Network Daemon 48
5.4 Installing the Host Connection Driver 62
5.5 Configuring a Simulated Subnet 66
5.1 Introduction
The VxWorks simulator provides support for setting up a subnet using a network
of VxWorks simulator instances. This chapter discusses how to configure your
system and the required VxWorks simulator instances for use in a simulated
subnet. It includes general network simulation information, instructions for
setting up the VxWorks simulator network daemon (vxsimnetd) and installing the
host connection driver, and information on configuring your simulated network.
Tutorials for setting up a simulated network are provided in 6. Networking
Tutorials.
NOTE: The VxWorks simulator supports IPv6. For IPv6 configuration information,
see the Wind River Network Stack for VxWorks 6 Programmer’s Guide. For information
on using the VxWorks simulator with IPv6, see 6.4 IPv6 Tutorial, p.84.
45
Wind River VxWorks Simulator
User’s Guide, 6.1
VxSIM VxSIM
192.168.3.2
3 4
VxSIM
Virtual Network
2
192.168.2.0
Virtual Network
192.168.3.0
Virtual subnet 192.168.3.0 is an entirely internal subnet. It is isolated from the host,
although you can use a target shell or the target server (using the WDB pipe back
end) to access a target. After you have access to one target on the subnet, you can
use the subnet to communicate with other targets on the subnet. Virtual subnet
192.168.2.0 is an “external” subnet. It is networked to the host workstation through
46
5 Networking with the VxWorks Simulator
5.2 Building Network Simulations
the host adapter interface, 192.168.2.254. If you set up the host system route table
correctly, the host system can route packets for the 192.168.2.0 subnet.
As shown in Figure 5-2, it is possible to create a multiple interface VxWorks
simulator instance. Using such a VxWorks simulator instance, it is possible to route
between simulated subnets.
Figure 5-2 VxWorks Simulator Instances Can Support Multiple Network Interfaces 5
VxSIM VxSIM
3 4
192.168.3.2
VxSIM
Virtual Network
2
192.168.2.0
Virtual Network
192.168.3.0
In Figure 5-2, the multi-interface VxSIM 3 can route packets from the 192.168.3.0
subnet to the greater external network through the host adapter to the host, which
can then route packets to the external network through its network interface.
47
Wind River VxWorks Simulator
User’s Guide, 6.1
NOTE: Although the VxWorks simulator network daemon allows you to set up
complex simulated networks, it is also required for minimal networks—that is, a
connection between the host and a single simulator instance.
The remainder of this section tells you how to set up a VxWorks simulator network
daemon. Using the VxWorks simulator network daemon, you can link same-host
VxWorks simulator instances into simulated subnets. By default, these internal
subnets do not communicate with the host. However, included with the VxWorks
simulator is a simulated network drive—a host adapter interface—that you can
use to give the host system an address on the simulated subnet. For more
information on the VxWorks simulator host connection driver, see 5.4 Installing the
Host Connection Driver, p.62.
48
5 Networking with the VxWorks Simulator
5.3 Setting Up the Network Daemon
for the VxWorks simulator even if you are not logged in with administrator or root
privileges on the host system.
You can create scripts for Solaris and Linux systems that start vxsimnetd
automatically on reboot (use the -sv option if you want the ability to modify
network configuration).
49
Wind River VxWorks Simulator
User’s Guide, 6.1
You can install vxsimnetd as a root service using the following steps:
1. Copy vxsimnetd to your /usr/sbin directory.
2. Create a vxsimnetd script as follows in /etc/init.d:
On Solaris, use the following script:
#!/bin/sh
#
# description: Starts and stops the vxsimnetd daemon
# used to provide external network access to the
# VxWorks simulator.
case "$1" in
start)
if [ -x /usr/sbin/vxsimnetd ] ; then
echo "Starting vxsimnetd ..."
/usr/sbin/vxsimnetd -sv
fi
;;
stop)
echo "Stopping vxsimnetd ..."
/usr/bin/pkill -x vxsimnetd
;;
*)
echo "Usage: $0 {start|stop}"
exit 1
esac
exit 0
50
5 Networking with the VxWorks Simulator
5.3 Setting Up the Network Daemon
RETVAL=0
start() {
echo -n $"Starting vxsimnetd service: "
daemon vxsimnetd -sv
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/vxsimnetd || \
RETVAL=1 5
return $RETVAL
}
stop() {
echo -n $"Shutting down vxsimnetd services: "
killproc vxsimnetd
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/vxsimnetd
echo ""
return $RETVAL
}
restart() {
stop
start
}
rhstatus() {
status vxsimnetd
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
status)
rhstatus
;;
condrestart)
[ -f /var/lock/subsys/vxsimnetd ] && restart || :
;;
*)
echo $"Usage: $0 {start|stop|restart|status|condrestart}"
exit 1
esac
exit $?
51
Wind River VxWorks Simulator
User’s Guide, 6.1
3. Create a link.
On Solaris, create a link in /etc/rc3.d/ as follows:
> ln -s /etc/init.d/vxsimnetd S91vxsimnetd
You can use the vxsimnetd command to start the VxWorks simulator network
daemon on your host system. You can configure the daemon using a configuration
file statically at startup time or you can configure it interactively using the
daemon’s debug shell. You can also combine these configuration methods which
allows you to use a configuration file to supply some defaults and read in
additional configuration files as needed.
NOTE: If the daemon must support an externally visible subnet, you must launch
the daemon from a task with the appropriate privileges. On a Solaris or Linux host,
this means starting the daemon with supervisor or root privileges. On a Windows
host, this means starting the daemon with administrator privileges.
52
5 Networking with the VxWorks Simulator
5.3 Setting Up the Network Daemon
-sv or -shellserver
This option starts the network daemon in server/background mode.
When in background mode, telnet to a debug port to access the debug
shell. The -sv and -s options are mutually exclusive.
-sp or -shellport
This option specifies the debug port used to start a shell on a network
daemon in background mode. If not specified, the default port is 7777. 5
-force
Forces the deletion of IPC objects left after vxsimnetd dies. (UNIX only)
To configure the daemon statically, use a command such as the following, where
vxsimnetd.conf is a file supplying configuration parameters:
> vxsimnetd -f vxsimnetd.conf
If you use the -sv option instead of the -s option, the debug shell runs in the
background and is accessible using telnet. For example:
> telnet hostname portNumber
The portNumber defaults to 7777, but vxsimnetd supports the -sp parameter, which
you can use to specify a different port number.
vxsimnetd can also be started without any configuration options. In this case, the
network daemon is started with a default external subnet of 192.168.200.0 with the
host node set in promiscuous mode.
You can access the network daemon debug shell by starting vxsimnetd with the -s
(or -shell) or -sv (or -shellserver) option. The shell supports command line
completion as well as history with two editing modes, emacs (default) or vi.
The available shell commands are:
subnet [subnetName]
This command displays subnet information. When no subnet is specified, the
command lists a summary for all configured subnets. A detailed summary is
provided when a subnet name is specified.
53
Wind River VxWorks Simulator
User’s Guide, 6.1
MAC ADDRESS:
Mac Address 7a:7a:c0:a8:c8:fe
SEND/RECEIVE STATISTICS:
# of receives 0
# of sends 6
# of send failures 6
packet subnetName
This command displays packet information for a subnet. For example:
vxsimnetd> packet default
PACKET INFORMATION:
CONFIGURED IN-USE MAX TOTAL FAIL
100 1 1 7 0
HANGING PACKETS:
PKT-# SEND-NODE RECV-NODE LEN REFCNT PKTPTR
0 192.168.200.254[E] N/A 1514 0 0xff0e2b14
In this example, the default subnet is configured with 100 packets, only 1 is
currently in use, and 7 packets were used over all. The hanging packets section
displays packets that are allocated but not yet sent.
54
5 Networking with the VxWorks Simulator
5.3 Setting Up the Network Daemon
help [command]
This command specifies detailed help for a given command. If no command is
specified, a summary of all available commands is provided.
?
Displays a one-line summary for all commands.
quit
5
This command exits the shell. If vxsimnetd was started with the -s option, this
command destroys all subnets and vxsimnetd exits. For more information on
vxsimnetd options, see 5.3.1 Starting the Network Daemon, p.48.
source configFile
This command reads subnet configuration information from a file and adds
the corresponding subnets. This option must be able to add all configured
subnets or no subnets will be added.
delete subnetName
This command deletes a configured subnet. To delete all subnets, use
delete all.
extpromisc subnetName 0
extpromisc subnetName 1
This command sets the promiscuous mode for the host node of an external
subnet. The 0 option sets promiscuous mode to off, 1 sets promiscuous mode
to on. When the external node is in promiscuous mode (1), it receives every
packet sent on the subnet. While this heavily impacts network performance, it
allows you to analyze network traffic by connecting a packet sniffer on the
external host node interface.
erate subnetName
This command sets the error rate for a given subnet. The error rate is the
percentage of packets that will not be sent without giving error notification to
the sender. Thus, if the error rate is set at 5 percent, 5 randomly chosen packets
per 100 will be purposely lost. This feature is provided to simulate packet loss
on an actual subnet.
timeout subnetName
This command sets the subnet timeout value. If a node does not read any
packets for the length of time specified as the timeout, the packets are picked
up by garbage collection.
mode vi
mode emacs
This command sets the shell editing mode to vi or emacs.
55
Wind River VxWorks Simulator
User’s Guide, 6.1
As an option, the vxsimnetd command (the command used to start the network
daemon) lets you specify a file containing network daemon configuration
parameter values. To assign a value to a parameter, enter a semicolon ( ; )
terminated line with the following general format:
PARAMETER = value;
This configures the VxWorks simulator network daemon to support a subnet with
external access. The network address for the subnet is 192.168.200.0 and, because
the network mask is not specified, the pre-CIDR1 default mask applies. For
192.168.200.0, that would be the mask for a class C address, which is 0xffffff00.
To add another subnet, you could add the lines:
SUBNET_START user1 {
SUBNET_UID = 323;
SUBNET_GID = 100;
SUBNET_ACCESSMODE = "0600";
SUBNET_ADDRESS = "192.168.201.0";
};
1. CIDR refers to classless inter-domain routing. See RFCs 1518 and 1519.
56
5 Networking with the VxWorks Simulator
5.3 Setting Up the Network Daemon
Parameter Description
Default Parameters:
57
Wind River VxWorks Simulator
User’s Guide, 6.1
Parameter Description
58
5 Networking with the VxWorks Simulator
5.3 Setting Up the Network Daemon
Parameter Description
Topology Parameters:
59
Wind River VxWorks Simulator
User’s Guide, 6.1
Parameter Description
Resource-Related Parameters:
Option Parameters:
60
5 Networking with the VxWorks Simulator
5.3 Setting Up the Network Daemon
Parameter Description
The VxWorks simulator network daemon can be configured with multiple external
subnets. However, the following caveats should be observed:
On Windows hosts:
A VxWorks simulator host connection driver (WRTAP) driver must be installed
and configured for each external subnet. (For information on installing and
configuring the WRTAP driver, see 5.4 Installing the Host Connection Driver,
p.62.) You may also want to specify a name for the WRTAP device driver used
by a given subnet through the SUBNET_EXTCONNNAME configuration
parameter.
On Linux hosts:
You must specify the device number of all but the first external subnet using
the SUBNET_EXTDEVNUM parameter.
61
Wind River VxWorks Simulator
User’s Guide, 6.1
This section provides instructions for installing the optional VxWorks simulator
host connection driver. You need install this driver only if you want to set up an
externally visible subnet (able to communicate with or through the host) of
VxWorks simulator instances. After this host driver is installed, vxsimnetd
automatically configures its IP address and mask according to the configuration
file. Packet sniffers such as tcpdump, snoop, or ethereal can then attach to this host
interface to monitor traffic on the internally simulated subnet.
Windows Hosts
62
5 Networking with the VxWorks Simulator
5.4 Installing the Host Connection Driver
NOTE: If you intend to use more than one external subnet, repeat the above steps
for each subnet. You must install and configure a WindRiver WRTAP driver
individually for each subnet that is marked as external. (Windows hosts only).
For more information on using the WRTAP driver on Windows hosts, see
5.4.1 Managing the WRTAP Driver on Windows Hosts, p.64.
Solaris Host
5. Select the Universal TAP device driver and answer “yes” to run the install
scripts.
63
Wind River VxWorks Simulator
User’s Guide, 6.1
Linux Host
The tun module required by the TAP driver must be available in your Linux
distribution.
NOTE: The tun driver is available by default as part of the core kernel package for
Red Hat Enterprise Linux Workstation 4.0 and later versions. It is also available as
part of the default distribution for SuSE Linux 9.2. However, the driver is not
available in the core kernel package of Red Hat Workstation 3.0, update 4 or earlier.
If you are using an earlier release of Red Hat (prior to Linux kernel version
2.4.21-20), the tun module is part of the kernel-unsupported rpm package. To use
the tun module with Red Hat Workstation 3.0, update 4 or earlier, you must update
your Linux kernel to version 2.4.21-20 and install the kernel-unsupported rpm
package.
The following information may be useful when installing and using the host
connection (WRTAP) driver on a Windows host. For instructions on installing the
WRTAP driver, see the 5.4 Installing the Host Connection Driver, p.62.
The WRTAP driver replaces the ULIP driver used in earlier VxWorks simulator
releases. The WRTAP driver can be used even if the ULIP driver is installed.
If you encounter networking problems with the VxWorks simulator or your host
system after installing the WRTAP driver, you may need to make certain changes
to your Windows network connection settings.
64
5 Networking with the VxWorks Simulator
5.4 Installing the Host Connection Driver
NOTE: You will need administrator privileges on the Windows host to make the
following changes.
65
Wind River VxWorks Simulator
User’s Guide, 6.1
This describes one interface. You can chain these together using a “;” delimiter. For
example:
> vxsim -ni "simnet2=192.168.2.1:0xfffffff0;simnet3=192.168.3.1:0xfffffff0;
simnet4=192.168.4.1:0xfffffff0"
NOTE: When using Wind River Workbench New Connection wizard to launch
your VxWorks simulator, the -ni option can be passed to the simulator using the
Other VxWorks Simulator Options field of the
VxWorks Simulator Miscellaneous Options dialog.
You can start a VxWorks simulator instance and attach to a subnet through its
name. For example, you can use the following commands:
> vxsim -d simnet
> vxsim -ni "simnet"
These commands start a simulator that attaches to the first configured subnet
(neither IPv4 address is specified). In this example, a MAC address can no longer
be deduced from the IP address so a node number is used instead. The first
attaching simulator instance gets 7a:7a:0:0:0:1, and the second instance gets
7a:7a:0:0:0:2 where 7a:7a is the subnet MAC prefix of the first configured subnet.
NOTE: In this example, the MAC address is no longer fixed and can change if the
simulator instance is rebooted. This may cause a problem with ARP tables.
66
5 Networking with the VxWorks Simulator
5.5 Configuring a Simulated Subnet
67
Wind River VxWorks Simulator
User’s Guide, 6.1
68
6
Networking Tutorials
6.1 Introduction 69
6.2 Simple Simulated Network 69
6.3 Basic Simulated Network with Multiple Simulators 73
6.4 IPv6 Tutorial 84
6.1 Introduction
This chapter presents tutorials that provide step-by-step instruction for setting up
a simulated network of VxWorks simulator instances. The network simulation is
demonstrated using the ping function. This chapter also includes an IPv6 tutorial
that describes how to set up your host system and VxWorks simulator instances to
communicate using IPv6 protocol.
69
Wind River VxWorks Simulator
User’s Guide, 6.1
simple network can be set up using the default VxWorks simulator configuration.
Therefore, the following tutorial does not require you to reconfigure or rebuild the
default VxWorks image provided with the VxWorks simulator BSP.
This tutorial describes how to:
1. Set up and start the VxWorks simulator network daemon (vxsimnetd).
2. Start a single VxWorks simulator instance.
3. Test the simulator network by pinging the VxWorks simulator instance from
the host.
This tutorial can be performed with any supported host using the command-line
utility, vxprj, or the Wind River Workbench IDE.
The first step in setting up a VxWorks simulator network is to start the network
daemon. For this tutorial, the network daemon is started on the host before any
VxWorks simulator instances are configured.
Before configuring and starting the VxWorks simulator network daemon, you
must install the VxWorks simulator host connection driver (WRTAP driver). If you
have not already installed the host connection driver, do so now. Instructions for
all supported hosts are provided in 5.4 Installing the Host Connection Driver, p.62.
This tutorial uses the default configuration for the VxWorks simulator network
daemon. Therefore, vxsimnetd can be started without any options and no custom
configuration file is required.
70
6 Networking Tutorials
6.2 Simple Simulated Network
NOTE: Wind River recommends that you start vxsimnetd as a service, see Starting
the Network Daemon as a Service, p.48 for complete instructions. If you have already
started vxsimnetd as a service or choose to do so now, you can skip the instructions
in this section.
Next, you need to start a VxWorks simulator instance from the command line in
the VxWorks development shell or from the Workbench New Target Connection
wizard. Again, the default VxWorks configuration is used for this tutorial so you
do not need to reconfigure or rebuild the default VxWorks image for the VxWorks
simulator.
71
Wind River VxWorks Simulator
User’s Guide, 6.1
To start a VxWorks simulator instance from the command line, do the following:
1. Open the VxWorks development shell.
On Windows hosts, select Start > Wind River > VxWorks 6.1 >
VxWorks Development Shell.
On Solaris and Linux hosts, run the wrenv utility program to open a
development shell as follows:
% wrenv.sh -p vxworks-6.1
where installDir is the name of your VxWorks install directory and bsp is the
name of the BSP directory for the VxWorks simulator on your host (For
example, simpc on Windows hosts).
The above command starts a VxWorks simulator instance and attaches it to the
default subnet. The VxSim0 console windows appears.
To start the VxWorks simulator instance from Workbench, complete the following
steps:
1. Select Target > New Connection.... This launches the New Connection
wizard.
2. In the Connection Type dialog box, select Wind River VxWorks Simulator
Connection from the selection list. Click Next.
3. In the Select Boot File Name field of VxWorks Boot Parameters dialog, click
the Standard Simulator (Default) radio button (this option should be selected
by default). This selects the default VxWorks image for the VxWorks simulator.
4. Enter 0 in the Processor Number field.
5. Click the Advanced Boot Parameters... button. In the boot device field, select
simnet from the drop down list. In the inet on ethernet (e) field, enter
192.168.200.1. Leave all other fields with their default settings. Click OK. This
returns you to the VxWorks Boot Parameters dialog of the New Connection
wizard, click Next.
72
6 Networking Tutorials
6.3 Basic Simulated Network with Multiple Simulators
6. The VxSim Memory Options dialog appears. Click Next to accept the default
options.
7. The VxWorks Simulator Miscellaneous Options dialog appears. Click Next
to accept the default options (all options are blank by default).
8. The Target Server Options dialog appears. Click Next to accept the default
options.
9. The Object Path Mappings dialog appears. Click Next to accept the default
6
options.
10. The Connection Summary dialog appears. Click Finish.
This boots VxWorks on the simulator target and launches the VxSim0 console
window. If your target connection fails or you encounter problems during
configuration, see the Wind River Workbench User’s Guide for more information.
To test that the simulated network is working, ping the simulator instance from
your host system. From a host command window or shell, type:
> ping 192.168.200.1
73
Wind River VxWorks Simulator
User’s Guide, 6.1
The following tutorial takes you through the steps of creating a simulated network
with a static configuration. The following steps are performed:
1. Configure and launch the VxWorks simulator network daemon (vxsimnetd).
2. Configure and build a VxWorks image for use with the VxWorks simulator
instances.
3. Launch the required simulator instances.
4. Run the ping application.
The first step in setting up your simulated network is to set up and start
vxsimnetd. Before completing the following steps, be sure that you have:
■
Stopped any previously started VxWorks simulator network daemons
(including those started as a service).
■
Installed the VxWorks simulator host connection driver (WRTAP driver).
(Instructions for installing the driver are available in 5.4 Installing the Host
Connection Driver, p.62.)
Now, create a vxsimnetd configuration file. Create the following file and save it as
vxsimTest.conf.
SUBNET_START sub2 {
SUBNET_ADDRESS = "192.168.200.0";
SUBNET_EXTERNAL = yes;
SUBNET_EXTPROMISC = yes;
};
SUBNET_START sub3 {
SUBNET_ADDRESS = "192.168.3.0";
SUBNET_EXTERNAL = no;
};
SUBNET_START sub4 {
SUBNET_ADDRESS = "192.168.4.0";
SUBNET_EXTERNAL = no;
};
Next, launch vxsimnetd using the configuration file you just created.
74
6 Networking Tutorials
6.3 Basic Simulated Network with Multiple Simulators
On Windows hosts:
Log in with administrator privileges and start vxsimnetd from a command
window as follows:
> installDir\vxworks-6.1\host\x86-win32\bin\vxsimnetd -f vxsimTest.conf
Be sure to provide the full path to your vxsimTest.conf file if it is not in your
current directory.
On Solaris or Linux hosts: 6
Log in as root and start vxsimnetd from a host shell as follows:
% installDir/vxworks-6.1/host/myHost/bin/vxsimnetd -f vxsimTest.conf
In this command line, myHost is your host type: x86-linux2 for Linux or
sun4-solaris2 for Solaris.
Be sure to provide the full path to your vxsimTest.conf file if it is not in your
current directory.
NOTE: You can also start vxsimnetd as a service. For instructions, see Starting the
Network Daemon as a Service, p.48. Note that if you choose to start vxsimnetd as a
service, you will need to configure the daemon as directed in this section before
proceeding with the tutorial.
NOTE: If you do not start vxsimnetd with administrator (or root) privileges,
vxsimnetd prints a warning. In this case, you will not be able to connect the host
system to the simulated network. However, all other simulated network
functionality is available.
In this tutorial, the VxSim0 simulator instance acts as a router. This requires that
IP forwarding be enabled in the VxWorks image. This tutorial also uses ping to
communicate between simulator instances so ping functionality must also be
enabled. Because this functionality is not included in the default VxWorks image,
you must configure and build a new VxWorks image for use with the simulated
network.
To properly configure the VxWorks image, you must set the IPFORWARDING_CFG
parameter to TRUE. In addition, the INCLUDE_ROUTECMD and INCLUDE_PING
components must be included in the VxWorks image. Once this configuration is in
place, you must rebuild the VxWorks image for the simulator.
75
Wind River VxWorks Simulator
User’s Guide, 6.1
To reconfigure the VxWorks image with the necessary components using the
command-line project facility, vxprj, complete the following steps:
1. Generate a project. This can be done from the command line as follows:
In the VxWorks development shell, type the following:
On Windows hosts:
> vxprj create simpc TOOL network_demo
where TOOL is your chosen compiler (diab for the Wind River Compiler or
gnu for the GNU compiler).
On Linux hosts:
% vxprj create linux TOOL network_demo
where TOOL is your chosen compiler (diab for the Wind River Compiler or
gnu for the GNU compiler).
On Solaris hosts:
% vxprj create solaris TOOL network_demo
where TOOL is your chosen compiler (diab for the Wind River Compiler or
gnu for the GNU compiler).
This creates a project directory under installDir with the name, network_demo.
2. Now, add the INCLUDE_ROUTECMD and INCLUDE_PING components to the
image and set the IPFORWARDING_CFG parameter to TRUE:
> cd c:\myInstallDir\network_demo
> vxprj component add INCLUDE_ROUTECMD INCLUDE_PING
> vxprj parameter set IPFORWARDING_CFG TRUE
1. Generate a project.
a. In Workbench, select File > New > VxWorks Image Project. This launches
the New VxWorks Image Project wizard.
b. In the Project dialog, enter network_demo in the Project name field.
Select the location for your project in the Location field (Create Project in
Workspace is selected by default). Click Next.
76
6 Networking Tutorials
6.3 Basic Simulated Network with Multiple Simulators
c. In the Project Setup dialog, select the option to set up your project based
on a board support package (this option is selected by default). And select
the appropriate VxWorks simulator BSP for your host (for example, simpc
on Windows hosts) and your desired tool chain (for example, diab). Click
Next.
d. In the Networking Options dialog, click Next to accept the default options
(no options are selected by default).
e. In the Configuration Profile dialog, select (Default) from the Profile 6
drop-down list. Click Finish.
This creates a project directory with the name, network_demo. The new
project should appear in the Project Navigator pane on the left.
2. Configure your kernel to include the appropriate networking components.
a. Expand the new network_demo project and right-click on Kernel
Configuration. Select Edit Kernel Configuration. This opens the
component configuration tool in the center pane of the Application
Development window.
b. Select the Components tab at the bottom of the kernel configuration pane
if it is not already selected. Right-click in the component configuration
field and select Find.... Use the Find tool to locate the
INCLUDE_ROUTECMD and INCLUDE_PING components. To find a
component, type the component name (for example, INCLUDE_PING) in
the Pattern field. When the component appears in the Matching items list,
select the component and click the Find button. This returns you to the
component configuration tool. The selected component is highlighted in
the component tree.
c. Right-click the selected component and select Include (quick include).
d. You can also use the Find tool to locate the IPFORWARDING_CFG
parameter. Once you have located the parameter and returned to the
component tree, change the value for the IPFORWARDING_CFG property
(located in the frame below the component tree) to TRUE. The component
tree should now show Enable IP forwarding between interfaces = TRUE.
e. Right-click in the component tree and select Save.
3. Build your project.
f. Now, right-click on the network_demo project in the Project Navigator
(upper left pane) and select Build Project (this executes the make
77
Wind River VxWorks Simulator
User’s Guide, 6.1
command in the project directory). The build output appears in the Build
Console (lower right pane).
Now, start the simulator instances to attach to the configured subnets. This results
in a simulated network with the following topology:
Host
192.168.200.254
VxSim0 VxSim1
192.168.200.1 192.168.200.2
VxSim2
VxSim3
192.168.4.1 192.168.4.2
You can launch the simulator instances from the VxWorks Development Shell
using the command line or from Workbench.
If you have not already done so, change to the directory where you built your
VxWorks image (installDir\network_demo).
78
6 Networking Tutorials
6.3 Basic Simulated Network with Multiple Simulators
To configure the VxWorks simulator instance for the simulated router, type the
following in the VxWorks development shell:
> vxsim -ni "simnet2=192.168.200.1;simnet3=192.168.3.1;simnet4=192.168.4.1"
The VxSim0 console window appears. The VxSim0 instance acts as the simulated
router.
6
Configure the Simulated Network Devices
To configure the VxWorks simulator instances for the simulated network devices,
type the following in the VxWorks development shell:
> vxsim -d simnet -e 192.168.200.2 -p 1
> vxsim -d simnet -e 192.168.3.2 -p 2
> vxsim -d simnet -e 192.168.4.2 -p 3
You should now have three simulated network devices; VxSim1, VxSim2, and
VxSim3.
First, start the VxWorks simulator instance that will act as the router in the
simulated subnet. To start this instance from Workbench, complete the following
steps:
1. Select Target > New Connection.... This launches the New Connection
wizard.
2. In the Connection Type dialog box, select Wind River VxWorks Simulator
Connection from the selection list. Click Next.
3. In the Select Boot File Name field of VxWorks Boot Parameters dialog, click
the Custom Simulator radio button. In the VxWorks Kernel Image field,
browse to your project location and click Open to select your VxWorks image
(projectLocation\network_demo\default\vxWorks).
4. Enter 0 in the Processor Number field. Click Next.
5. The VxSim Memory Options dialog appears. Click Next to accept the default
options.
79
Wind River VxWorks Simulator
User’s Guide, 6.1
Click Next.
7. The Target Server Options dialog appears. Click Next to accept the default
options.
8. The Object Path Mappings dialog appears. Click Next to accept the default
options.
9. The Connection Summary dialog appears. Click Finish.
This boots VxWorks on the simulator target and launches the VxSim0 console
window. VxSim0 acts as the simulated router.
Now, configure each of the remaining simulated devices (repeat the following
process for each instance). To configure each of the devices, complete the following
steps:
1. Select Target > New Connection....
2. In the Connection Type dialog box, select Wind River VxWorks Simulator
Connection from the selection list. Click Next.
3. In the Select Boot File Name field of VxWorks Boot Parameters dialog, click
the Custom Simulator radio button. In the VxWorks Kernel Image field,
browse to your project location and click Open to select your VxWorks image
(projectLocation\network_demo\default\vxWorks).
4. Enter 1 in the Processor Number field. (Enter 2 for this option when starting
the second instance and 3 when starting the third instance)
5. Click the Advanced Boot Parameters... button. In the boot device field, select
simnet from the drop down list. In the inet on ethernet (e) field, enter
192.168.200.2. (Enter 192.168.200.3 when starting the second instance and
192.168.200.3 when starting the third instance). Leave all other fields with their
default settings. Click OK. This returns you to the VxWorks Boot Parameters
dialog of the New Connection wizard, click Next.
6. The VxSim Memory Options dialog appears. Click Next to accept the default
options.
7. The VxWorks Simulator Miscellaneous Options dialog appears. Click Next
to accept the default options (all options are blank by default).
80
6 Networking Tutorials
6.3 Basic Simulated Network with Multiple Simulators
8. The Target Server Options dialog appears. Click Next to accept the default
options.
9. The Object Path Mappings dialog appears. Click Next to accept the default
options.
10. The Connection Summary dialog appears. Click Finish.
Once you have repeated this process for all three VxWorks simulator instances,
you will have three simulated network devices; VxSim1, VxSim2, and VxSim3.
6
Before pinging between simulators, you must add the appropriate routes.
In the VxSim1 shell, type:
-> routec ("add -net 192.168.3.0 192.168.200.1");
-> routec ("add -net 192.168.4.0 192.168.200.1");
NOTE: These route settings can be saved in files and run automatically. To do this,
specify the saved file as a startup script when invoking vxsim from the command
line as follows:
vxsim -d simnet -e 192.168.200.2 -p 1 -s filename
You can also specify the startup script when launching the simulator from the
Workbench by adding the startup script to the startup script (s) field in Advanced
Boot Parameter Options.
To verify the network connection, ping VxSim3 and VxSim2 from VxSim1 as
follows:
-> ping "192.168.3.2", 5
-> ping "192.168.4.2", 5
81
Wind River VxWorks Simulator
User’s Guide, 6.1
Before launching a the vxsimnetd shell server, be sure to kill all previously started
VxWorks simulator instances and then kill the previously started network
daemon.
Now, start the vxsimnetd shell server. From the command shell on Windows or the
host shell on Linux or Solaris, start vxsimnetd with the -sv option as follows:
> installDir\vxworks-6.1\host\myHost\bin\vxsimnetd -sv
NOTE: You must start vxsimnetd with administrator (or root) privileges. Once
vxsimnetd is started, administrator privileges are no longer required.
To configure vxsimnetd using the shell, you must create an additional subnet
configuration file. Create and save the following file:
SUBNET_START sub3 {
SUBNET_ADDRESS = "192.168.3.0";
SUBNET_EXTERNAL = no;
};
SUBNET_START sub4 {
SUBNET_ADDRESS = "192.168.4.0";
SUBNET_EXTERNAL = no;
};
82
6 Networking Tutorials
6.3 Basic Simulated Network with Multiple Simulators
The VxWorks simulator instances are launched in the same configuration and
manner described in Launch the VxWorks Simulator Instances, p.78.
Again, this sets up a simulated network with the following topology:
Host
192.168.200.254
VxSim0 VxSim1
192.168.200.1 192.168.200.2
VxSim2
VxSim3
192.168.4.1 192.168.4.2
83
Wind River VxWorks Simulator
User’s Guide, 6.1
NOTE: To run the following route commands, you must have administrator
privileges on Windows and supervisor privileges on UNIX.
Next, add the appropriate routing information to the VxSim2 instance. In the
VxSim2 console, type the following:
-> routec ("add -net 192.168.200.0 192.168.3.1");
-> routec ("add -net 192.168.200.0 192.168.4.1");
Now, verify the network connection by pinging the VxSim2 instance from the host
shell as follows:
> ping 192.168.3.2
84
6 Networking Tutorials
6.4 IPv6 Tutorial
■
configure the VxWorks simulator network daemon.
■
configure a VxWorks image for use as an IPv6-enabled simulator.
■
start your IPv6 VxWorks simulator network and test your connections.
This section describes how to set up your host system and the VxWorks simulator 6
network daemon for use with an IPv6 network.
In order to receive IPv6 packets from the VxWorks simulator subnet, you must
configure your host system with IPv6 support.
On Windows hosts, configure IPv6 support by issuing the following command
from a Windows command shell:
> ipv6 install
On Solaris hosts, IPv6 support is configured during setup. To confirm IPv6 support
on your host, assume root privileges and issue the following command in the host
shell:
% ifconfig -a6
This tutorial uses a network configuration that includes 2 subnets (default and
sub3) that are configured with IPv4 addresses. The IPv4 addresses are used only
to identify the subnets and to assign MAC addresses (see Starting a Simulator
Instance Without an IPv4 Address, p.66).
85
Wind River VxWorks Simulator
User’s Guide, 6.1
You can configure the VxWorks simulator network daemon (vxsimnetd) using one
of the following methods:
■
Start vxsimnetd Using a Static Configuration File
You can also configure the VxWorks simulator network daemon dynamically.
First, launch the vxsimnetd shell server as directed in Launch the vxsimnetd
Shell Server, p.82. Then, complete the following steps:
1. Create and save the following file as ipv6_tutorial_dynamic.conf:
SUBNET_START sub3 {
SUBNET_ADDRESS = "192.168.3.0";
SUBNET_EXTERNAL = no;
};
2. Now, connect to the vxsimnetd shell. From your host shell, type the following:
> telnet yourHostName 7777
86
6 Networking Tutorials
6.4 IPv6 Tutorial
NOTE: Before configuring your VxWorks image, make sure that your network
stack is enabled with IPv6 support. For information on building your network
stack with IPv6 support, see the Wind River Network Stack for VxWorks 6
Programmer’s Guide.
Solicitor Configuration
The solicitor configuration requires that your VxWorks image be configured with
the following components:
INCLUDE_IFCONFIG
INCLUDE_RTSOL
INCLUDE_PING6
You must also set the IPV6CTL_ACCEPT_RTADV_CFG parameter to TRUE and you
must specify the interface setting for RTSOL_COMMAND as "simnet0".
You can set these components using the vxprj command-line utility using the
following steps:
1. Create a project called demo_solicitor. For example:
> vxprj create -inet6 bsp TOOL demo_solicitor
where bsp is the BSP for your host system type (simpc, linux, or solaris) and
TOOL is your desired toolchain (diab or gnu).
2. Change to the demo_solicitor directory:
> cd installDir/demo_solicitor
87
Wind River VxWorks Simulator
User’s Guide, 6.1
NOTE: You can also create your project and configure your VxWorks image from
Workbench using the kernel configuration tool. For more information on
configuring components using Workbench, see Prepare Your VxWorks Image Using
Workbench, p.76 or the Wind River Workbench User’s Guide.
Advertiser Configuration
You must also set the IPV6CTL_ACCEPT_RTADV_CFG value to TRUE and you must
specify the interface setting for RTADV_COMMAND as "simnet0".
You can set these components using the vxprj command-line utility using the
following steps:
1. Create a project called demo_advertiser. For example:
> vxprj create -inet6 bsp TOOL demo_advertiser
where bsp is the BSP for your host system type (simpc, linux, or solaris) and
TOOL is your desired toolchain (diab or gnu).
2. Change to the demo_advertiser directory:
> cd installDir/demo_advertiser
88
6 Networking Tutorials
6.4 IPv6 Tutorial
NOTE: You can also create your project and configure your VxWorks image from
Workbench using the kernel configuration tool. For more information on
configuring components using Workbench, see Prepare Your VxWorks Image Using
Workbench, p.76 or the Wind River Workbench User’s Guide.
Before you can test the IPv6 connection, you must start your VxWorks simulator
instances using the VxWorks images you created.
First, create a startup script (default_startup) that specifies the prefix to advertise:
rtadvConfig ("simnet0 add 3ffe:1::");
Next, start one advertiser VxWorks simulator instance on the default subnet. You
can start the simulator instance from the VxWorks development shell using the
script you just created as follows:
> vxsim -p 0 -d simnet -e 192.168.200.1 -f
demo_advertiser/default/vxworks -s demo_advertiser/default_startup
89
Wind River VxWorks Simulator
User’s Guide, 6.1
This starts a VxWorks simulator instance (VxSim1) with the solicitor configuration
on the default subnet.
Now, start one advertiser and one solicitor instance on subnet 3. First, create a
startup script (sub3_startup) that specifies the prefix to advertise:
rtadvConfig ("simnet0 add 3ffe:2::");
Next, start the advertiser VxWorks simulator instance. You can start the simulator
instance from the VxWorks development shell using the script you just created:
> vxsim -p 2 -ni "simnet0=192.168.3.1;simnet1=192.168.200.3" -f
demo_advertiser/default/vxworks -s demo_advertiser/sub3_startup
This starts a VxWorks simulator instance (VxSim3) with the solicitor configuration
on subnet 3.
You can now check to see if the VxWorks simulator instances are correctly
configured.
NOTE: You may need to wait 10-30 seconds for the network autoconfiguration to
complete.
90
6 Networking Tutorials
6.4 IPv6 Tutorial
You can now ping the VxWorks simulator instances on the same subnet. The
default subnet (default) includes VxSim0, VxSim1, and the host system. Subnet 3
(sub3) includes VxSim2 and VxSim3.
In the VxSim1 console, you can ping VxSim0 with the local address as follows:
-> ping6 "fe80::787a:c0ff:fea8:c801%simnet0"
PING6(56=40+8+8 bytes) fe80::787a:c0ff:fea8:c802 -->
fe80::787a:c0ff:fea8:c801
16 bytes from fe80::787a:c0ff:fea8:c801 (fe80::787a:c0ff:fea8:c801):
icmp_seq=0 hlim=64 time=0 ms
91
Wind River VxWorks Simulator
User’s Guide, 6.1
You can also ping VxSim0 with the automatically configured address:
-> ping6 "3ffe:1::787a:c0ff:fea8:c801"
PING6(56=40+8+8 bytes) 3ffe:1::787a:c0ff:fea8:c802 -->
3ffe:1::787a:c0ff:fea8:c801
16 bytes from 3ffe:1::787a:c0ff:fea8:c801 (3ffe:1::787a:c0ff:fea8:c801):
icmp_seq=0 hlim=64 time=450.022 ms
In addition, you can set the routing such that you can ping between the default
subnet and subnet 3 through VxSim2. For an example of how to set up the routing
information, see the tutorials in 6.3 Basic Simulated Network with Multiple
Simulators, p.73.
92
A
Accessing Host Resources
A.1 Introduction 93
A.2 Accessing Host OS Routines 94
A.3 Loading a Host-Based Application 94
A.4 Host Application Interface (vxsimapi) 95
A.5 Tutorials and Examples 97
A.1 Introduction
The VxWorks simulator provides support to access the underlying host OS
routines from a VxWorks application and to call host code stored in a dynamic-link
library (DLL). That is, you can write a generic DLL (on any host) to control a
hardware device connected to the host. The DLL can then be loaded by, and
accessed through, the VxWorks simulator.
For information on the available host access routines, see the reference entry for
vxsimHostArchLib. vxsimHostArchLib also provides a host library (vxsimapi)
for VxWorks simulator host application development. For more information, see
the reference entry for vxsimapi.
93
Wind River VxWorks Simulator
User’s Guide, 6.1
You should observe the following guidelines when making a call to host code:
■ When a host routine is called from VxWorks code, you must always lock
interrupts before calling the routine. Failure to do so can result in unexpected
VxWorks simulator behavior.
■ When a host routine is called and the routine is system blocking, it will not
only block the VxWorks task from which it was called, but will also block the
entire VxWorks simulator.
To avoid blocking on a Windows simulator, create a specific thread that is
responsible for calling the potentially blocking host code and set up a simple
communication mechanism between VxWorks and the thread you have
created. For an example of this, see A.5.2 Controlling a Host Serial Device, p.99.
The method described for Windows simulators cannot be used on Linux or
Solaris simulators because these simulators do not support multithreading.
On these hosts, if the blocking system call is a device access, the solution is to
configure the host device to generate an interrupt when data becomes
available. For more information on using this method, refer to
A.4.2 Configuring a Host Device to Generate interrupts (UNIX Only), p.95.
94
A Accessing Host Resources
A.4 Host Application Interface (vxsimapi)
Applications often need to perform specific actions on exit. This includes items
such as releasing resources, re-initializing peripherals, and other cleanup
operations. The VxWorks simulator exit hook facility provides the
vxsimExitHookAdd( ) routine. This routine gives you the ability to specify a
routine to perform any necessary cleanup when the VxWorks simulator is exited
or rebooted.
The host file descriptors can be put in asynchronous mode, such that a SIGPOLL
signal is sent to the VxWorks simulator when data becomes available. If a VxWorks
task reads from a host device, the task normally requires a blocking read. Because
Linux and Solaris simulators are mono-threaded, this action stops the VxWorks
simulator process entirely until data is ready. As an alternative, you can open the
file in non-blocking mode and then put the device into asynchronous mode. This
causes a SIGPOLL signal to be sent whenever data becomes available. In this case,
an input ISR reads the data, puts it in a buffer, and unblocks the waiting task.
To install an ISR that runs whenever data is ready on some underlying host device,
you must first open the host device in non-blocking mode. Then, put the file
descriptor in asynchronous mode using the vxsimFdIntEnable( ) routine. This
95
Wind River VxWorks Simulator
User’s Guide, 6.1
ensures that the host will send a SIGPOLL signal when data is available. On the
target side, an interrupt service routine (ISR) is connected using intConnect( ).
The following code example shows how to do this on a host serial port.
Host side (DLL code linked with the vxsimapi library):
/* open host device in non-blocking mode */
fd = open ("/dev/ttyb", O_NONBLOCK);
/* Enable interrupts on file descriptor */
vxsimFdIntEnable (fd);
Target side:
/* connect the interrupt service routine */
intConnect (FD_TO_IVEC (fd), ISRfunc, 0);
Interrupts can also be disabled using vxsimFdIntDisable( ), and the ISR can be
disconnected using intDisconnect( ). For example:
Host side (DLL code linked with the vxsimapi library):
/* Disable interrupts on file descriptor */
vxsimFdIntDisable (fd);
Target side:
/* disconnect the interrupt service routine from file descriptor */
intDisconnect (FD_TO_IVEC (fd), ISRfunc, 0);
The vxsimIntRaise( ) routine provides a host side application with the ability to
notify VxWorks of a given event, allowing VxWorks to take the appropriate action.
For example, if you have an application collecting data from a device, you can raise
an interrupt to VxWorks when data has been read from the device. On the target
side of the application, an ISR can be connected to the interrupt vector using
intConnect( ). Now, each time vxsimIntRaise( ) is called, the ISR is called to
handle the read data.
When an interrupt needs to be acknowledged, the vxsimIntAckRtnAdd( ) routine
can be used to connect an acknowledgement routine for a given interrupt vector.
This routine is called immediately after the interrupt handling.
96
A Accessing Host Resources
A.5 Tutorials and Examples
This section provides a simple tutorial that illustrates how to load a standard Tcl
DLL on the VxWorks simulator, and start a Tcl interpreter.
Code Sample
The following code sample can be built as a downloadable kernel module for all
simulator types.
#include "vxWorks.h"
#include "vxsimHostLib.h"
#if (CPU==SIMNT)
#define TCL_DLL "tcl84.dll" /* Windows Tcl Dll name */
#else
#define TCL_DLL "libtcl8.4.so" /* Unix Tcl Dll name */
#endif
97
Wind River VxWorks Simulator
User’s Guide, 6.1
FUNCPTR pTcl_CreateInterp;
FUNCPTR pTcl_Init;
FUNCPTR pTcl_Eval;
FUNCPTR pTcl_GetStringResult;
FUNCPTR pTcl_DeleteInterp;
if (tclLoaded == FALSE)
{
if (vxsimHostDllLoad (TCL_DLL) != OK)
{
printf ("Error: Failed to load %s\n", TCL_DLL);
return (ERROR);
}
tclLoaded = TRUE;
}
if (evalResult != 0)
{
printf ("Tcl Error: ");
}
98
A Accessing Host Resources
A.5 Tutorials and Examples
if (strlen ((*pTcl_GetStringResult)(pInterp)) != 0)
printf ("%s\n", (*pTcl_GetStringResult)(pInterp));
The sample code can be executed directly from the VxWorks target shell or using
the host shell. A sample session is as follows:
-> ld < tclInterp.o
value = 1634769168 = 0x61709910
-> tclStart
Loading libtcl8.4.so ... succeeded.
Tcl Ready (Type CTRL+D to exit interprter)
tcl> glob *
tclInterp.c tclInterp.o hello.tcl
tcl> source hello.tcl
Hello !
tcl> ^Dvalue = 0 = 0x0
->
Controlling a host serial device is a more complex application that allows you to
control a host serial device from the VxWorks simulator. For an example of this
application type, see the reference entry for commSio (Windows simulators) or
ttySio (Linux or Solaris simulators). The examples provided for commSio and
ttySio exercise most of the features described in this chapter.
99
Wind River VxWorks Simulator
User’s Guide, 6.1
100
Index
101
Wind River VxWorks Simulator
User’s Guide, 6.1
D floating-point support 25
-force 53
-d 9
debugging 21
DEFAULT_ACCESSMODE 57 G
DEFAULT_ERATE 58
DEFAULT_EXTERNAL 57 -g 9
DEFAULT_EXTPROMISC 58 -gateway 9
DEFAULT_GARBAGE 57 gnu 19
DEFAULT_GID 57
DEFAULT_MACPREFIX 57
DEFAULT_TIMEOUT 58
DEFAULT_UID 57 H
development limitations 3, 43
-device 9 -h 10
devs( ) 38 hardware breakpoint support 25
diab 19 hardware simulation 36
DLL 93 -help 9
dosFsDevInit( ) 38 -hn 10, 36
dosFsMkfs( ) 38 host application interface 95
dynamic-link library host connection driver 62
see DLL 93 Linux 64
Solaris 63
Windows 62
host system requirements 6
E HOST_SIO_PORT_NUMBER 40
-hostinet 10
-e 9, 12 -hostname 10, 36
ELF object module format 20 hostSio 40
emacs 53
-ethernet 9
exit hook facility 95
exiting the VxWorks Simulator 13 I
-exitOnError 9, 13
ifconfig( ) 67
INCLUDE_BOOT_LINE_INIT 7
INCLUDE_HOST_SIO 40
F INCLUDE_IFCONFIG 87, 88
INCLUDE_KERNEL 30
-f 9, 12, 52 INCLUDE_NDP 88
-file 9, 52 INCLUDE_NET_BOOT_CONFIG 67
file system support 3, 23 INCLUDE_PASSFS 36
pass-through file system 24, 36 INCLUDE_PING 75
virtual disk 24, 37 INCLUDE_PING6 87, 88
-flags 9 INCLUDE_ROUTECMD 75
floating-point routines 25 INCLUDE_RTADV 88
102
Index
INCLUDE_RTSOL 87
INCLUDE_SM_COMMON 7, 41
M
INCLUDE_SM_NET 7, 41 MACH_EXTRA 18
INCLUDE_SM_OBJ 7, 41 macros
INCLUDE_SYS_TIMESTAMP 39 AUX_CLK_RATE_MAX 39
INCLUDE_TIMESTAMP 39 AUX_CLK_RATE_MIN 39
INCLUDE_VIRTUAL_DISK 37 HOST_SIO_PORT_NUMBER 40
intConnect( ) 27, 29, 96 INCLUDE_SM_NET 7
intDisconnect( ) 96 LOCAL_MEM_LOCAL_ADRS 34
interrupt assignments LOCAL_MEM_SIZE 34
Windows simulator 28 MACH_EXTRA 18
interrupt simulation 26 NV_RAM_SIZE 38
host signals 26 SYS_CLK_RATE_MAX 39 Index
on Linux and Solaris 26 SYS_CLK_RATE_MIN 39
on Windows 28 Makefile 7, 18
Windows messages 28 memory configuration 34
IPFORWARDING_CFG 41, 75 memory layout 30
IPv6 memory management support
configuring IPv6 support on your host running without MMU 23
system 85 memory management unit 3, 22
support 45 limitations 23
tutorial 84 MMU simulation 22
IPV6CTL_ACCEPT_RTADV_CFG 87, 88 page size 23
ISR_STACK_SIZE 30 translation Model 22
memory protection level 35
-memsize 10, 34
K migrating applications 43
MMU
-k 10 see memory management unit 3
-kill 10 MMU simulation 22
L N
-l 10 -n- nvram 10
linux 8 -netif 10
loading a VxWorks image 9 network daemon
LOCAL_MEM_LOCAL_ADRS 34 configuration file parameters 56
LOCAL_MEM_SIZE 34 configuration files 56
-logfile 10 network simulation 46
networking address space 30
-ni 10, 13
non-volatile RAM support 38
NV_RAM_SIZE 38
-nvram 38
103
Wind River VxWorks Simulator
User’s Guide, 6.1
O vxsimFdIntDisable( ) 96
vxsimFdIntEnable( ) 95
-o 10 vxsimHostDllLoad( ) 94
-other 10 vxsimHostProcAddrGet( ) 94, 95
vxsimIntAckRtnAdd( ) 96
vxsimIntRaise( ) 96
vxsimIntToMsg( ) 97
P vxsimMsgToInt( ) 97
RTADV_COMMAND 88
-p 10, 12 RTP support 3, 23
packet loss 55 RTSOL_COMMAND 87
packet sniffers 46, 55, 62
passDev 9
passFS
see pass-through file system 24 S
pass-through file system 24, 36
-password 10 -s 10, 52, 53
physical memory address space 34 serial I/O driver 40
-pl 10 serial line support 40
-processor 10 shared memory address space 30
-prot-level 10, 35 shared memory END driver 7
-pw 10 shared memory network 40
shared memory pool size 7
shared memory size 7
-shell 52, 53
R -shellport 53
-shellserver 53
remote host 14 SIGALRM 26
router configuration 13 SIGPOLL 26, 95
routines SIGUSR1 28
bootChange( ) 9, 12, 34 SIGUSR2 28
devs( ) 38 SIMLINUX 20
dosFsDevInit( ) 38 SIMNT 19
dosFsMkfs( ) 38 simpc 8
ifconfig( ) 67 SIMPENTIUM 20
intConnect( ) 96 SIMSPARCSOLARIS 20
intDisconnect( ) 96 simulated hardware support 3
sysAuxClkRateSet( ) 39 simulating packet loss 55
sysClkRateSet( ) 39 SIO driver 39
sysMemTop( ) 30 -size 10, 34
sysNvRamGet( ) 38 SM_MEM_SIZE 7
sysNvRamSet( ) 38 SM_OBJ_MEM_SIZE 7
virtualDiskClose( ) 38 smEnd 7
virtualDiskCreate( ) 38 solaris 8
virtualDiskInit( ) 38 -sp 53
vxsimExitHookAdd( ) 95 specifying the passFS device name 36
104
Index
105
Wind River VxWorks Simulator
User’s Guide, 6.1
106