logo资料库

VxWorks 653 Programmer's Guide v2.3.pdf

第1页 / 共326页
第2页 / 共326页
第3页 / 共326页
第4页 / 共326页
第5页 / 共326页
第6页 / 共326页
第7页 / 共326页
第8页 / 共326页
资料共326页,剩余部分请下载后查看
1 Overview
1.1 About This Documentation
1.2 Overview of VxWorks 653
1.3 Run-time System
1.3.1 Run-time Layers
1.3.2 Supported Target Architectures
1.3.3 Loading and Booting
1.3.4 Run-time Model
1.4 RTCA/DO-178B Certification
2 Developing vThreads Applications
2.1 Introduction
2.2 vThreadsTime Management
2.3 Handling External Stimuli
2.4 vThreads Memory Management
2.5 vThreads Initialization and Restart
2.6 Stack Overflow Protection
2.7 vThreads Device I/O
2.8 vThreads APIs
2.9 vThreads System Calls
3 Developing COIL Applications
3.1 Introduction
3.2 VxWorks 653 Architecture and COIL
3.3 Accessing Core OS Services
3.4 Communicating with Other Partitions
3.5 Handling Interrupts and Exceptions
3.6 Restarting COIL Partitions
4 Developing APEX Applications
4.1 Introduction
4.2 Adding APEX Support to vThreads Partitions
4.3 Terminology and Concepts: APEX VersusvThreads
4.4 Managing APEX Partitions
4.5 Managing APEX Processes
4.6 Managing Time in APEX Partitions
4.7 Communicating between Partitions
4.8 Communicating with Other Modules
4.9 Communicating within APEX Partitions
4.10 Monitoring Health in APEX Partitions
5 Developing POSIX Applications
5.1 Introduction
5.2 POSIX Clocks and Timers
5.3 POSIX Memory-Locking Interface
5.4 POSIX Threads
5.5 POSIX Scheduling Interface
5.6 POSIXSemaphores
5.7 POSIX Mutexesand Condition Variables
5.8 POSIX MessageQueues
5.9 POSIXQueued Signals
5.10 POSIX API for vThreads Partitions
6 Developing C++ Applications
6.1 Introduction
6.2 Configuring vThreads to Use C++
6.3 Writing C++ Applications
6.4 Using C++ Libraries
6.5 Writing C++ Cert Applications
7 Programming in the Core OS
7.1 Introduction
7.2 Partitions
7.3 VxWorks 653 Stacks
7.4 Shared Libraries
7.5 Shared Data Regions
7.6 User Configuration Records
7.7 Multitasking
7.8 Managing Memory
7.9 Restart Functionality
7.10 Partition Support
7.11 Worker Tasks
7.12 System Time
7.13 Partition Scheduling
7.13.1 TPS Scheduling
7.13.2 APPS Scheduling
7.13.3 Partition-Scheduling Routines
7.14 Design Models for Ports
7.15 Setting up Communication with Other Modules
7.16 Verifying Configuration Record Binaries
8 Health Monitoring
8.1 Introduction
8.2 Basic Health Monitor Concepts
8.3 Health Monitor Actions
8.4 Initializing the Health Monitor
8.5 Getting Health Monitor Information at Run-time
8.6 Defining the Health Monitor Handler Table
8.7 Health Monitoring for COIL Partitions
8.8 Other Facilities That Inject Alarms
8.9 Public Information
9 I/O Support
9.1 Introduction
9.2 I/O and vThreads
9.3 Application Multiplexed I/O
9.4 I/O and COIL
10 Cert File Systems
10.1 Introduction
10.2 DO-178B File System I/O Function Support
10.3 DO-178B File System Usage
A VxWorks 5.5
A.1 Introduction
A.2 VxWorks Tasks
A.2.1 Multitasking
A.2.2 Task StateTransition
A.2.3 Wind Task Scheduling
A.2.4 Task Control
A.2.5 TaskingExtensions
A.2.6 Task Error Status: errno
A.2.7 Task Exception Handling
A.2.8 Shared Code and Reentrancy
A.2.9 VxWorks System Tasks
A.3 Intertask Communications
A.3.1 Shared Data Structures
A.3.2 Mutual Exclusion
A.3.3 Semaphores
A.3.4 Message Queues
A.3.5 Pipes
A.3.6 Signals
A.4 VxWorks Events
A.5 Watchdog Timers
A.6 Interrupt Service Routines
B PowerPC Considerations
B.1 Introduction
B.2 Building Applications
B.3 MemoryManagement Unit
B.4 Protection Domains (PowerPC 60x)
B.5 Architecture Considerations
C IA-32 Considerations
C.1 Introduction
C.2 Building Applications
C.3 Memory Management Unit
C.4 Protection Domains
C.5 Architecture Considerations
Index
VxWorks653PROGRAMMER'S GUIDE2.3 ®VxWorks 653 Programmer's Guide, 2.3
Copyright © 2010 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, Tornado, and VxWorks are registered trademarks of Wind River Systems, Inc. The Wind River logo is a trademark 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: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 HeadquartersWind River500 Wind River WayAlameda, CA 94501-1153U.S.A.Toll free (U.S.A.):800-545-WINDTelephone: 510-748-4100Facsimile: 510-749-2010For additional contact information, see the Wind River Web site:www.windriver.com For information on how to contact Customer Support, see:www.windriver.com/support VxWorks653Programmer's Guide2.3 26 Jan 10
iiiContents1Overview ......................................................................................................11.1About This Documentation ...........................................................................................11.2Overview of VxWorks653 .............................................................................................21.2.1Overview of the vThreads Partition OS .........................................................21.2.2Overview of COIL .............................................................................................31.3Run-time System .............................................................................................................31.3.1Run-time Layers ................................................................................................4Core OS Layer ....................................................................................................4vThreads Layer ..................................................................................................5COIL Layer .........................................................................................................6APEX Layer ........................................................................................................6POSIX Layer .......................................................................................................61.3.2Supported Target Architectures ......................................................................61.3.3Loading and Booting ........................................................................................71.3.4Run-time Model ................................................................................................71.4RTCA/DO-178B Certification ........................................................................................72 Developing vThreads Applications ..........................................................92.1Introduction ......................................................................................................................92.2vThreads Time Management ........................................................................................112.2.1vThreads Timer Queue .....................................................................................112.2.2vThreads Scheduling ........................................................................................12Priority-Preemptive Scheduling .....................................................................12Round-Robin Scheduling .................................................................................122.3Handling External Stimuli ............................................................................................132.3.1vThreads Pseudo-Interrupt Signals ................................................................13Pseudo-Interrupt Events Forbidden in User Handlers ...............................15
VxWorks653Programmer's Guide, 2.3 ivPseudo-interrupt Events Permitted in User Handlers .................................162.3.2vThreads Synchronous Exception Handling ................................................162.4vThreads Memory Management ..................................................................................172.5vThreads Initialization and Restart .............................................................................182.5.1vThreads Boot Sequence ..................................................................................182.5.2vThreads Restart ................................................................................................20Cold Versus Warm Restarts .............................................................................20Cooperative Warm Partition Restart Mechanism .........................................21Partition Restart and Device Drivers ..............................................................222.6Stack Overflow Protection .............................................................................................222.6.1Guard Pages .......................................................................................................232.6.2Defaults ...............................................................................................................232.6.3Limitations .........................................................................................................232.7vThreads Device I/O .......................................................................................................252.8vThreads APIs ..................................................................................................................252.9vThreads System Calls ...................................................................................................253Developing COIL Applications ..................................................................273.1Introduction ......................................................................................................................273.2VxWorks653 Architecture and COIL ..........................................................................283.3Accessing Core OS Services ..........................................................................................293.4Communicating with Other Partitions .......................................................................293.5Handling Interrupts and Exceptions ...........................................................................303.5.1Handling Pseudo-Interrupts ...........................................................................303.5.2Handling Exceptions ........................................................................................313.6Restarting COIL Partitions ............................................................................................313.7Device I/O in COIL Partitions ......................................................................................323.8Monitoring Health in COIL Partitions .......................................................................323.9COIL API ..........................................................................................................................324Developing APEX Applications .................................................................334.1Introduction ......................................................................................................................334.2Adding APEX Support to vThreads Partitions ..........................................................34
Contentsv4.3Terminology and Concepts: APEX Versus vThreads ................................................354.4Managing APEX Partitions ............................................................................................354.4.1Allocating Partition Memory ...........................................................................354.4.2Initializing Partitions: Cold and Warm Starts ...............................................364.4.3Partition Attributes ...........................................................................................364.4.4Getting Partition Status ....................................................................................374.4.5Setting the Partition Mode ...............................................................................374.4.6Controlling Preemption in Partitions .............................................................384.4.7Setting New Partition Schedules .....................................................................394.5Managing APEX Processes ............................................................................................394.5.1Creating Processes .............................................................................................394.5.2Changing the Current Priority of Processes ..................................................404.5.3Increasing Deadline Times ...............................................................................404.5.4Getting the Current Status of Processes .........................................................414.5.5Getting Process IDs ...........................................................................................414.5.6Getting and Using vThreads Task Information ............................................414.5.7Types of Processes .............................................................................................414.5.8Scheduling Processes ........................................................................................424.5.9Process State Transitions ..................................................................................42DORMANT State ..............................................................................................43WAITING State ..................................................................................................43RUNNING State ................................................................................................44READY State ......................................................................................................454.5.10Suspending and Resuming Processes ............................................................454.5.11Stopping and Starting Processes .....................................................................464.5.12Controlling Preemption ....................................................................................464.6Managing Time in APEX Partitions .............................................................................474.6.1Scheduling Partitions ........................................................................................474.6.2System Clock Time ............................................................................................474.6.3Requesting Resources and Timeouts ..............................................................474.6.4Scheduling Processes ........................................................................................474.6.5Deadlines ............................................................................................................484.6.6Release Points ....................................................................................................504.7Communicating between Partitions ............................................................................504.7.1Limitations of APEX for Communicating between Partitions ...................514.7.2APEX Messages .................................................................................................514.7.3APEX Channels .................................................................................................52
VxWorks653Programmer's Guide, 2.3 viSampling Mode .................................................................................................52Queuing Mode ...................................................................................................534.7.4Ports ....................................................................................................................534.7.5Working with Queuing Messages ...................................................................554.7.6Working with Sampling Messages .................................................................564.8Communicating with Other Modules .........................................................................564.8.1Communicating Through Pseudo-Ports in a Pseudo-Partition ..................56Communicating Through Direct-Access Ports in a Pseudo-Partition .......574.8.2Communicating Through Direct-Access Ports in a Partition .....................58Sending and Receiving Messages ...................................................................584.9Communicating within APEX Partitions ....................................................................584.9.1Communicating Using APEX Buffers ............................................................584.9.2Communicating Using APEX Blackboards ...................................................604.9.3Communicating Using APEX Semaphores ...................................................624.9.4Synchronizing Using APEX Events ................................................................634.10Monitoring Health in APEX Partitions .......................................................................654.10.1Raising Process-Level Errors ...........................................................................654.10.2APEX Errors .......................................................................................................664.10.3Creating Error Handler Processes ..................................................................665Developing POSIX Applications ................................................................695.1Introduction ......................................................................................................................695.2POSIX Clocks and Timers .............................................................................................705.3POSIX Memory-Locking Interface ..............................................................................705.4POSIX Threads ................................................................................................................715.4.1pThread Attributes ............................................................................................71Stack Size ............................................................................................................71Stack Address ....................................................................................................71Detach State ........................................................................................................72Contention Scope ..............................................................................................72Inherit Scheduling .............................................................................................72Scheduling Policy ..............................................................................................73Scheduling Parameters .....................................................................................73Specifying Attributes when Creating pThreads ...........................................745.4.2pThread Private Data ........................................................................................755.4.3pThread Cancellation .......................................................................................755.5POSIX Scheduling Interface .........................................................................................75
Contentsvii5.5.1Comparison of POSIX and Wind Scheduling ...............................................765.5.2Getting and Setting POSIX Task Priorities ....................................................765.5.3Getting and Displaying the Current Scheduling Policy ..............................775.5.4Getting Scheduling Parameters: Priority Limits and Time Slice ................785.6POSIX Semaphores .........................................................................................................795.6.1Comparison of POSIX and Wind Semaphores .............................................795.6.2Using Unnamed Semaphores ..........................................................................805.6.3Using Named Semaphores ..............................................................................815.7POSIX Mutexes and Condition Variables ..................................................................835.8POSIX Message Queues .................................................................................................855.8.1Comparison of POSIX and Wind Message Queues .....................................855.8.2POSIX Message Queue Attributes ..................................................................855.8.3Displaying Message-Queue Attributes ..........................................................875.8.4Communicating through a Message Queue ..................................................875.8.5Notifying a Task That a Message Is Waiting .................................................895.9POSIX Queued Signals ..................................................................................................935.10POSIX API for vThreads Partitions .............................................................................946Developing C++ Applications ....................................................................956.1Introduction ......................................................................................................................956.2Configuring vThreads to Use C++ ...............................................................................956.2.1Specifying Additional Sections for Loading .................................................956.2.2Adding C++ Support to vThreads ..................................................................966.2.3Demangling C++ Symbol Names in the Target Shell ..................................966.3Writing C++ Applications ..............................................................................................966.3.1Making C Symbols Accessible to C++ Code .................................................96Making C++ Symbols Accessible to C code ..................................................966.3.2Adding Floating-Point Support to Tasks .......................................................966.3.3Handling Exceptions ........................................................................................96Turning off Exception Handling .....................................................................97Using the Pre-Exception Model of C++ Compilation ..................................97Installing Your Own Termination Handler ...................................................976.3.4Using Namespaces ............................................................................................976.3.5Disabling Run Time Type Information (RTTI) ..............................................976.3.6Constructors and Destructors ..........................................................................98
VxWorks653Programmer's Guide, 2.3 viii6.4Using C++ Libraries ........................................................................................................986.4.1Using the iostream Library ..............................................................................98Standard iostream Objects ...............................................................................986.4.2Using Standard Template Library (STL) ........................................................996.5Writing C++ Cert Applications .....................................................................................996.5.1Features Not Supported ...................................................................................996.5.2Persistent Global Constructors ........................................................................99Specifying Persistent Global Constructors in Makefiles .............................100Allocating Persistent Global Constructors ....................................................1006.5.3Calling Pure Virtual Functions ........................................................................1006.5.4Deallocating Heap .............................................................................................1017Programming in the Core OS ....................................................................1037.1Introduction ......................................................................................................................1047.2Partitions ...........................................................................................................................1047.2.1Partition Configuration ....................................................................................105System Call Permission Bitmasks ...................................................................107PPS Scheduling Parameters .............................................................................1097.3VxWorks653 Stacks ........................................................................................................109System Call Stacks .............................................................................................109Task Stacks ..........................................................................................................110Task Exception Stacks .......................................................................................110Interrupt Stack ...................................................................................................1107.4Shared Libraries ..............................................................................................................1107.4.1Adding User-supplied Code to a Partition OS .............................................1117.5Shared Data Regions ......................................................................................................1117.6User Configuration Records ..........................................................................................1147.7Multitasking .....................................................................................................................1147.8Managing Memory ..........................................................................................................1147.8.1Managing Memory Partitions and Heaps .....................................................115Managing Memory Partitions .........................................................................115Managing Typed Memory Partitions .............................................................116Managing the Current Heap ............................................................................1167.8.2Managing Virtual Memory ..............................................................................116Accessing the MMU ..........................................................................................117Ensuring Cache Coherency ..............................................................................117Write-Protecting Text Segments ......................................................................118Write-Protecting the Exception Vector Table .................................................118
分享到:
收藏