Upload
sreekanth-lakka
View
222
Download
4
Embed Size (px)
Citation preview
8/2/2019 Tornado 2 2 and VxWorks 5 5
1/54
Tornado and VxWorks
8/2/2019 Tornado 2 2 and VxWorks 5 5
2/54
Copyright Wind River Systems, Inc. 2
Tornado-VxWorks ArchitectureThe Real-Time, Multitasking OS
Intertask Synchronization and Communication
The Project Facility
The Debugging Tools
The Networking Stack
Tornado and VxWorks
8/2/2019 Tornado 2 2 and VxWorks 5 5
3/54
Copyright Wind River Systems, Inc. 3
What is Tornado?
Real-Time,
MultitaskingOS
Development and
Debugging
Tools
Networking
8/2/2019 Tornado 2 2 and VxWorks 5 5
4/54
Copyright Wind River Systems, Inc. 4
Tornado Architecture - HW Target
The tools, registry, and target server can run on differenthosts
VxWorks
Target Agent
Tool
Tool
Tool
Host Target
Target
Server
Registry
8/2/2019 Tornado 2 2 and VxWorks 5 5
5/54
Copyright Wind River Systems, Inc. 5
Tornado Architecture - Simulator Target
VxWorks runs as a process under the host OS
The simulator architecture provides no emulation ofinstruction, native compilers are used
Registry
Target
Server
VxWorks
Target Agent
Tool
Host
Tool
Tool
8/2/2019 Tornado 2 2 and VxWorks 5 5
6/54
Copyright Wind River Systems, Inc. 6
Tornado ArchitectureThe Real-Time, Multitasking OS
Intertask Synchronization and Communication
The Project Facility
The Debugging ToolsThe Networking Stack
Tornado and VxWorks
8/2/2019 Tornado 2 2 and VxWorks 5 5
7/54Copyright Wind River Systems, Inc. 7
What is a Task?
A task is a Kernel object dynamically created at runtime
Logical entity consisting of a Task Control Block (TCB) data structure andstack space
An independent thread of execution
A task is not a function However, a special purpose function (typically designed with an endless
loop) is used for the tasks entry point
Functions execute within the context of tasks
The VxWorks routine taskSpawn()invokes the entry point function foo
and gives the task its thread of liveness
foo()
{for (;;)
{waitForData( );/* Until external event occurs */processData( );}
}
8/2/2019 Tornado 2 2 and VxWorks 5 5
8/54Copyright Wind River Systems, Inc. 8
Creating a Task
8/2/2019 Tornado 2 2 and VxWorks 5 5
9/54Copyright Wind River Systems, Inc. 9
Multitasking
Separate tasks are created to perform different systemrequirements
For example, data acquisition and data computation
Each task alternates between ready and waiting A task manager (the multitasking kernel) is therefore required
VxWorks allows a task to wait for
A specified time delay (Delay)
An event such as an interrupt (Pend)
8/2/2019 Tornado 2 2 and VxWorks 5 5
10/54Copyright Wind River Systems, Inc. 10
Task States
8/2/2019 Tornado 2 2 and VxWorks 5 5
11/54Copyright Wind River Systems, Inc. 11
Multitasking Kernel
The wind kernel is that part of VxWorks which directlymanages tasks
It allocates the CPU to tasks according to the VxWorksscheduling algorithm
It uses Task Control Blocks (TCBs) to keep track of tasks One per task
Declared as WIND_TCBdata structure in taskLib.h
O.S. control information
state, task priority, delay timer,breakpoint list, error status,I/Oredirections
CPU Context Information
PC, SP, CPU registers, FPU registers
8/2/2019 Tornado 2 2 and VxWorks 5 5
12/54Copyright Wind River Systems, Inc. 12
Kernel Operation
Scheduler
8/2/2019 Tornado 2 2 and VxWorks 5 5
13/54Copyright Wind River Systems, Inc. 13
Multitasking Facilities
8/2/2019 Tornado 2 2 and VxWorks 5 5
14/54Copyright Wind River Systems, Inc. 14
Tornado-VxWorks ArchitectureThe Real-Time, Multitasking OS
Intertask Synchronization and Communication
The Project Facility
The Debugging ToolsThe Networking Stack
Tornado and VxWorks
8/2/2019 Tornado 2 2 and VxWorks 5 5
15/54Copyright Wind River Systems, Inc. 15
Intertask synchronization
In a multitasking environment, facilities to achieve mutualsynchronization are needed
Producer-consumer architecture
Client-server architecture
In VxWorks, intertask synchronization is achieved using Binary Semaphores
Message Queues
Events
Pipes Some intertask synchronization facilities (queues and
pipes) also enable data transmission (intertaskcommunication)
8/2/2019 Tornado 2 2 and VxWorks 5 5
16/54Copyright Wind River Systems, Inc. 16
Binary Semaphores
Binary semaphores exist in one of two states Full (synchronizing event has occurred)
Empty (synchronizing event has not occurred)
Intertask synchronization is obtained by creating anempty, binary semaphore for the synchronizing event
The task waiting for the event calls semTake( )and blocks untilthe semaphore is given
The task or interrupt service routine detecting the event callssemGive( ), which unblocks the waiting task
8/2/2019 Tornado 2 2 and VxWorks 5 5
17/54Copyright Wind River Systems, Inc. 17
Message Queues
Message queues are kernel objects used for passinginformation between tasks
Message queues provide a FIFO buffer of messages
The task waiting for the synchronization message callsmsgQueueReceive( )and blocks until a message is onthe queue
The task sending the synchronization message callsmsgQueueSend( ), which unblocks a pending task
Task A Task B
8/2/2019 Tornado 2 2 and VxWorks 5 5
18/54Copyright Wind River Systems, Inc. 18
Pipes
Pipes provide an alternative interface to the messagequeue facility in the VxWorks I/O system
Tasks block
When they read from an empty pipe, until data is available
When they write to a full pipe, until there is space available
Similar to their use of message queues, interrupt serviceroutines can write to a pipe, but cannot read from it
8/2/2019 Tornado 2 2 and VxWorks 5 5
19/54Copyright Wind River Systems, Inc. 19
Events
VxWorks events are means of synchronization between Tasks and tasks
Interrupt service routines and tasks
VxWorks objects (binary semaphores and message queues) andtasks
Only tasks can receive events, whereas tasks, interruptservice routines or VxWorks objects can send events
Events are synchronous in nature
The receiving task pends while waiting for the events to be sent
Events allow a task to wait simultaneously on multipleresources
For example, events can be sent by semaphores, messagequeues and other tasks
8/2/2019 Tornado 2 2 and VxWorks 5 5
20/54
Copyright Wind River Systems, Inc. 20
Mutual Exclusion Semaphores
Mutually exclusive access to shared resources isprovided in VxWorks by mutual-exclusion semaphores(mutexes)
VxWorks mutexes are designed to address issuesinherent to mutual exclusion, like
Priority inversion
Deletion safety
Recursive access to the shared resource
Semaphore ownership
Each critical section of the code has to be protected withmutexes, by having a task
Take the mutex before accessing the code
Give the mutex after having accessed it
8/2/2019 Tornado 2 2 and VxWorks 5 5
21/54
Copyright Wind River Systems, Inc. 21
Counting Semaphores
Counting semaphores are similar to binary semaphores,except that they keep track of the number of times thesemaphore is given or taken
Every time the semaphore is given, the count is incremented
Every time the semaphore is taken, the count is decremented When the count reaches zero, a task that tries to take the
semaphore is blocked
Counting semaphores are useful for guarding multiplecopies of resources
8/2/2019 Tornado 2 2 and VxWorks 5 5
22/54
Copyright Wind River Systems, Inc. 22
Signals
Signals asynchronously alter the control flow of a task An interrupt service routine or a task can send a signal to a task
The task which has received the signal will asynchronouslyexecute a signal handler
The signal handler executes in the receiving tasks context and
makes use of the tasks stack
If no signal handler is installed, the received signal is ignored
Since signals are asynchronous in nature, they are more
appropriate for error and exception handling than as ageneral-purpose intertask communication mechanism
8/2/2019 Tornado 2 2 and VxWorks 5 5
23/54
Copyright Wind River Systems, Inc. 23
Tornado-VxWorks ArchitectureThe Real-Time, Multitasking OS
Intertask Synchronization and Communication
The Project Facility
The Debugging ToolsThe Networking Stack
Tornado and VxWorks
8/2/2019 Tornado 2 2 and VxWorks 5 5
24/54
Copyright Wind River Systems, Inc. 24
Projects
The project facility allows one to manage two projecttypes
Bootable projects
To configure and build a VxWorks image
Downloadable projects To build and download application modules to a running target
Projects can be grouped together in Workspaces
For each project more than one build specification can beused
8/2/2019 Tornado 2 2 and VxWorks 5 5
25/54
Copyright Wind River Systems, Inc. 25
Bootable projects
Bootable projects are used to create a new, customizedVxWorks image
The system image consists of all desired system modules linkedtogether in a single, non-relocatable object module with nounresolved external references
The image can be customized by adding or removing VxWorkscomponents from the Workspace GUI
A bootable project is created specifying
A BSP
A toolchain (GNU or Diab)
8/2/2019 Tornado 2 2 and VxWorks 5 5
26/54
Copyright Wind River Systems, Inc. 26
Downloadable Projects
Downloadable projects are used to create relocatableobject modules that can be downloaded and dynamicallylinked to VxWorks
Module downloading and dynamic linking is performed by theTarget Server, which maintains a host-resident targets symboltable
Downloadable projects
Are created by specifying a toolchain
GNU or Diab
Allow on the fly development
Modules can iteratively be downloaded, tested and debuggedwithout rebooting the target system
8/2/2019 Tornado 2 2 and VxWorks 5 5
27/54
Copyright Wind River Systems, Inc. 27
Project Facility Workspace Window
3 Workspace window views
8/2/2019 Tornado 2 2 and VxWorks 5 5
28/54
Copyright Wind River Systems, Inc. 28
Tornado-VxWorks Architecture
The Real-Time, Multitasking OS
Intertask Synchronization and Communication
The Project Facility
The Debugging ToolsThe Networking Stack
Tornado and VxWorks
8/2/2019 Tornado 2 2 and VxWorks 5 5
29/54
Copyright Wind River Systems, Inc. 29
Host-Resident Debugging Tools
WindShell Command Shell Provides command-line based, interactive access to all run-time
facilities
Browser
System-object viewer, graphical companion to WindShell CrossWind Debugger
Remote source-level debugger
Extended version of the GNU source-level debugger (GDB)
WindView Software Logical Analyzer Dynamic visualization tool
8/2/2019 Tornado 2 2 and VxWorks 5 5
30/54
Copyright Wind River Systems, Inc. 30
WindShell
WindShell allows one to Access all VxWorks facilities by allowing calls to any VxWorks
routines
For example,
Spawning tasks
Creating VxWorks objects like semaphores, messagequeues, and pipes
Download object modules to the target system
Perform assembly-level debugging
Create and examine variables symbolically
Examine and modify memory
8/2/2019 Tornado 2 2 and VxWorks 5 5
31/54
Copyright Wind River Systems, Inc. 31
WindShell
8/2/2019 Tornado 2 2 and VxWorks 5 5
32/54
Copyright Wind River Systems, Inc. 32
Browser
The browser monitors the state of a target It shows detailed information on
Tasks
VxWorks objects (semaphores, message queues, ...)
Stack usage by all task on the target
Target CPU usage by task
Object-module structure and symbols
Interrupt vectors
The displays are snapshots, which can be updatedinteractively
Alternatively, the Browser can be configured to automaticallyupdate its display at specified intervals
8/2/2019 Tornado 2 2 and VxWorks 5 5
33/54
Copyright Wind River Systems, Inc. 33
Browser
8/2/2019 Tornado 2 2 and VxWorks 5 5
34/54
Copyright Wind River Systems, Inc. 34
CrossWind
CrossWind is a source level, graphical, debugging front-end using an enhanced version of GDB as its debuggingengine
It allows two debugging strategies
Task mode debugging
One task runs under debug control, while other tasks are notaffected
CrossWind can either
Attach to a running task, or
Start a new task under debugger control
System mode debugging
Whenever a task hits a breakpoint, the whole system stops
This is useful to debug tasks, interrupt service routines and pre-kernel execution
8/2/2019 Tornado 2 2 and VxWorks 5 5
35/54
Copyright Wind River Systems, Inc. 35
CrossWind
8/2/2019 Tornado 2 2 and VxWorks 5 5
36/54
Copyright Wind River Systems, Inc. 36
WindView 2.2
WindView allows one to study dynamic interactions of allthe elements of complex, real-time systems
8/2/2019 Tornado 2 2 and VxWorks 5 5
37/54
Copyright Wind River Systems, Inc. 37
WindView 2.2
The WindView graph provides manageable access toimportant application information
WindView allows
Scrolling the information forward and backward in time
Zooming in/out Tailoring the display to only focus on the tasks and events of
interest
Setting locks on certain events and searching for their successiveoccurrences
8/2/2019 Tornado 2 2 and VxWorks 5 5
38/54
Copyright Wind River Systems, Inc. 38
WindView 2.2 Example
8/2/2019 Tornado 2 2 and VxWorks 5 5
39/54
Copyright Wind River Systems, Inc. 39
Problem Solving with WindView 2.2
WindView allows to Detect race conditions, deadlocks, CPU starvation and other
problems related to task interaction
Determine application responsiveness and performance
See cyclic patterns in application behavior
Conduct post-mortem analysis of failed systems
Detect memory leaks
8/2/2019 Tornado 2 2 and VxWorks 5 5
40/54
Copyright Wind River Systems, Inc. 40
Tornado-VxWorks Architecture
The Real-Time, Multitasking OS
Intertask Synchronization and Communication
The Project Facility
The Debugging ToolsThe Networking Stack
Tornado and VxWorks
8/2/2019 Tornado 2 2 and VxWorks 5 5
41/54
Copyright Wind River Systems, Inc. 41
VxWorks Network Components
IP
TCP UDP
Socketszbuf
Shared MemoryNetwork
PPPEthernet
MUX
ftprshtelnetTargetserverNFS rlogin
netDrv
RPC
Application layer
Applicationprogramminginterface
Transport layer
Network layer
Link layer
8/2/2019 Tornado 2 2 and VxWorks 5 5
42/54
Copyright Wind River Systems, Inc. 42
Shared-Memory Backplane Network
This allows multiple processors to communicate over theircommon backplane as if they were communicating over anetwork by using a standard network driver
host
vx3
Ethernet
Shared-MemoryNetwork
Backplane (e.g. VME, PCI)
vx2 vx1
8/2/2019 Tornado 2 2 and VxWorks 5 5
43/54
Copyright Wind River Systems, Inc. 43
MUX The Network Driver Interface
This interface decouples the link layer and the networklayer
The network protocol does not need to be modified when addingnew network dirvers
A new network protocol can be added without modifying the
existing MUX-based network driver interfaces
8/2/2019 Tornado 2 2 and VxWorks 5 5
44/54
Copyright Wind River Systems, Inc. 44
TCP/IP Protocol Suite
Based on the 4.4 BSD TCP/IP release, the TCP/IPprotocol suite comprises
UDP User Datagram Protocol
Low-overhead delivery mechanism of datagrams, used byseveral applications like BOOTP, DHCP, DNS, TFTP, ...
TCP Transmission Control Protocol Reliable, end-to-end transmission mechanism, used by Telnet,
Rlogin, FTP, ...
IP Internet Protocol
Hop-by-hop protocol to transmit datagrams
ICMP Internet Control Messagge Protocol Reports unexpected events in data transfer, used by ping
IGMP Internet Group Management Protocol
Used to support multicasting
8/2/2019 Tornado 2 2 and VxWorks 5 5
45/54
Copyright Wind River Systems, Inc. 45
Sockets
Sockets allow processes to communicate within a singleCPU, across an Ethernet, across a backplane or acrossany connected combination of networks
VxWorks provides
BSD Sockets Datagram Sockets (UDP)
Stream Sockets (TCP)
Raw Sockets
Zbuf Sockets
An alternative set of sockets based on a data abstraction called
zbuf, zero-copy buffer
Applications can read and write BSD sockets without copyingdata between application buffers and network buffers
8/2/2019 Tornado 2 2 and VxWorks 5 5
46/54
Copyright Wind River Systems, Inc. 46
Remote Access Applications
RSH Remote Command Execution Allows a VxWorks application to run commands on a remote
system and receive the command results on standard output anderror over socket connection
Only the client side implementation is provided
A server running on the remote system is assumed FTP File Transfer Protocol
Both client and server applications are provided
NFS Network File System
Server component
A target running VxWorks act as a file server for any systemthat runs an NFS client
Client component
A target running VxWorks can mount a remote file system
8/2/2019 Tornado 2 2 and VxWorks 5 5
47/54
Copyright Wind River Systems, Inc. 47
Remote Access Applications (contd)
TFTP Trivial File Transfer Protocol Client and Server applications are provided
Unlike FTP or RSH, TFTP does not require any authentication
Rlogin Remote Login
On a VxWorks terminal, rlogin( )gives users the ability to log in to
remote systems on the network
The remote login daemon, rlogind(), allows remote users to login to VxWorks
Telnet
The server application only is provided
RPC Remote procedure call
RPC implements a client-server model of task interaction
A client requests a remote service from a server and waits for areply
8/2/2019 Tornado 2 2 and VxWorks 5 5
48/54
Copyright Wind River Systems, Inc. 48
DNS and SNTP
DNS Domain Name System DNS is a distributed database used by TCP/IP applications that
maps hostnames to IP addresses
SNTP
Simple Network Time Protocol Client and server components are provided
The client is normally used to maintain its system internal clockaccuracy based on time values reported by one or moreservers
The server provides time information to other systems
8/2/2019 Tornado 2 2 and VxWorks 5 5
49/54
Copyright Wind River Systems, Inc. 49
BOOTP Bootstrap Protocol
The BOOTP server Retrieves boot information from the Bootp Database (bootptab)
Supplies an Internet host with an IP address and relatedconfiguration information
The IP address is permanently assigned
The BOOTP client
Uses broadcasts to discover an appropriate server
Lets a target retrieve a set of boot parameters like an IP addressand a filename of the bootable image
Both client and server components are provided
BOOTP is implemented on top of UDP
DHCP Dynamic Host Configuration
8/2/2019 Tornado 2 2 and VxWorks 5 5
50/54
Copyright Wind River Systems, Inc. 50
DHCP Dynamic Host ConfigurationProtocol
Like BOOTP, DHCP allows the permanent allocation ofconfiguration parameters to specific clients
However, DHCP also supports the assignment of anetwork address for a finite lease period
VxWorks includes a DHCP client, server, and relay agent The client can retrieve one or more sets of configuration
parameters from either a DHCP or BOOTP server
The server can process both BOOTP and DHCP
messages The DHCP relay agent provides forwarding of DHCP and
BOOTP messages across subnet boundaries
8/2/2019 Tornado 2 2 and VxWorks 5 5
51/54
Copyright Wind River Systems, Inc. 51
IP Routing
If the destination is directly connected to the sender (e.g.,a point-to-point link) or on a shared network (e.g.,Ethernet), then IP datagrams are sent directly to thedestination
Otherwise, the sender sends the IP datagrams to a default router,and lets the router deliver them to destination
Each router maintains a routing table, which is used todeliver the IP datagrams to either
A local IP address, for a direct route, or
The next-hop router IP address, for an indirect route
8/2/2019 Tornado 2 2 and VxWorks 5 5
52/54
Copyright Wind River Systems, Inc. 52
Dynamic Routing Protocols
Dynamic routing occurs when routers talk to adjacentrouters, informing each other of what network each routeris connected to
Entries in the routing tables change dynamically as routes
change over time The Routing Information Protocol (RIP) is provided with
VxWorks
This is intended for small to medium-sized networks
The longest path must be less than 16 hops It uses a distance-vector protocol
It contains a vector of distances as the hop count
RIP version 1 and 2 are supported
8/2/2019 Tornado 2 2 and VxWorks 5 5
53/54
Copyright Wind River Systems, Inc. 53
Summary
Tornados three components VxWorks, real-time, multitasking operating system
Priority-based, preemptive scheduling algorithm
Intertask synchronization and communication services
Project facility and debugging tools Bootable and downloadable projects
Networking
Connects hosts and targets during development anddebugging
TCP/IP stack
Rich set of network applications and protocols
8/2/2019 Tornado 2 2 and VxWorks 5 5
54/54
References
Manuals available either in the Tornado on-line help, orvia the Wind River Bookstore at:www.windriver.com/windsurf/bookstore
Tornado Users Guide
WindView Users Guide and Users Reference
VxWorks Programmers Guide
VxWorks OS Libraries
VxWorks Network Programmers Guide
http://www.windriver.com/windsurf/bookstore/ehttp://pid_2.0_ws_agenda.ppt/http://www.windriver.com/windsurf/bookstore/e