vxworks653编程手册
VxWorks开发教程(2024)
03
无线通信应用案例分 析
通过分析一个具体的无线通信应用案 例,展示如何在VxWorks系统中实现 无线通信功能,并提供一些优化和改 进的建议。
2024/1/28
35
08
图形界面开发与多媒体应用支 持
Chapter
2024/1/28
36
图形界面开发框架介绍
WindML
2024/1/28
29
设备驱动开发流程
01
需求分析
明确设备的功能需求、性能需求 和接口需求,为后续的设备驱动
开发提供基础。
03
编码实现
依据设计文档,使用C语言等编程 语言实现设备驱动的代码编写。
2024/1/28
02
设计阶段
根据需求分析结果,设计设备驱 动的整体架构、数据结构和函数
接口等。
04
测试与验证
2024/1/28
10
建立工程及源代码管理
创建新工程
在Workbench中,选择“File”->“New”>“VxWorks Project”,然后按照向导创建一个 新的VxWorks工程。
配置工程属性
在工程属性中,你可以设置编译选项、包含路径 、链接库等。确保这些配置与你的目标机和源代 码相匹配。
配的内存。
使用memPartAlloc和memPartFree函数:VxWorks提供了内存分区管理功能,可以 使用memPartAlloc函数从指定的内存分区中分配内存,使用memPartFree函数释放
内存到相应的分区。
2024/1/28
使用taskAlloc和taskFree函数:针对任务相关的内存分配,可以使用taskAlloc和 taskFree函数。这些函数会从任务的控制块中分配和释放内存。
vxworks_cli_tools_users_guide_6.6命令行使用说明
VxWorks®COMMAND-LINE TOOLS USER'S GUIDE6.6Copyright 2007 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:/company/terms/trademark.htmlThis 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 River Systems, Inc.500 Wind River WayAlameda, CA 94501-1153U.S.A.toll free (U.S.): (800) 545-WINDtelephone: (510) 748-4100facsimile: (510) 749-2010For additional contact information, please visit the Wind River URL:For information on how to contact Customer Support, please visit the following URL: /supportVxWorks Command-Line Tools User's Guide, 6.66 Nov 07Part #: DOC-16079-ND-00Contents1Overview (7)1.1Introduction (7)1.2What’s in This Book (8)1.3Related Documents (9)2Setting Environment Variables (11)2.1Introduction (11)2.2Invoking wrenv (12)2.3Options to wrenv (13)2.4install.properties and package.properties (15)3Configuring and Building VxWorks (17)3.1Introduction (17)3.2Using vxprj (18)3.2.1Creating Kernel Configuration Projects (18)Checking the Toolchain (20)Copying Projects (21)iiiVxWorksCommand-Line Tools User's Guide, 6.6iv Using Profiles (21)3.2.2Deleting Projects (21)3.2.3Modifying Projects (22)Adding Components (22)Removing Components (23)Setting Configuration Parameter Values (23)Changing the Project Makefile Name (24)Adding and Removing Individual Files (24)3.2.4Generating Project and Component Diagnostics (24)Obtaining a List of Components (24)Checking a Component (26)Checking Component Dependencies (26)Listing Configuration Parameters and Values (26)Listing the Source Files in a Project (27)3.2.5Building Kernel Configuration Projects with vxprj (28)Examining Build Specifications and Rules (28)Changing Build Settings (29)Adding and Changing Build Rules (29)3.2.6Example vxprj Session (30)3.2.7Creating a Standalone Kernel Image (30)3.3Using cmpScriptLib and Other Libraries (31)3.3.1Building Kernel Configuration Projects with cmpScriptLib (32)4Configuring and BuildingApplication Projects (33)4.1Introduction (33)4.2Other VxWorks Project Types (34)4.3RTP and Library Projects (35)4.4RTP Applications and Libraries (35)4.4.1RTP Application Makefiles (35)4.4.2RTP Libraries (37)Contents4.4.3Makefile and Directory Structure (37)4.4.4Rebuilding VxWorks RTP (User-Mode) Libraries (37)4.4.5Make Variables (38)4.5Downloadable Kernel Modules (41)5Connecting to a Target (43)5.1Introduction (43)5.2Connecting to a Target Board (43)5.3Using the VxWorks Simulator (44)A Configuring and Building VxWorks Using config.h (47)A.1Introduction (47)A.2Configuring an Image Using config.h (48)A.3Configuration Examples (49)A.3.1Removing Network Support (49)A.3.2Adding RTP Support (49)A.4Using make (50)A.4.1Makefile Details (50)Customizing the VxWorks Makefile (51)Commonly Used Makefile Macros (51)A.4.2Building Custom Boot Loaders (55)Index (57)vVxWorksCommand-Line Tools User's Guide, 6.6 vi1Overview1.1Introduction71.2What’s in This Book81.3Related Documents91.1IntroductionThis guide describes the command-line host tools provided with VxWorks. Itcomplements the Wind River Workbench User’s Guide for programmers who preferto do development tasks outside of the Workbench IDE’s graphical interface orwho need to create scripted build environments.The Workbench IDE includes many features, such as code browsing, host-targetcommunication, and multicore debugging, that are not available from thecommand line. For a complete description of the Workbench environment, see theWind River Workbench User’s Guide. For information about the VxWorks operatingsystem and developing applications that run under it, see the VxWorks KernelProgrammer’s Guide and VxWorks Application Programmer’s Guide.Workbench ships with two compilers and associated toolkits: The Wind RiverCompiler (sometimes called the Diab compiler) and GCC (part of the GNUproject). Both toolkits use the GNU make utility for VxWorks applicationdevelopment. To the largest extent possible, these toolkits have been designed forinteroperability, but it is not always safe to assume that code written for one set of7VxWorks Command-Line Tools User's Guide, 6.68tools will work perfectly with the other. While examples in this guide may use either or both compilers, it is best to select one compiler and toolkit before starting a project.The Wind River Compiler and tools are documented in a separate user’s guide for each supported target architecture. For example, information about the PowerPC compiler is in the Wind River Compiler for PowerPC User’s Guide . GCC and the other GNU tools are documented in a series of manuals from the Free SoftwareFoundation, including Using the GNU Compiler Collection , that are provided with this release.Workbench includes a variety of other tools whose use is illustrated in this guide. In many cases, readers are referred to another document for detailed information about a tool. This guide is a roadmap for command-line development, but it is not self-contained.Before starting to work with the tools, read 2.Setting Environment Variables .1.2 What’s in This BookThis guide contains information about the following topics:■This chapter introduces the command-line tools and reviews the contents ofthe guide.■Chapter 2 shows how to use the environment utility (wrenv ) to setenvironment variables in a host development shell.■Chapter 3 explains how to create and modify projects with vxprj and other Tcl scripts. It discusses VxWorks components and kernel configuration.■Chapter 4 explains how to build applications with vxprj and other tools, and describes the VxWorks build model.NOTE: Throughout this guide, UNIX refers to both Solaris and Linux hostdevelopment environments. Windows refers to all supported versions of Microsoft Windows.Examples in this guide include both UNIX and Windows command lines. It is assumed that the reader can make appropriate modifications—such as changing forward slashes (/) to backward slashes (\)—depending on the environment.1 Overview 1.3 Related Documents91■Chapter 5 explains how to run compiled applications on targets and simulators.1.3Related DocumentsWind River Workbench Host Shell User’s GuideWind River Workbench User’s GuideWind River VxWorks Kernel Programmer’s GuideWind River VxWorks Application Programmer’s GuideWind River VxWorks Simulator User’s GuideVxWorksCommand-Line Tools User's Guide, 6.6 102 Setting Environment Variables2.1Introduction112.2Invoking wrenv122.3Options to wrenv132.4install.properties and package.properties152.1IntroductionTo use the tools efficiently from the command line, you need to configure someenvironment variables and other settings. The best way to do this is with the wrenvenvironment utility, which sets up a development shell based on information in theinstall.properties file.When using the Workbench tools from the command line, always begin by invoking theenvironment utility as shown in the next section. The wrenv utility, which is also runby the IDE on startup, guarantees a consistent, portable execution environmentthat works from the IDE, from the command line, and in automated build systems.Throughout this guide, whenever host operating system commands are shown ordescribed, it is assumed that you are working from a properly configureddevelopment shell created by wrenv.VxWorksCommand-Line Tools User's Guide, 6.62.2Invoking wrenvAssuming a standard installation of Workbench, you can invoke wrenv as follows.UNIXAt your operating system’s shell prompt, type the following:% installDir/wrenv.sh -p vxworks-6.6However, if your shell configuration file overwrites the environment every time anew shell is created, this may not work. If you find that you still cannot invoke theWorkbench tools after executing the command above, try this instead:% eval `installDir/wrenv.sh -p vxworks-6.6 -o print_env -f shell`where shell is sh or csh, depending on the current shell program. For example: % eval `./wrenv.sh -p vxworks-6.6 -o print_env -f sh`WindowsYou can invoke wrenv from the command prompt by typing the following:C:\> installDir\wrenv.exe -p vxworks-6.6You can also invoke wrenv and start a development shell window using theshortcut installed under Start>Programs> Wind River> VxWorks6.6&General Purpose Technologies>VxWorks Development Shell. This shortcutinvokes wrenv to open a Windows command prompt configured with the properenvironment variables.Workbench also supplies a fully configured Windows version of the Z shell(sh.exe). The Z shell, sometimes called zsh, gives Windows users a UNIX-likecommand-line interface.2 Setting Environment Variables2.3 Options to wrenv 22.3 Options to wrenvThe wrenv utility accepts several options, summarized in Table 2-1, that can beuseful in complex build environments. For most purposes, -p is the only optionyou need.T able 2-1Options for wrenv Option Meaning Example-e Do not redefine existing environment variables.(Variables identified with addpath ininstall.properties are still modified.)% wrenv.sh -p vxworks-6.6 -e -f format Select format for print_env or print_vars (see -o ):plain (the default)shcshbattclC:\> wrenv -p vxworks-6.6 -o print_vars -f sh -i path Specify the location of install.properties .(Overrides the default method of findinginstall.properties .)% wrenv.sh -p vxworks-6.6 -i directoryPath /install.properties-o operation Select operation :runThe default operation. Configures theenvironment and creates a command shellin which subsequent commands areexecuted. Checks the value of SHELL(usually defined under UNIX) todetermine which shell program to invoke;if SHELL is not defined, it checks ComSpec(Windows).C:\> wrenv -p vxworks-6.6 -o run % wrenv.sh -p vxworks-6.6 -o runprint_vars aShow environment settings that would bemade if wrenv were invoked with -o run .C:\> wrenv -o print_varsVxWorksCommand-Line Tools User's Guide, 6.6print_env aLike print_vars, but shows only variablesthat are exported to the systemenvironment. (Such variables are identifiedwith export or addpath, rather thandefine, in install.properties.)% wrenv.sh -o print_envprint_packages aList the packages defined ininstall.properties and their attributes. (Thedisplayed name of a package can later bespecified with the -p option.)C:\> wrenv -o print_packagesprint_compatible aUse with -p. Show the list of packagesdefined in installation.properties ascompatible with the specified package.Helpful for determining which IDEversion works with a given target OSplatform.% wrenv.sh -p vxworks-6.6 -o print_compatibleprint_package_name aUse with -r. Show the name of the package in the specified root directory.C:\> wrenv -r directory -o print_package_name-p package Specifyapackage (a set of Workbench components)for environment initialization. The package mustbe defined in install.properties.% wrenv.sh -p vxworks-6.6-r root Specify the root path for a package. (Overrides the default method of finding packages.) Usually, theroot path is a directory under installDir that has thesame name as the package.C:\> wrenv -p vxworks-6.6 -r directory-v Verbose mode. Show all altered environment settings.% wrenv.sh -p vxworks-6.6 -vT able 2-1Options for wrenv (cont’d)Option Meaning Example2 Setting Environment Variables2.4 install.properties and package.properties 22.4 install.properties and package.propertiesThe install.properties file is a hierarchical registry of package components. Itaggregates information from the package.properties files that accompany eachinstalled package. An entry in a properties file has the following form:rootkey .subkey [=value ][.subkey [=value ] ...]env =value Set the specified variable in addition to other environment settings. Overridesinstall.properties .b env =value must be the last itemon the command line, except for command [args ] (seebelow).C:\> wrenv -p vxworks-6.6 PATH=directory command [args ]Execute the specified command in the new shellenvironment. (Does not open a new shell.) Must be the last item on the command line.% wrenv.sh -p vxworks-6.6 ls *.sha.These operations are primarily for internal use and may change in later releases.b.Once a setting has been overridden with this option, wrenv maintains the override on subsequentexecutions—even if the option is omitted from the command line—as long as the new shell is running. A list of overridden settings is stored in a temporary variable called WIND_PROTECTED_ENV that disappears when the shell terminates.T able 2-1Options for wrenv (cont’d)Option Meaning ExampleVxWorksCommand-Line Tools User's Guide, 6.6A root key (for example, vxworks66) identifies each package. Subkeys include name, version, and so forth. The entries for a typical package look like this: =vxworks-6.6vxworks66.version=6.6vxworks66.type=platformvxworks66.subtype=vxworksbel=Wind River VxWorks 6.6# this entry shows which version of Workbench works with vxworks-6.6patible=workbench-2.2# eval entries tell wrenv to make environment settings; see belowvxworks66.eval.01=export WIND_HOME=$(builtin:InstallHome)vxworks66.eval.02=export WIND_BASE=$(WIND_HOME)$/vxworks-6.6vxworks66.eval.03=require workbench-3.0vxworks66.eval.04=addpath PATH $(WIND_BASE)$/host$/$(WIND_HOST_TYPE)$/bin ...An eval subkey specifies an environment processing command, such as defining an environment variable. Each eval subkey has a unique integer subkey appended to it that determines the order in which wrenv executes commands. However, if there are multiple definitions for the same variable, the first (lowest-numbered) definition takes precedence and subsequent definitions are ignored.A define value for an eval key defines a variable for internal use, but does not export it to the system environment. An export value defines a variable and exports it to the system environment. An addpath value prefixes an element to an existing path variable.A require value for an eval key specifies the name of another package in which to continue eval processing. An optional value is similar to a require value, except that the command is treated as a no-op if the referenced package does not exist. Comment lines in a properties file begin with a # symbol.Properties files are created during installation and should not ordinarily be edited.3Configuring and BuildingVxWorks3.1Introduction173.2Using vxprj183.3Using cmpScriptLib and Other Libraries313.1IntroductionThis chapter explains how to create and modify VxWorks projects with the vxprjutility and related Tcl libraries. It contains information about VxWorkscomponents and kernel configuration. It also describes the use of profiles andbundles to provide higher-level logical groupings of components.A VxWorks component is a functional unit of code and configuration parameters. Aproject is a collection of components and build options used to create an applicationor kernel image. Components are defined with the Component DescriptionLanguage (CDL) and stored in .cdf files; for more information about componentsand CDL, see the VxWorks Kernel Programmer’s Guide. Projects are defined in .wpjor .wrproject files1; for more information about projects, see the Wind RiverWorkbench User’s Guide.1..wrproject files are created and used by the IDE.VxWorksCommand-Line Tools User's Guide, 6.6Wind River provides a variety of tools for managing projects:■For most purposes, vxprj is the easiest way to manage kernel configuration projects from the command line. However, vxprj manages kernelconfiguration projects only. (A kernel configuration project, also called a VxWorksimage project, is a complete VxWorks kernel, possibly with additionalapplication code, that can be downloaded and run on a target.)■Other Tcl libraries supplied with VxWorks—especially cmpScriptLib—provide direct access to scripts called by vxprj.■The IDE‘s project management facility handles additional types of project, such as downloadable kernel modules, shared libraries, RTPs, and file systemprojects, and offers features of its own that are not available fromcommand-line tools.■The default make system that uses Makefiles and the config.h file provide BSP and driver developers a way to build kernels. In general, this method of buildmanagement should only be used for early-stage development.It is always possible to create and modify projects by directly editing VxWorkscomponent and source code files. However, if you plan to continue using theWorkbench or vxprj project management tools, you should not directly editgenerated project files or makefiles3.2Using vxprjThis guide covers only the most important vxprj functionality. For a completedescription of vxprj and all of its options, see the vxprj reference entry. Forinformation about using vxprj to invoke the compiler, see 4.Configuring andBuilding Application Projects.3.2.1Creating Kernel Configuration ProjectsThe command-line vxprj utility can create a project based on an existing boardsupport package (BSP)—that is, a collection of files needed to run VxWorks on aspecific piece of hardware.2 To create a kernel configuration project, type thefollowing:3 Configuring and Building VxWorks3.2 Using vxprj 3vxprj create [-source ] [-smp ] [-profile profile ] BSP tool [projectFile |projectDirectory ] The command sequence above uses the following arguments:-sourceAn optional argument to enable source build. A project can be built from source if both of the following are true:■The -source option is used.■All components in your project support the -source option.If either of these conditions is not true, the project is created from pre-built libraries (the default). After the project has been created, you can change the build mode.Note that only certain kernel profiles (the PROFILE_BASIC_KERNEL and PROFILE_MINIMAL_KERNEL ) support the -source option. If you modify a pre-defined kernel profile by including additional components, building from source may not be possible. If you specify the -source option, and building from source is not possible, vxprj will notify you of that fact and use the libraries to build.For complete details on this option, see the vxprj reference entry.-smpAn optional argument that enables an SMP kernel. Vxprj will now verify that BSPs support SMP and will give an error when the feature is not available. For example,vxprj create -smp sb1480_0_mips64 diabException while creating project : "option SMP not available for BSP sb1480_0_mips64"-profile profileAn optional argument to specify the kernel profile type to be built. If you do not specify a profile, the project is built according to the default profile that is defined for your BSP . For information on profiles, see Using Profiles , p.21, and the VxWorks Kernel Programmer’s Guide: Kernel .BSPThe name or location of a BSP .toolA recognized compiler (usually diab or gnu ). See Checking the Toolchain , p.20 for information about determining valid compilers for a given BSP .2.For information about BSPs, see the VxWorks BSP Developer’s Guide .VxWorksCommand-Line Tools User's Guide, 6.6projectFile|projectDirectoryAn optional argument to specify the name of the project file to create, or thename of its parent directory. If no filename or directory is specified, vxprjgenerates a name based on the other input arguments and stores the resultingproject in a new directory under installDir/target/proj.If you do not have a target board for your application, the easiest way toexperiment with vxprj is to create projects for the VxWorks Simulator. A standardWorkbench installation includes a BSP for the simulator. For example:C:\> vxprj create simpc diab C:\myProj\myproj.wpjThis command creates a kernel configuration project to be built with the WindRiver compiler (diab) and run on the VxWorks Simulator for Windows (simpc).The project file (myproj.wpj), source files, and makefile are stored in C:\myProj.To generate a similar project for Solaris or Linux hosts, specify solaris or linux asthe BSP, type the following:% vxprj create solaris diab /myProj/myproj.wpj$ vxprj create linux diab /myProj/myproj.wpj(For more information about the VxWorks Simulator, see 5.3Using the VxWorksSimulator, p.44, and the Wind River VxWorks Simulator User’s Guide.)The following command creates a project in the default location using thewrSbcPowerQuiccII (PowerPC) board support package:% vxprj create wrSbcPowerQuiccII diabWhen this command is executed, vxprj creates a subdirectory for the new projectand reports the location of directory.The following command creates a GCC project in C:\myProjects\mips64\ usingthe rh5500_mips64 BSP:C:\> vxprj create rh5500_mips64 gnu C:\myProjects\mips64\mipsProject.wpj The project file created by this command is called mipsProject.wpj.Checking the ToolchainYou can use vxprj to check the valid toolchains for a BSP:% vxprj tccheck list BSPFor example:% vxprj tccheck list sb1250a_0_mipsi643diab sfdiab gnu sfgnuCopying Projects To copy an existing project to a new location, type the following:vxprj copy [sourceFile ] destinationFile |destinationDirectory If no source file is specified, vxprj looks for a .wpj file in the current directory. If a destination directory—but no destination filename—is specified, vxprj creates a project file with the same name as the directory it resides in. For example:% vxprj copy myproj.wpj /NewThis command copies myproj.wpj and associated files to /New/New.wpj .Using ProfilesA profile is a preconfigured set of components that provides a starting point for custom kernel configuration. For example, PROFILE_DEVELOPMENT includes a variety of standard development and debugging tools. The following command creates a PROFILE_DEVELOPMENT -based project in the default location using the wrSbcPowerQuiccII BSP:% vxprj create -profile PROFILE_DEVELOPMENT wrSbcPowerQuiccII diabThe profile affects only the components use to create the project: after creation, the project does not retain any information about the profile used to create it.For a list of profiles, see the VxWorks Kernel Programmer’s Guide: Kernel .3.2.2 Deleting ProjectsTo delete a project, type the following:vxprj delete projectFilewhere projectFile is the .wpj file associated with the project. The delete command permanently deletes the directory in which projectFile resides and all of its contents and subdirectories. (Do not run the command from the project directory you are trying to remove.) For example:% vxprj delete /myProj/myproj.wpjThis command deletes the entire myProj directory.!CAUTION: vxprj delete removes any file passed to it, regardless of the file’s name or extension, along with the entire directory in which the file resides. It does notverify that the specified file is a Workbench project file, nor does it attempt to saveuser-generated files.3.2.3Modifying ProjectsAdding ComponentsTo add components to a kernel configuration project, type the following:vxprj component add [projectFile]component[component ... ]If no project file is specified, vxprj looks for a .wpj file in the current directory andadds the specified components to that file. Components are identified by thenames used in .wpj and .cdf files, which have the form INCLUDE_xxx. Forexample:% vxprj component add MyProject.wpj INCLUDE_MMU_BASIC INCLUDE_ROMFS This command adds support for a memory management unit and the ROMFStarget file system to MyProject.wpj.Adding BundlesSome components are grouped into bundles that provide related or complementaryfunctionality. Adding components in bundles is convenient and avoids unresolveddependencies.To add a bundle to a project, type the following:vxprj bundle add [projectFile]bundle[bundle ... ]For example:% vxprj bundle add BUNDLE_RTP_DEVELOPThis command adds process (RTP) support to the kernel configuration projectin the current working directory.% vxprj bundle add MyProject.wpj BUNDLE_RTP_DEVELOPBUNDLE_STANDALONE_SHELL BUNDLE_POSIX BUNDLE_EDRThis command adds support for processes, the kernel shell, POSIX, and errordetection and reporting to MyProject.wpj.3Removing ComponentsTo remove components from a kernel configuration project, type the following:vxprj component remove [projectFile ] component [component ... ] If no project file is specified, vxprj looks for a .wpj file in the current directory. For example:% vxprj component remove MyProject.wpj INCLUDE_MMU_BASIC INCLUDE_DEBUG This command removes the specified components as well as any components that are dependent on them .Removing BundlesTo remove a bundle, type the following:vxprj bundle remove [projectFile ] bundle [bundle ... ]Setting Configuration Parameter ValuesTo set the value of a configuration parameter, type the following:vxprj parameter set [projectFile ] parameter valueIf no project file is specified, vxprj looks for a .wpj file in the current directory. For example:% vxprj parameter set MyProject.wpj VM_PAGE_SIZE 0x10000This command sets VM_PAGE_SIZE to 0x10000. (To list a project’s configuration parameters, see Listing Configuration Parameters and Values , p.26.)Parameter values that contain spaces should be enclosed in quotation marks. If a parameter value itself contains quotation marks, they can be escaped with \ (Windows) or the entire value surrounded with ’...’ (UNIX). An easier way to set parameter values that contain quotation marks is to use setstring , which tells vxprj to treat everything from the space after the parameter argument to the end of the command line as a single string. For example:% vxprj parameter setstring SHELL_DEFAULT_CONFIG "LINE_LENGTH=128"This command sets SHELL_DEFAULT_CONFIG to “LINE_LENGTH=128”, including the quotation marks.To reset a parameter to its default value, type the following:vxprj parameter reset [projectFile ] parameter [parameter ... ]。
OBT-BSP-VxWorks5.4 应用开发手册说明书
OBT-BSP-VxWorks5.4应用开发手册V 2.0珠海欧比特控制工程股份有限公司2010年10月17日欧比特严禁复制目 录1引言.......................................................................................................................................................1 1.1编写目的.......................................................................................................................................1 1.2定义...............................................................................................................................................1 2 用途......................................................................................................................................................1 3 软件安装..............................................................................................................................................2 4 创建ROM映像........................................................................................................................................3 4.1 新建工程......................................................................................................................................3 4.2 选择BSP ........................................................................................................................................5 4.3 修改V X W ORKS 的宏..........................................................................................................................5 4.4 设置波特率. (6)4.5 添加应用程序..............................................................................................................................7 4.6 设置应用程序入口......................................................................................................................8 4.7 选择映像类型 (9)4.8 创建映像文件............................................................................................................................10 5 映像烧写及运行................................................................................................................................115.1 烧写最终映像方法.....................................................................................................................11 5.2 启动VXWORKS.........................................................................................................................14 6 移植注意事项....................................................................................................................................146.1 不同系统时钟频率的修改........................................................................................................14 6.2 不同SRAM数据线宽度的修改....................................................................................................15 6.3 不同SRAM大小的修改................................................................................................................15 欧比特严禁复制1引言1.1编写目的这份手册向读者介绍如何使用OBT-BSP-VxWorks5.4,主要介绍在Tornado 集成开发环境中如何开发针对S698系列开发板的VxWorks 5.4应用软件,以及生成最终烧写程序的过程。
风河Workbench3.0_VxWorks6.6应用程序开发使用说明V1.0
说明:由于开发经验和英语水平有限,在本文档中肯定存在偏差和谬误。
在有疑问的地方,请以风河的官方文档为准。
欢迎联系,指正错误。
QQ:1039309823。
风河Woorkbench3.0/VxWorks6.6使用说明第一章工程视图(Projects Overview)Workbench利用工程( Projects)就像逻辑容器和积木块——它们能够连接在一起创建一个软件系统。
工程( Projects)窗口可以直观地组织工程结构反映在内部的依赖关系上,以及编译和链接的次序。
前期配置的各种不同的工程允许在后面建立或添加工程时使用与之前的工程相同的配置和建立方式,因而只需要极小的输入。
一、Workspace/Project 的设置Wind River Workbench并不知道使用者的源文件在哪一个地方,在开始的使用的时候Wind River Workbench在安装目录下有一个默认的工作空间(workspace )的目录。
但是这不是必需的或者说并不一定是合理的,当使用者的工作空间因为产品升级或者更改安装目录已经完全存储在当前的安装目录树之外的时候!通常,使用者需要把workspace目录设置在当前的源文件树的根目录下并且在此创建Workbench工程。
对于各种不同的源文件树,可以使用不同的工作空间(workspaces)。
当决定在什么地方建立工程(projects)要做以下考虑:1.在workspace建立工程如果使用者想要新建一个工程在workspace下,通常的情况有A.所建的工程还没有建立源文件。
B.所建的工程已经存在源文件,但需要添加进工程。
C.所建的工程不允许设置在源文件目录处。
2.在workspace外部建立工程在创建工程时,点击“Browse”,将要建立的工程放置在在与workspace不同的目录。
通常的情形有:A.所建的工程建立在已有的原文件之上,改变工程目录之后需要对源文件进行添加和链接。
VxWorks简要手册
1.
VxWorks操作系统概述
1.1.VxWorks 操作系统简介
实时多任务操作系统是能在确定的时间内执行其功能,并对外部的异步事件作出响应的计算机系 统。多任务环境允许一个实时应用作为一系列独立任务来运行,各任务有各自的线程和系统资 源。 VxWorks 系统提供多处理器间和任务间高效的信号灯、消息队列、管道、网络透明的套接 5
7
1.1.任务管理
任务是代码运行的一个映象,从系统的角度看,任务是竞争系统资源的最小运行单 元。任务可以使用或等待CPU、I/O设备及内存空间等系统资源,并独立于其它任务,与 它们一起并发运行(宏观上如此)。 VxWorks 内核使任务能快速共享系统的绝大部分资 源,同时有独立的上下文来控制个别线程的执行。 1.1.1.任务结构 多任务设计能随时打断正在执行着的任务,对内部和外部发生的事件在确定的时间里 作出响应。VxWorks实时内核Wind提供了基本的多任务环境。从表面上来看,多个任务 正在同时执行,实际上,系统内核根据某一调度策略让它们交替运行。系统调度器使用任 务控制块的数据结构(简记为TCB)来管理任务调度功能。任务控制块用来描述一个任务, 每一任务都与一个 TCB 关联。 TCB 包括了任务的当前状态、优先级、要等待的事件或资 源、任务程序码的起始地址、初始堆栈指针等信息。调度器在任务最初被激活时以及从休 眠态重新被激活时,要用到这些信息。 此外,TCB还被用来存放任务的"上下文"(context)。任务的上下文就是当一个执 行中的任务被停止时,所要保存的所有信息。在任务被重新执行时,必须要恢复上下文。 通常,上下文就是计算机当前的状态,也即各个寄存器的内容。如同在发生中断所要保存 的内容一样。当发生任务切换时,当前运行的任务的上下文被存入TCB,将要被执行的任 务的上下文从它的TCB中取出,放入各个寄存器中。于是转而执行这个任务,执行的起点 是前次它在运行时被中止的位置。 VxWorks中,内存地址空间不是任务上下文的一部分。所有的代码运行在同一地址空 间。如每一任务需各自的内存空间,需可选产品VxVMI的支持。 1.1.2.任务状态和状态迁移 实时系统的一个任务可有多种状态,其中最基本的状态有四种: 就绪态:任务只等待系统分配CPU资源; 悬置态:任务需等待某些不可利用的资源而被阻塞; 休眠态:如果系统不需要某一个任务工作,则这个任务处于休眠状态; 延迟态:任务被延迟时所处状态; 当系统函数对某一任务进行操作时,任务从一种状态迁移到另一状态。处于任一状态 的任务都可被删除。
(完整word版)VxWorksSMP多核编程指南
VxWorks SMP多核编程指南本文摘自vxworks_kernel_programmers_guide_6.8 第24章1.介绍VxWorks SMP是风河公司为VxWorks设计的symmetric multiprocessing(SMP)系统。
它与风河公司的uniporcessor(UP)系统一样,具备实时操作系统的特性。
本章节介绍了风河VxWorks SMP系统的特点。
介绍了VxWorks SMP的配置过程、它与UP编程的区别,还有就是如何将UP代码移植为SMP代码。
2.关于VxWorks SMP多核系统指的是一个系统中包含两个或两个以上的处理单元。
SMP是多核技巧中的一个,它的主要特点是一个OS运行在多个处理单元上,并且内存是共享的。
另一种多核技巧是asymmetric multiprocessing(AMP)系统,即多个处理单元上运行多个OS。
(1)技术特点关于CPU与处理器的概念在很多计算机相关书籍里有所介绍。
但是,在此我们仍要对这二者在SMP系统中的区别进行详细说明。
CPU:一个CPU通常使用CPU ID、物理CPU索引、逻辑CPU索引进行标示。
一个CPU ID通常由系统固件和硬件决定。
物理CPU索引从0开始,系统从CPU0开始启动,随着CPU个数的增加,物理CPU索引也会增加。
逻辑CPU索引指的是OS实例。
例如,UP 系统中逻辑CPU的索引永远是0;对于一个4个CPU的SMP系统而言,它的CPU逻辑索引永远是0到3,无论硬件系统中CPU的个数。
处理器(processor):是一个包含一个CPU或多个CPU的硅晶体单元。
多处理器(multiprocessor):在一个独立的硬件环境中包含两个以上的处理器。
单核处理器(uniprocessor):一个包含了一个CPU的硅晶体单元。
例如:a dual-core MPC8641D指的是一个处理器上有两个CPU;a quad-core Broadcom 1480指的是一个处理器上有四个CPU。
vxworks65编程手册
一. V x W o r k s653运行时系统1.1. 运行时层一个vxworks653模块由下面四层组成:■core OS—必需■partition—至少需要一个(vThreads 或COIL-based),每个都在一个分区的操作系统之中■APEX shared library—ARINC 653 应用所需■POSIX shared library—POSIX 应用所需1.1.1.Core OS层核心操作系统提供服务给分区。
缺省的,核心操作系统使用ARINC653规范中的时间抢占的调度(TPS)来调度分区。
Vxworks653的核心操作系统还可以采用APPS调度策略在TPS调度的空闲时间内调度优先级抢占调度(PPS)使能的分区。
核心操作系统提供给每个VThreads分区操作系统的服务包括:●分区系统资源●调度分区●代表分区的操作系统执行trap异常●定义和强制分区边界●装载分区●使用端口和通道在分区间传递消息●处理I/O●代表应用完成系统调用●支持分区的调试●监控分区和系统的健康1.1.2.vThreads 层vThreads分区操作系统在核心操作系统分配给该分区的时间内调度vThreads中的线程。
vThreads不直接与设备交互,而是通过核心操作系统的系统调用。
1.1.3.APEX 层构建在vThreads之上,遵循ARINC653规范,并且提供相应功能和API。
1.1.4.POSIX层构建在vThreads之上,遵循用于实时扩展的POSIX标准(1003.1b)。
1.2. 装载和启动当目标板加电时,按照下面的步骤进行装载和启动●初始的启动码装载核心操作系统,分区操作系统,共享库,以及应用●核心操作系统初始化自身,启动它自己的子系统●核心操作系统创建分区●核心操作系统启动分区调度器,并且让应用初始化自身核心操作系统可以在初始化完成之后下载在线装载的应用程序到分区。
应用可以在分区运行之时装载到分区。
vxworks653编程手册
一.V xWorks653运行时系统1.1. 运行时层一个vxworks653模块由下面四层组成:■core OS—必需■partition—至少需要一个(vThreads 或COIL-based),每个都在一个分区的操作系统之中■APEX shared library—ARINC 653 应用所需■POSIX shared library—POSIX 应用所需1.1.1.Core OS层核心操作系统提供服务给分区。
缺省的,核心操作系统使用ARINC653规范中的时间抢占的调度(TPS)来调度分区。
Vxworks653的核心操作系统还可以采用APPS调度策略在TPS调度的空闲时间内调度优先级抢占调度(PPS)使能的分区。
核心操作系统提供给每个VThreads分区操作系统的服务包括:●分区系统资源●调度分区●代表分区的操作系统执行trap异常●定义和强制分区边界●装载分区●使用端口和通道在分区间传递消息●处理I/O●代表应用完成系统调用●支持分区的调试●监控分区和系统的健康1.1.2.vThreads 层vThreads分区操作系统在核心操作系统分配给该分区的时间内调度vThreads中的线程。
vThreads不直接与设备交互,而是通过核心操作系统的系统调用。
1.1.3.APEX 层构建在vThreads之上,遵循ARINC653规范,并且提供相应功能和API。
1.1.4.POSIX层构建在vThreads之上,遵循用于实时扩展的POSIX标准(1003.1b)。
1.2. 装载和启动当目标板加电时,按照下面的步骤进行装载和启动●初始的启动码装载核心操作系统,分区操作系统,共享库,以及应用●核心操作系统初始化自身,启动它自己的子系统●核心操作系统创建分区●核心操作系统启动分区调度器,并且让应用初始化自身核心操作系统可以在初始化完成之后下载在线装载的应用程序到分区。
应用可以在分区运行之时装载到分区。
1.3. 运行时模型核心操作系统处理来自每个分区的系统调用,并且在运行系统调用前校验每个系统调用的语句。
VxWorks 驱动程序安装指南说明书
Document: CTI_SIO_Install Revision: 1.01Date: January 4, 2010 VxWorksDriver InstallationVxWorks Driver Installation1.H ISTORY (3)2.H ARDWARE R EQUIREMENTS (4)3.D RIVER F ILES (4)4.C ONFIGURATION (4)4.1. BSP Files (4)4.1.1. config.h (4)4.1.1.1. INCLUDE_CTI_U550 (4)4.1.1.2. INCLUDE_CTI_U650 (5)4.1.1.3. INCLUDE_CTI_U850 (5)4.1.1.4. INCLUDE_CTI_EXAR17XX5XPCI (5)4.1.1.5. CTI_PCI_MAXBOARDS (5)4.1.1.6. CTI_PCI_MAXCHANS (5)4.1.1.7. INCLUDE_CTI_AUTO485POLLER (5)4.1.1.8. CTI_DEFAULT_BAUD (6)4.1.1.9. CTI_AUTO485SWITCHBAUD (6)4.1.1.10. CTI_AUTO485POLLER_DELAY (6)4.1.1.11. CTI_SYS_PCI_INTCONNECT() (6)4.1.1.12. CTI_SYS_INTCONNECT() (6)4.1.1.13. CTI_SYS_INTENABLE() (7)4.1.1.14. CTI_SYS_IN_BYTE() (7)4.1.1.15. CTI_SYS_OUT_BYTE() (7)4.1.1.16. CTI_SYS_IN_WORD() (8)4.1.1.17. CTI_SYS_OUT_WORD() (8)4.1.1.18. CTI_SYS_IN_LONG() (8)4.1.1.19. CTI_SYS_OUT_LONG() (9)4.1.2. sysLib.c (9)4.1.2.1. sysHwInit() (9)4.1.2.2. sysHwInit2() (10)4.2. Driver Files (10)4.2.1. sysCTISerial.c (10)4.2.1.1. Storage (10)4.2.1.2. Configuration (11)4.2.1.3. Interrupts (12)4.2.1.4. Enumeration (13)4.3. Tornado Projects (14)4.3.1. Connect Tech Inc. SIO (14)4.3.2. Use alternate base name (14)5.E XAMPLES (14)5.1. pcP3CTI_1 (14)5.2. pcP3CTI_2 (14)5.3. pcP3CTI_3 (15)6.I NSTALLATION C HECKLIST (16)1. HistoryOriginal draft.Added installation checklist.Added 3rd sample BSP.Fixed minor mistakes.Adapted for both Tornado and Workbench builds.2. Hardware RequirementsThis driver supports the following products:Xtreme/104 switchableXtreme/104 232BlueStorm/LPXtreme/104-Plus3. Driver FilesCopy the following files into your BSP directory (<WIND_INST>\target\config\<BSP_NAME>):00cti.cdfctiSio.cctiSio.hsysCTISerial.cusrCTISerial.c4. Configuration4.1. BSP FilesThe following files should be modified to support the CTI SIO driver. These modifications can be done in any other way as appropriate, but the following are suggestions made based on the Pentium III BSP. For sample modified files, refer to the files (of the same name) located within the driver distribution package. Sample files are from the Pentium III BSP. Note; file names and locations of information may differ in your BSP.<WIND_INST>\target\config\<BSP_NAME>\config.h<WIND_INST>\target\config\<BSP_NAME>\sysLib.cThe sample files included with the driver package should not be copied over any files in your BSP. These sample files are included only so that you can see the required changes in the context of complete files.4.1.1.config.hAdd a section to your config.h file so that there is a place for the driver options. If your config.h has an “if-def” block used to determine when to define INCLUDE_PCI, it is advised that you place this new section above that “if-def” block. This suggestion is made so that the “if-def” section can be modified to define INCLUDE_PCI when needed by any included CTI boards. The section for CTI driver configuration should surrounded by a check forINCLUDE_CTI_SIO being defined.For example:/* Connect Tech Inc. serial driver options */#if defined(INCLUDE_CTI_SIO)#define INCLUDE_CTI_U550/* support for 550 UARTs */#endif/* defined(INCLUDE_CTI_SIO) */A complete list of the available configuration options follows:4.1.1.1.INCLUDE_CTI_U550Define INCLUDE_CTI_U550 to include support for Xtreme/104 products that utilize 550 UARTs. This can be determined by examining the UART chips on the Xtreme/104 board itself, or by contacting CTI support staff.Usage:#define INCLUDE_CTI_U5504.1.1.2.INCLUDE_CTI_U650Define INCLUDE_CTI_U650 to include support for Xtreme/104 products that utilize 650 UARTs. This can be determined by examining the UART chips on the Xtreme/104 board itself, or by contacting CTI support staff.Usage:#define INCLUDE_CTI_U6504.1.1.3.INCLUDE_CTI_U850Define INCLUDE_CTI_U850 to include support for Xtreme/104 products that utilize 850 UARTs. This can be determined by examining the UART chips on the Xtreme/104 board itself, or by contacting CTI support staff.Usage:#define INCLUDE_CTI_U8504.1.1.4.INCLUDE_CTI_EXAR17XX5XPCIDefine INCLUDE_CTI_EXAR17XX5XPCI to include support for BlueStorm/LP and Xtreme/104-Plus products. You should also include you BSP’s PCI support if these pr oducts are to be used.Usage:#define INCLUDE_CTI_EXAR17XX5XPCI4.1.1.5.CTI_PCI_MAXBOARDSCTI_PCI_MAXBOARDS is used to define the maximum number of CTI PCI boards that can be enumerated. If not defined the default is 1.Usage:#define CTI_PCI_MAXBOARDS X/* where X is the maximum number of boards */4.1.1.6.CTI_PCI_MAXCHANSCTI_PCI_MAXCHANS is used to define the maximum number of serial channels that can be used by enumerated CTI PCI devices. This number is not the maximum per CTI PCI device, it is the maximum total number of channels across all CTI PCI devices. If not defined the default is 8.Usage:#define CTI_PCI_MAXCHANS X/* where X is the maximum number of channels */4.1.1.7.INCLUDE_CTI_AUTO485POLLERWhen using half-duplex RS485, the receiver and transmitter need to be toggled on and off depending on whether data is being sent or received. On CTI products that do not utilize UARTs with the capability to do this automatically, the driver must perform the toggling.This can be done in one of two ways; Using the interrupt service routine (ISR) of thechannel; Using a watchdog timer as a poller. In order to use the watchdog timerINCLUDE_CTI_AUTO485POLLER must be defined.Usage:#define INCLUDE_CTI_AUTO485POLLER4.1.1.8.CTI_DEFAULT_BAUDCTI_DEFAULT_BAUD is used to define the default baud rate when the serial channels are initialized. If not defined the default is 9600.Usage:#define CTI_DEFAULT_BAUD X/* where X is the default baud rate in bps */4.1.1.9.CTI_AUTO485SWITCHBAUDWhen using the CTIAUTO485SWITCHED auto 485 direction control method,CTI_AUTO485SWITCHBAUD defines the baud rate used to switch between ISR and poller methods. When the baud rate is less than CTI_AUTO485SWITCHBAUD the ISR method is used, else the poller method is used. If not defined the default is 9600.Usage:#define CTI_AUTO485SWITCHBAUD X/* where X is the baud rate in bps */4.1.1.10.CTI_AUTO485POLLER_DELAYWhen the poller auto 485 direction control method is being used a watchdog timerperforms a polling operation to look for the end of a transmit. This watchdog timer is set to expire every CTI_AUTO485POLLER_DELAY ticks. If not defined the default is 1.Usage:#define CTI_AUTO485POLLER_DELAY X/* where X is the delay in ticks */4.1.1.11.CTI_SYS_PCI_INTCONNECT()The CTI_SYS_PCI_INTCONNECT() macro is used to connect a PCI device interrupt to an interrupt service routine. The default definition of this macro uses pciIntConnect().Usage:/** _intLevel_ - interrupt level to connect _isr_ to* _isr_ - interrupt service routine to connect to _intLevel_* _arg_ - argument to be passed to _isr_* _result_ - STATUS result of the macro*/#define CTI_SYS_PCI_INTCONNECT(_intLevel_, _isr_, _arg_, _result_) \{ \/* place desired code here */ \}4.1.1.12.CTI_SYS_INTCONNECT()The CTI_SYS_INTCONNECT() macro is used to connect a device interrupt to an interrupt service routine. The default definition of this macro uses intConnect().Usage:/** _intLevel_ - interrupt level to connect _isr_ to* _isr_ - interrupt service routine to connect to _intLevel_* _arg_ - argument to be passed to _isr_* _result_ - STATUS result of the macro*/#define CTI_SYS_INTCONNECT(_intLevel_, _isr_, _arg_, _result_) \{ \/* place desired code here */ \}4.1.1.13.CTI_SYS_INTENABLE()The CTI_SYS_INTENABLE() macro is used to enable an interrupt level. The defaultdefinition of this macro uses sysIntEnablePIC().Usage:/** _intLevel_ - interrupt level to enable* _result_ - STATUS result of the macro*/#define CTI_SYS_INTENABLE(_intLevel_, _result_) \{ \/* place desired code here */ \}4.1.1.14.CTI_SYS_IN_BYTE()The CTI_SYS_IN_BYTE() macro is used to read an 8 bit value. The default definition of this macro uses sysInByte() for port I/O and does a direct assignment for memory I/O.Usage:/** _ioMode_ - I/O mode (CTIIOPORT or CTIIOMEM)* _address_ - address to read from* _value_ - receives 8 bit value read from _address_*/#define CTI_SYS_IN_BYTE(_ioMode_, _address_, _value_) \{ \if((_ioMode_) == CTIIOPORT) { \/* place port I/O code here */ \} \else { \/* place memory I/O code here */ \} \}4.1.1.15.CTI_SYS_OUT_BYTE()The CTI_SYS_OUT_BYTE() macro is used to write an 8 bit value. The default definition of this macro uses sysOutByte() for port I/O and does a direct assignment for memory I/O.Usage:/** _ioMode_ - I/O mode (CTIIOPORT or CTIIOMEM)* _address_ - address to write to* _value_ - 8 bit value to write to _address_*/#define CTI_SYS_OUT_BYTE(_ioMode_, _address_, _value_) \{ \if((_ioMode_) == CTIIOPORT) { \/* place port I/O code here */ \} \else { \/* place memory I/O code here */ \} \}4.1.1.16.CTI_SYS_IN_WORD()The CTI_SYS_IN_WORD() macro is used to read a 16 bit value. The default definition of this macro uses sysInWord() for port I/O and does a direct assignment for memory I/O.Usage:/** _ioMode_ - I/O mode (CTIIOPORT or CTIIOMEM)* _address_ - address to read from* _value_ - receives 16 bit value read from _address_*/#define CTI_SYS_IN_WORD(_ioMode_, _address_, _value_) \{ \if((_ioMode_) == CTIIOPORT) { \/* place port I/O code here */ \} \else { \/* place memory I/O code here */ \} \}4.1.1.17.CTI_SYS_OUT_WORD()The CTI_SYS_OUT_WORD() macro is used to write a 16 bit value. The default definition of this macro uses sysOutWord() for port I/O and does a direct assignment for memory I/O.Usage:/** _ioMode_ - I/O mode (CTIIOPORT or CTIIOMEM)* _address_ - address to write to* _value_ - 16 bit value to write to _address_*/#define CTI_SYS_OUT_WORD(_ioMode_, _address_, _value_) \{ \if((_ioMode_) == CTIIOPORT) { \/* place port I/O code here */ \} \else { \/* place memory I/O code here */ \} \}4.1.1.18.CTI_SYS_IN_LONG()The CTI_SYS_IN_LONG() macro is used to read a 32 bit value. The default definition of this macro uses sysInLong() for port I/O and does a direct assignment for memory I/O.Usage:/** _ioMode_ - I/O mode (CTIIOPORT or CTIIOMEM)* _address_ - address to read from* _value_ - receives 32 bit value read from _address_*/#define CTI_SYS_IN_BYTE(_ioMode_, _address_, _value_) \{ \if((_ioMode_) == CTIIOPORT) { \/* place port I/O code here */ \} \else { \/* place memory I/O code here */ \} \}4.1.1.19.CTI_SYS_OUT_LONG()The CTI_SYS_OUT_LONG() macro is used to write a 32 bit value. The default definition of this macro uses sysOutLong() for port I/O and does a direct assignment for memory I/O.Usage:/** _ioMode_ - I/O mode (CTIIOPORT or CTIIOMEM)* _address_ - address to write to* _value_ - 32 bit value to write to _address_*/#define CTI_SYS_OUT_LONG(_ioMode_, _address_, _value_) \{ \if((_ioMode_) == CTIIOPORT) { \/* place port I/O code here */ \} \else { \/* place memory I/O code here */ \} \}4.1.2.sysLib.cAdd a section to your sysLib.c file that includes the file sysCTISerial.c. This file includes the CTI SIO driver and defines routines used to configure the CTI serial channels. This section should come after the PCI configuration files have been included and should be surrounded by a check for INCLUDE_CTI_SIO being defined.For example:#if defined(INCLUDE_CTI_SIO)#include "sysCTISerial.c"#endif/* defined(INCLUDE_CTI_SIO) */In addition to including the driver and driver configuration routines, the routines sysHwInit() and sysHwInit2() need to be modified to call the serial configuration routines defined in sysCTISerial.c.4.1.2.1.sysHwInit()During sysHwInit(), sysCTISerialHwInit() should be called to initially configure the CTIserial channels. This call should be made after any PCI initialization in order for CTI PCI adapters to be configured.For example:#if defined(INCLUDE_CTI_SIO)sysCTISerialHwInit();#endif/* defined(INCLUDE_CTI_SIO) */4.1.2.2.sysHwInit2()During sysHwInit2(), sysCTISerialHwInit2() should be called to connect and enableinterrupts used by the CTI serial channels.For example:#if defined(INCLUDE_CTI_SIO)sysCTISerialHwInit2();#endif/* defined(INCLUDE_CTI_SIO) */4.2. Driver FilesThe file sysCTISerial.c, which is included into sysLib.c, needs to be configured to properly match the setup of your system.4.2.1.sysCTISerial.csysCTISerial.c contains rountines used to configure any CTI serial adapters you have. The configuration includes:storage for board and channel structuresboard/channel configuration and initializationinterrupt connecting and enablingchannel enumerationThe code in this section is only meant to serve as a short example. For a more complete sample refer to the sample BSP’s provided with the driver files. For a description of routine parameters refer to the documentation for that routine.4.2.1.1.StorageEach board and channel must have a corresponding structure allocated for it. This istypically done by declaring local variables in the file sysCTISerial.c.Typically one board structure (CTI_BOARD) is defined for each non-PCI CTI adapter.For example:LOCAL CTI_BOARD ctiXt1Board;LOCAL CTI_BOARD ctiXt2Board;For each of the non-PCI adapters, an array of channel structures should be defined aswell. The size of these arrays depends on the number of channels supported by theadapters.For example:LOCAL CTI_CHAN ctiXt1Chans[8];LOCAL CTI_CHAN ctiXt2Chans[4];For PCI adapters, only one instance of CTI_PCI_DEVICESET need be defined. The maximum number of supported adapters and channels should be defined with CTI_PCI_MAXBOARDS and CTI_PCI_MAXCHANS (see section 4.1.1 - config.h for more information onCTI_PCI_MAXBOARDS and CTI_PCI_MAXCHANS).For example:#if defined(INCLUDE_PCI)LOCAL CTI_PCI_DEVICESET ctiPciDevset;#endif/* defined(INCLUDE_PCI) */4.2.1.2.ConfigurationDuring sysHwInit() sysCTISerialHwInit() should be called. This is where the board andchannels structures declared in the previous section are configured and initialized.Each non-PCI board structure should be configured using ctiBoardConfig() and initialized using ctiBoardHrdInit().PCI adapters should be enumerated and initialized using ctiPciConfig() and ctiPciHrdInit().For example:void sysCTISerialHwInit(void){if(OK == ctiBoardConfig(&ctiXt1Board,CTIU650,CTIIOPORT,0x300,0x340, /* 0 if status port not being used */0x05,7372800,4, /* 1 if using extended baud rates */ctiXt1Chans,8,NULL,NULL,0xFF)){if(sysBp) {ctiBoardHrdInit(&ctiXt1Board);}}if(OK == ctiBoardConfig(&ctiXt2Board,CTIU850,CTIIOPORT,0x200,0x240, /* 0 if status port not being used */0x0A,7372800,4, /* 1 if using extended baud rates */ctiXt2Chans,4,NULL,NULL,0xF)){if(sysBp) {ctiBoardHrdInit(&ctiXt2Board);}}#if defined(INCLUDE_PCI)if(OK == ctiPciConfig(&ctiPciDevset, NULL, NULL)) {if(sysBp) {ctiPciHrdInit(&ctiPciDevset);}}#endif/* defined(INCLUDE_PCI) */}4.2.1.3.InterruptssysCTISerialHwInit2() should be called during sysHwInit2() and is responsible for connecting and enabling interrupts used by the CTI adapters.The operations of connecting an interrupt to an interrupt service routine as well asenabling the interrupt have been encapsulated into driver rountines ctiBoardIntConnect() and ctiPciIntConnect(). The behaviour of these routines is controlled by the macrosCTI_SYS_INTCONNECT(), CTI_SYS_PCI_INTCONNECT(), and CTI_SYS_INTENABLE(). These macros can be redefined from their default behaviour. See section 4.1.1 - config.h formore information on CTI_SYS_INTCONNECT(), CTI_SYS_PCI_INTCONNECT(), andCTI_SYS_INTENABLE(). These routines do not have to be used and in some cases may not be sufficient. The specifics of their operation can be seen in ctiSio.c.For example:void sysCTISerialHwInit2(void){ctiBoardIntConnect(&ctiXt1Board);ctiBoardIntConnect(&ctiXt2Board);#if defined(INCLUDE_PCI)ctiPciIntConnect(&ctiPciDevset);#endif/* defined(INCLUDE_PCI) */}4.2.1.4.EnumerationEach serial channel must be associated with a device. The CTI serial channels areenumerated using sysCTISerialChanGet(). This routine takes an index value specifyingwhich channel structure to retrieve, and effectively acts as a look-up table for thechannels. The order in which the channels are returned determines the order in which the channels are associated with device names.For example:SIO_CHAN* sysCTISerialChanGet(int channel/* serial channel */){if((channel >= 0) && (channel < 8)) {return((SIO_CHAN*)&ctiXt1Chans[channel]);}else if((channel >= 8) && (channel < (8 + 4))) {return((SIO_CHAN*)&ctiXt2Chans[channel - 8]);}#if defined(INCLUDE_PCI)else if((channel >= (8 + 4)) &&(channel < (8 + 4 + hans))){return((SIO_CHAN*)&(ctiPciDevset.pChans[channel - 8 - 4]));}#endif/* defined(INCLUDE_PCI) */return((SIO_CHAN*)ERROR);}The total number of channels needs to be reported using sysCTISerialGetNumChans(). This routine simply needs to return the total number of channels being used across all CTIadapters.For example:UINT16sysCTISerialGetNumChans(void){UINT16retVal = 0;retVal += 8;retVal += 4;#if defined(INCLUDE_PCI)retVal += hans;#endif/* defined(INCLUDE_PCI) */return(retVal);}4.3. Tornado/WorkBench ProjectsBootable VxWorks image projects based on a BSP containing the CTI driver files will have a new folder available under hardware\peripherals\serial called “Connect Tech Inc.”. This folder contains components for controlling the CTI serial driver. A description of the components follows:4.3.1.Connect Tech Inc. SIOThis component controls INCLUDE_CTI_SIO (used earlier when including the CTI serial driver in the BSP).e alternate base nameIf this component is not included, the CTI serial channels will be named “/tyCo/X” where X is the channel index value and is based on the defined NUM_TTY value so that the names do not collide with other serial devices. However, it may be desireable to use a different base name. By including the Use alternate base name component, the default behaviour is to name the CTI serial channels “/tyCTI/X” where X is the channel index value starting at 0.The Use alternate base name component has a parameter called CTI_TY_NAME_BASE which can be used to set a base name other than “/tyCTI/”.5. ExamplesIncluded with the driver files are three example BSP’s. These example BSP’s are based on the Pentium III BSP from WindRiver. A description of each of the example BSP’s follows:5.1. pcP3CTI_1This example is based on the following CTI serial adapters:Xtreme/104 RS-2328 channels.Base I/O address is 0x300.IRQ is 10.Status port is in use.Extended baud rates not in use.BlueStorm/LP RS-2324 channels.5.2. pcP3CTI_2This example is based on the following CTI serial adapters:Xtreme/104 14 RS-232 channels.Base I/O address is 0x300.IRQ is 10.Status port is in use.Extended baud rates not in use.Xtreme/104 28 channels.Base I/O address is 0x200.Channels 1, 3, 5, and 7 are on IRQ 5, channels 2, 4, 6, and 8 are on IRQ 9. SeeMode 2 in the Interrupt Selection section of the Xtreme/104 manual.Status port is not in use.Extended baud rates in use.Channels 1 and 2 are RS-232, channels 3, 4, and 5 are RS-485 full-duplex,channels 6, 7, and 8 are RS-485 half-duplex.Xtreme/104-Plus Switchable4 channels.Channels 1 and 2 are RS-485 full-duplex, channels 3 and 4 are RS-232.5.3. pcP3CTI_3This example is based on the following CTI serial adapters:BlueStorm/LP8 RS-232 channels.6. Installation Checklist。
VxWorks 网络编程教程
1. 2. 3. 4. 5. 6. 7. 8. 9. 10. fei2=muxDevLoad(0,fei82557EndLoad,"1:0x00:0x20:0x20:0x00",1,0) muxDevStart(fei2) ipAttach(0,"fei") ifMaskSet("fei0",0xffffff00) ifAddrSet("fei0","136.12.117.10") hostAdd("woof-route-10","136.12.117.10") muxShow hostShow ifShow mRouteShow
7
北京邮电大学培训中心
8
ULIP网卡的路由使能
连接到VxSim目标系统
北京邮电大学培训中心
9
北京邮电大学培训中心
10
TFTP示例演示
• 主机到主机的数据传送
192.18.22.13
35
209.134.16.123
36
北京邮电大学培训中心
北京邮电大学培训中心
传输协议(Transport Protocols)
TFTP Server TFTP Client
2. VxWorks网络概述
• 网络上的设备需要以某种标准交互数据 • IP协议套件提供了系统独立的协议 • VxWorks基于BSD4.4 release提供了TCP/IP 协议的实现 • 包括以下特性:
– 增强的可配置和可伸缩性 – MUX层 – 支持其他兼容的Internet特性
3
北京邮电大学培训中心
4
VxWorks编程指导
Wind River哲学是利用两个相互协作的操作系统来互相补充对方的不足(譬如VxWorks和Windows 或 VxWorks和Unix),让他们各尽所长。VxWorks为应用提供实时性,而主机被用来进行应用开发和运行非实时的应用程序。
VxWorks是可以裁剪的,你可以将VxWorks裁剪为只包含你的应用所需要的部件。在开发期间为了方便你的开发,你可以加入网络部件,当发行最终版本时为了节约资源你可以轻松的去掉网络部件。
dosFs为面向文件的设备驱动程序提供的服务在dosFsLib里实现。
1.3.2. RT-11兼容文件系统rt11Fs
rt11Fs文件系统兼容于RT-11操作系统。该文件系统一直被实时应用使用,因为该文件系统下的所有文件都是连续存储的。但是它缺少树状文件组织结构,树状文件组织结构对大容量磁盘是特别有用的。同时,呆板的连续存储空间分配会导致大量的磁盘碎片。所以,dosFs要优于rt11Fs。
1.3.5. CDROM文件系统
VxWorks为了让应用读写按照ISO9660文件系统标准格式化的CDROM设备提供了cdRomFs。初始化cdRomFs文件系统后,挂接cdRomFs到一个CDROM设备,就可以用POSIX标准的I/O调用来读CDROM。
1.3.6. 可替换的文件系统
POSIX接口包括:
m 异步I/O
m 信号量
m 消息对列
m 内存管理
m 信号
m 调度
m 时钟
1.2. I/O系统
VxWorks的I/O系统对多种输入输出设备提供统一的存取机制。既可以调用基本的I/O函数:creat(),remove(),open(),close( ),read(),write(),和ioctl();也可以调用高层I/O函数,譬如printf(),scanf()。
vxworks命令教程2024新版
文件创建、打开和关闭
创建文件
使用`creat()`函数创建新文件,需要指定文件名和访 问模式。
打开文件
使用`open()`函数打开已存在的文件,同样需要指定 文件名和访问模式。
关闭文件
使用`close()`函数关闭已打开的文件,释放相关资源 。
文件读写操作
01
读取文件
写入文件
02
03
telnet
远程终端服务命令,用于建立TCP连接 并远程登录到目标主机。
ftp
文件传输协议(FTP)命令,用于在网 络上传输文件。
tftpபைடு நூலகம்
简单文件传输协议(TFTP)命令,用 于在网络上进行简单的文件传输。
网络诊断和调试
netstat
网络统计命令,用于显示网络 连接、路由表、接口状态等网
络相关信息。
在嵌入式系统开发中,命令行接口(CLI )是一个不可或缺的工具。通过CLI,开 发者可以与系统进行交互,执行命令,查 看系统状态,调试问题等。
本教程旨在帮助开发者熟悉并掌握 VxWorks的命令行接口,以便更有效地 进行嵌入式系统开发和调试。
教程范围
基本命令介绍
涵盖VxWorks中常用的基本命令, 如任务管理、内存管理、时间管理
ndp
邻居发现协议(NDP)命令,用于 IPv6网络中的邻居发现和管理。
route
用于设置和查看路由表,实现网络数 据包的正确转发。
dhcpc
动态主机配置协议客户端(DHCP Client)命令,用于从DHCP服务器 获取网络配置信息。
数据传输和接收
ping
用于测试网络连接可达性,发送ICMP 回显请求并接收回显应答。
VxWorks 6.3 编程调试要点
VxWorks 6.3 编程调试要点(仅供内部使用)文档作者:周礼兵日期:2007-03-05开发/测试经理:_______________ 日期:___/___/___项目经理:_______________ 日期:___/___/___版权所有不得复制目录目录 (2)1系统特点 (3)2编程调试 (3)2 .1应用程序的运行 (3)2 .1.1Shell 下运行 (3)2 .1.2自启动运行 (4)2 .1.3通过workbench运行 (4)2 .2内核模块的运行 (4)2 .3ROMFS (4)2 .4应用程序的系统调用 (5)2 .4.1系统调用的一些约束 (5)2 .4.2静态的增加系统调用函数 (5)2 .4.3动态的增加系统调用函数 (6)2 .5共享数据区域 (7)2 .6动态库 (7)2 .6.1共享库(Shared Libraries) (7)2 .6.2Plug-ins (7)2 .7多任务 (8)2 .7.1任务变量(Task Variables) (8)2 .7.2VxWorks task (8)2 .7.3POSIX Threads (8)2 .7.4任务调度 (8)2 .8信号量 (8)2 .8.1VxWorks semaphores (8)2 .8.2POSIX Semaphores (8)2 .9消息队列 (8)2 .9.1VxWorks Message Queues (8)2 .9.2POSIX Message Queues (8)2 .10Sockets (8)2 .11Pipes (9)2 .12VxWorks events (9)2 .13POSIX Queued Signals (9)2 .14内存管理 (9)2 .15Shell 解析器 (9)3设计要点 (10)参考文档 (11)VxWorks 6.3 编程调试要点关键词: 内核态、用户态、消息、信号、信号量、管道、任务、线程缩略语说明:RTP(real-time process)、POSIX(Portable Operating System UNIX)、MMU(Memory Management Unit)1 系统特点VxWorks 6.3除了兼容以前低版本(如:VxWorks 5.5)内核外,增加一些其它的功能。
VxWorks编程常用函数说明
VxWorks编程常用函数说明VxWorks编程常用函数说明一、官方的Program Guide位于安装目录下:\\docs\\vxworks\\guide\\index.html二、常用的库:#include "taskLib.h" /* 任务 */#include "msgQLib.h" /* 消息队列 */#include "semLib.h" /* 信号量 */#include "ioLib.h" /* IO */#include "wdLib.h" /* Watch dog */#include "logLib.h" /* 信息输出 */#include "socket.h" /* 网络套接字 */三、IO系统:ioLib.h1、系统中的IO设备,包括键盘、串口、文件等,都用统一的接口访问。
第一步通常先得到文件描述符,然后进行读写或者设置的工作,最后关闭该描述符。
creat:建立文件open:得到文件或设备的描述符read:读文件或设备write:写文件或设备ioctl:设置参数close:关闭文件描述符remove:删除文件2、内存文件memDrv( ) - 初始化伪内存设备memDevCreate( ) - 建立伪内存设备memDevCreateDir( ) - 建立一组伪内存设备memDevDelete( ) - 删除伪内存设备Init() {uchar_t buffer[1024];int fd;memDrv( );memDevCreate("/mem/mem1", buffer, sizeof(buffer));if ((fd = open("/mem/mem1", O_RDWR, 0644)) != ERROR) { write(fd, &data, sizeof(data));… …close(fd);}memDevDelete("/mem/mem1");}3、通过Select函数实现多个IO监听:selectLib.h当等待多个IO时,我们可以使用Select函数,fd为文件描述符:int select(int width, /* 最大的fd,或直接FD_SETSIZE (2048) */fd_set * pReadFds, /* 读的fd集合 */fd_set * pWriteFds, /* 写的fd集合 */fd_set * pExceptFds, /* vxWorks不支持,NULL */struct timeval * pTimeOut /* 等待时间, NULL = forever */ )还有几个宏:FD_SET(fd, &fdset) 设置fd的监听位FD_CLR(fd, &fdset) 清除fd的监听位FD_ZERO(&fdset) 清除所有监听位FD_ISSET(fd, &fdset) fd是否有数据例子,其中MAX意为取最大值:Init() {struct fd_set readFds;int fds[4];int width;fds[0] = open(..);… …;fds[3] = open(..); /* 打开IO */width = MAX(fd s[0], … … , fds[3])+1; /* fd的最大值+1 *//* FOREVER {*/FD_ZERO(&readFds); /* 设置fd_set结构 */FD_SET(fds[0], & readFds);… …; FD_SET(fds[3], & readFds);if (select(width, &readFds, NULL, NULL, NULL) == ERROR) { /*监听*/close(fds[0]); … …; close(fds[3]);return;}for(i=0; iif (FD_ISSET(fds[i], &readFds)) {… …; /* 进行读写操作 */}}/* } */}四、多任务环境的编程:1、任务控制:taskLib.htaskSpawn( ) - 创建任务taskInit( ) -初始化任务,用户自己指定栈和PCB地址taskActivate( ) - 激活已经初始化的任务exit( ) - 在任务中结束 (ANSI)taskDelete( ) - 删除任务taskDeleteForce( ) - 强制删除,即使被保护taskSuspend( ) - 挂起任务taskResume( ) - 恢复挂起的任务taskRestart( ) - 重新启动任务taskPrioritySet( ) - 改变任务优先级taskPriorityGet( ) - 读取任务优先级taskLock( ) - 禁止任务调度taskUnlock( ) - 允许任务调度taskSafe( ) - 保护任务不被删除taskUnsafe( ) - 解除保护taskDelay( ) - 延时taskIdSelf( ) - 得到当前任务的ID taskIdVerify( ) - 任务ID是否存在taskTcb( ) - 得到任务控制块(TCB)的地址taskOptionsSet( ) - 改变任务选项taskOptionsGet( ) - 得到任务当前选项taskRegsGet( ) - 得到任务TCB中寄存器的信息taskRegsSet( ) - 设定任务TCB中寄存器的信息taskName( ) - 得到任务名称taskNameToId( ) - 由名称得到ID taskIdDefault( ) - 设置默认的任务ID taskIsReady( ) - 任务是否就绪taskIsSuspended( ) - 任务是否挂起taskIdListGet( ) - 得到活动的任务列表2、任务互斥 - 信号量:semLib.h semGive( ) –释放一个信号量semTake( ) –获取一个信号量,会阻塞semFlush( ) –使所有阻塞在本信号量上的任务变为就绪状态semDelete( ) –删除一个信号量1)二进制信号量:semBCreate可用于任务同步和互斥,但常用于任务同步2)互斥信号量:semMCreate专门用于任务互斥的信号量,保护临界资源3)计数信号量:semCCreate多实例资源的访问控制3、任务同步1)消息队列:msgQLib.h消息队列msgQCreate( ) - 创建消息队列msgQDelete( ) - 删除消息队列msgQSend( ) - 发送消息msgQReceive( ) - 接受消息,调用后阻塞msgQNumMsgs( ) - 得到消息队列中的消息数量Init() {/* 创建消息队列 */if ((msgQID = msgQCreate(8, 1, MSG_Q_FIFO)) == NULL) { printf("Message queue create failed!\");}}taskSend() {if (OK != msgQSend(msgQID, "A", 1, NO_WAIT, MSG_PRI_NORMAL)) {printf("Message send failed!");}}taskReceive() {uchar_t ch;msgQReceive(msgQID, &ch, 1, WAIT_FOREVER); /* 这里任务会阻塞 */printf("Received from msgq: %c ", ch);}2)管道:ioLib.h,系统默认包含了pipe驱动组件pipeDevCreate( ) - 创建管道pipeDevDelete( ) - 删除管道由于管道属于IO,所以可以使用Select监听,消息队列不是IO,不能使用SelectInit() {/* 创建管道 */if (pipeDevCreate("/pipe/mypipe", 8, 1) != OK) {printf("/pipe/mypipe create fialed!\");}/* 创建互斥信号量 */if ((semMID = semMCreate(SEM_Q_FIFO)) == NULL){printf("Mutex semaphore create failed!\");}}taskSend() {int pd; /* pipe的描述符 */if ((pd = open("/pipe/mypipe", O_WRONLY, 0644)) == ERROR) {printf("Open pipe failed!");}if (semTake(semMID, NO_WAIT) == ERROR) {printf("Pipe in use!");}write(pd, "a", 1);semGive(semMID);close(pd);}taskReceive() {int pd; /* pipe的描述符 */uchar_t ch;if ((pd = open("/pipe/mypipe", O_RDONLY, 0644)) == ERROR) {printf("Open pipe failed!");}if (read(pd, &ch, 1)>0) { /* 这里任务会阻塞 */printf("Received from pipe: %c", ch);}}3)二进制信号量Init() {/* 创建二进制信号量 */if ((semBID = semBCreate(SEM_Q_FIFO, SEM_EMPTY)) == NULL) {printf("Binary semaphore create failed!\");}}taskSend() {semGive(semBID);}taskReceive() {semTake(semBID, WAIT_FOREVER); /* 这里任务会阻塞 */}4)事件:eventLib发送事件要指定目标任务的IDeventReceive( ) - 等待事件eventSend( ) - 发送事件eventClear( ) - 清除当前任务的事件.taskSend() {if (OK != eventSend(taskReceiveID, 0×00000001)) {printf("Event send failed!");}}taskReceive() {UINT32 Ev;if (OK!=eventReceive(0×00ffffff, EVENTS_WAIT_ANY, WAIT_FOREVER, &Ev)) {printf("eventReceive Error!\");}else {Ev &= 0×00000001;if (Ev) {printf("Event %d received!", Ev);}}}五、Watch dog :wdLib.h系统提供了软看门狗定时器,使用也简便:wdCreate( ) - 创建看门狗wdDelete( ) - 删除wdStart( ) - 启动wdCancel( ) - 停止Init() {/* 创建看门狗 */if ((wdID = wdCreate()) == NULL) {printf("Watch dog create failed!\");}}task() {if (OK != wdStart(wdID, sysClkRateGet()*5, proc_wd, 0)) {printf("Watch dog start failed!\");}}int proc_wd(int param) {logMsg(… …);}六、网络编程:sockLib.h使用标准的BSD Socket套接字,使用TCP或者UDP协议进行通讯。
vxworks5.5 安装手册
一. 下载软件:在中就可以找到:[风河VxWorks].WINDRIVER.TORNADO.V2.2.FOR...CD1[风河VxWorks].WINDRIVER.TORNADO.V2.2.FOR...CD2二. 安装和部署:1、先安装daemon虚拟光盘软件;2、使用daemon tool映射(mount)虚拟文件(*.cue,*.bin)(如果没有这两个文件就直接添加iso的压塑包然后点对应的磁盘,进入后点setup.exe文件);3、一路选择默认安装,开始时的key根据DISK_ID的数值输入对应的序列号,name和company可以任意;(key附在文末,查找对应的版本对应的key,分清CD1和CD2)4、一直点击下一步,按默认情况安装,当出现Project Information 向导界面时,Project Name和Number of Tornado Seat 随便填写;5、到最后一步安装license时,选择第三项phone or fax,安装完毕;下面列出主要步骤:图一进入启动后的界面图二点右上角Accept,在点击下一步图三 name和company随便输入,Install输入序列号。
注意不是下面显示的CD number图四 Project Name随便输入,Number of Tornado Seat随便输入个数字图五选择安装目录图六图七选择第三项phone or fax其他图片中没提的步骤选择默认即可。
6、如果安装目录为C:\Tornado2.2,则在其目录下新建文件夹flexlm,将安装光盘下的CRACK目录下的license.dat 拷贝到C:\Tornado2.2\flexlm;7、安装完毕后,如果从开始菜单直接运行tornado,会提示错误,这是因为安装还没有完成。
这时你需要在windows 里面设置一个环境变量LM_LICENSE_FILE = C:\Tornado2.2\flexlm\license.dat方法如下:点击我的电脑右键,选属性-高级-环境变量-新建一个环境变量名称为LM_LICENSE_FILE ,值为C:\Tornado2.2\flexlm\license.dat8、另外一种破解方法是在C盘Tornado2.2文件夹下你会发现一个setup.log文件,用ultraedit或vim打开,在最后一行你会发现一个注册表键值,进入注册表,找到这个键值HKEY_LOCAL_MACHINE\SOFTWARE\FLEXlm License Manager\LM_LICENSE_FILE,将其值修改为:C:\Tornado2.2\flexlm\license.dat注意上面是你软件装在C盘,如果装在D盘,对应的各个C盘改为D.各版本不同处理器对应的key序列号(注意查看软件对应的处理器)一、WINDRIVER.TORNADO.V2.2.FOR.COLDFIRECD1= Tornado 2.2/VxWorks 5.5 for ColdFire (CD1的内容)(DISK_ID: TDK-14627-ZC-01) (CD号)CD2= BSPs/Drivers for VxWorks 5.5: ColdFire (CD2的内容)(DISK_ID: TDK-14637-ZC-01) (CD号)软件大小:347MCD1: A7K8B-MbE7p-9rKfE-Gz9aP-bE59C (CD1的序列号)CD2: A7K9e-Rb9Cp-FNB79-gzbdd-F999C(CD2的序列号)二、WINDRIVER.TORNADO.V2.2.FOR.SUPERHCD1= Tornado 2.2/VxWorks 5.5 for SuperH(DISK_ID: TDK-14625-ZC-01)CD2= BSPs/Drivers for VxWorks 5.5: SuperH(DISK_ID: TDK-14635-ZC-01)CD1: dI&hi-qM6Ip-9rBb3-GzhsN-bE59gCD2: BGphe-MbE7p-8rKf3-gzDPB-F999C三、WINDRIVER.TORNADO.V2.2.FOR.XSCALECD1= Tornado 2.2/VxWorks 5.5 for SA/XScale(DISK_ID: TDK-14622-ZC-01)CD2= BSPs/Drivers for VxWorks 5.5: SA/XScale(DISK_ID: TDK-14632-ZC-01)软件大小:464MCD1: dI&ge-Md37K-gPNfE-5phaS-bE59gCD2: B7pge-Md3GK-gsQbE-gzDdB-F999C四、WINDRIVER.TORNADO.V2.2.FOR.PENTIUMCD1= Tornado 2.2/VxWorks 5.5 for PENTIUM (DISK_ID: TDK-14611-ZC-01)CD2= BSPs/Drivers for VxWorks 5.5: PENTIUM (DISK_ID: TDK-14621-ZC-01)CD1: cAQ8i-qP2I&-g$vT6-3&gjw-bEk9gCD2: A7KbB-Rd37p-hNFBE-kzgaT-b9gpC五、WINDRIVER.TORNADO.V2.2.FOR.68KCD1= Tornado 2.2/VxWorks 5.5 for 68K (DISK_ID: TDK-14626-ZC-01)CD2= BSPs/Drivers for VxWorks 5.5: 68K (DISK_ID: TDK-14636-ZC-01)CD1: cAQ8E-uM6I&-8jsP6-AtgjP-bEk9gCD2: AGK8e-RbE7p-8abA9-9UDdd-F9g9C六、WINDRIVER.TORNADO.V2.2.FOR.ARMCD1= Tornado 2.2/VxWorks 5.5 for ARM (DISK_ID: TDK-14624-ZC-00)CD2= BSPs/Drivers for VxWorks 5.5: ARM (DISK_ID: TDK-14634-ZC-00)软件大小:500MCD1: x#yyo-YVXT#-nozVy-wwoyx-VXy#o-UbFBF CD2: AGpge-QbEGp-haNb3-kUhsS-bEkpC七、WINDRIVER.TORNADO.V2.2.FOR.POWERPCCD1= Tornado 2.2/VxWorks 5.5 for PowerPC (DISK_ID: TDK-14620-ZC-01)CD2= BSPs/Drivers for VxWorks 5.5: PowerPC (DISK_ID: TDK-14630-ZC-01)软件大小:671MCD1: TcS5i-Zq%J+-4XVu#-3&bjv-M63&gCD2: TJS9i-uK6I&-9XsR2-AY8jv-M6n&g八、WINDRIVER.TORNADO.V2.0.FOR.X86CD1=Tornado 2.0 for Intel X86TDK-13127-zc-00(ap)CD2= Tornado 2.0 for Intel X86TDK-12835-ZC-01软件大小:359MCD1: B7KDB-7B9Cp-DBbA9-9UKNb-79CFFCD2: FCKCi-Kd67p-hdcS9-iKbNf-797KF九、WINDRIVER.PLATFORM.ID.V1.0CD1= Tornado 2.2/VxWorks 5.5 for Pentium (DISK_ID: TDK-14621-ZC-01)CD2= BSPs/Drivers for VxWorks 5.5.1(DISK_ID: TDK-14631-ZC-02)CD3= WindML 3.0(DISK_ID: TDK-14774-ZC-00)CD4= PLATFORM ID Components(DISK_ID: TDK-14915-ZC-01)CD5= VxWorks 5.5 Core O/S Source Products(DISK_ID: TDK-14628-ZC-01)CD6= SNiFF+ 4.1.1软件大小:1010MCD1: dAQ8i-UM2I&-gisT2-nQ9Xw-bEkpgCD2: B7KFB-Kb3Gp-gBfB3-5U8sP-bE9pCCD3: B7KFB-7F5Cp-CBdB5-gUKPc-F99pCCD4: BFKFB-7F5Cp-DBdA5-FKKNf-79gpFCD5: B7K8e-KF57p-DdfA5-GU8Pc-F999C十、arm.developer.suite.v1.2 (ADS1.2)软件大小:422M安装方法:1)首先安装虚拟光驱软件DAEMON3.22)MOUNT 文件05.29.02-arm.developer.suite.v1.2-efa .ISO3)自动安装软件后到根据LICENSE安装WIZARD到虚拟光驱上寻找CRACK文件夹中的LICENSE.DAT文件。
VxWorks使用说明书
# IO_ADRS_ELT 网卡I/O地址 # INT_LVL_ELT 网卡中断号
并且修改# DEFAULT_BOOT_LINE定义:
# DEFAULT_BOOT_LINE \ "ene(0,0)host:c:/tornado/target/config/pc486/vxWorks h=129.9.75.39 e=129.9.49.7 u=x86 pw=x86 tn=x86" ene(0,0) /* 启动设备为网卡 */ host /* 主机标识可以任意填写不影响启动过程 */ c:\tornado\target\config\pc486\vxWorks ; /* 需要从主机加载映象文件 */ h=129.9.75.39 ; /* 主机IP地址 */ e=129.9.49.7 /* 目标机IP地址 */ u=x86 ; /* 用户名主机Ftp服务器必须有相应同名用户 */ pw=x86 /* 密码必须与主机Ftp服务器相应同名用户密码相同*/ tn=x86 ; /*目标名可以任意设置不影响启动过程*/
.1 .启动盘制作 在实时应用系统开发调测阶段往往采用以PC机作为目标机来调测主机PC和目标机PC之间可采取串口或是网口 进行联结由于大多数目标已配有网卡网络联结成为最简单快速连接方式串口联结虽通信速率不高也有它自己优 点系统级任务调试(如中断服务ISR)需使通信方式工作在Polled 模式网口联结就不支持因此可以裁剪掉系统 中网络部分以使VxWorks系统更小满足目标板内存约束下面分别对这两种通信方式下目标机VxWorks系统启动 盘制作作简要介绍(以PC机为目标系统)
嵌入式实时操作系统VXWORKS6.6集成环境使用指导
3.将工程建立在workspace之内但是连接到外部位置 所建的工程不允许设置在源文件目录处;所建的工程 因为开发团队的成员有自己的工程,并且共享了部分 源文件(通常为只读的)。这种选择就避免在团队成 员之间通过Workbench互相配合工作是需要建立的象 征性的连接。
2.移除子工程
• A、在Project Explorer窗口,选择Project References >Remove Project Reference或者在 Project 菜单选择 Remove Project Reference。
• B、在Project Explorer窗口,选择Properties再选 Project References或者选择Project > Properties。 然后选择Project References,之后进行移除。
第三部分 工程视图
一、Workspace/Project 的设置 二、各工程类型结构 三、创建一个新工程 四、组织工程结构 五、工程的特殊执行环境
一、Workspace/Project 的设置
1.在workspace建立工程 所建的工程还没有建立源文件;所建的工程已经存在 源文件,但需要添加进工程;所建的工程不允许设置 在源文件目录处。
VxWorks 6.x ,点击 Next。 c.从 Build type 下拉选择菜单选择 Downloadable Kernel
Module 点击Click Next 。 d.在Project Name区域,输入ball 。在本指导说明中都保持
Vxworks操作系统下基本程序的编写和说明
-------
BJTU
第一章 多任务
多任务运行的实现实际上是靠CPU(中央处理单
元)在许多任务之间转换、调度。 CPU只有一个,轮番服务于一系列任务中的某一 个。 任务在自己的时间内运行,因时间片相当短,因 此,给用户的感觉,就好像任务是同时运行的一 样。 如果计算机拥有多个CPU,任务就能真正意义上 同时运行了。 多任务运行使CPU的利用率得到最大的发挥(流 水线),并使应用程序模块化。
轮转调度:优先级相同、处于就绪态的任务公平的分配CPU
时间片轮番调度法(不讲)
I. II.
当两个或两个以上任务有同样优先级,内核允 许一个任务运行事先确定的一段时间,叫做时 间额度(quantum),然后切换给另一个任务。 也叫做时间片调度。 内核在满足以下条件时,把CPU控制权交给 下一个任务就绪态的任务: 当前任务已无事可做 当前任务在时间片还没结束时已经完成了
不可重入型函数
int Temp; //全局变量 void swap(int *x, int *y) //形参,作用域为 此函数执行时 { Temp = *x; *x = *y; *y = Temp; }
非重入性(Reentrancy)
使Swap()函数具有可重入性
把Temp定义为局部变量(任务有自己的动态堆 栈,每个任务只是在自己的堆栈内进行操作。) 调用Swap()函数之前关中断,调用后再开中断 (牺牲了实时性): int locknumber = intLock( );//关中断 intUnlock ( locknumber ); //开中断 禁止任务抢占调度: taskLock(); //禁止抢占调度 taskUnlock(); //恢复抢占调度 用信号量禁止该函数在使用过程中被再次调用
Wind River Vxworks 说明书
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
一.V xWorks653运行时系统1.1. 运行时层一个vxworks653模块由下面四层组成:■core OS—必需■partition—至少需要一个(vThreads 或COIL-based),每个都在一个分区的操作系统之中■APEX shared library—ARINC 653 应用所需■POSIX shared library—POSIX 应用所需1.1.1.Core OS层核心操作系统提供服务给分区。
缺省的,核心操作系统使用ARINC653规范中的时间抢占的调度(TPS)来调度分区。
Vxworks653的核心操作系统还可以采用APPS调度策略在TPS调度的空闲时间内调度优先级抢占调度(PPS)使能的分区。
核心操作系统提供给每个VThreads分区操作系统的服务包括:●分区系统资源●调度分区●代表分区的操作系统执行trap异常●定义和强制分区边界●装载分区●使用端口和通道在分区间传递消息●处理I/O●代表应用完成系统调用●支持分区的调试●监控分区和系统的健康1.1.2.vThreads 层vThreads分区操作系统在核心操作系统分配给该分区的时间内调度vThreads中的线程。
vThreads不直接与设备交互,而是通过核心操作系统的系统调用。
1.1.3.APEX 层构建在vThreads之上,遵循ARINC653规范,并且提供相应功能和API。
1.1.4.POSIX层构建在vThreads之上,遵循用于实时扩展的POSIX标准(1003.1b)。
1.2. 装载和启动当目标板加电时,按照下面的步骤进行装载和启动●初始的启动码装载核心操作系统,分区操作系统,共享库,以及应用●核心操作系统初始化自身,启动它自己的子系统●核心操作系统创建分区●核心操作系统启动分区调度器,并且让应用初始化自身核心操作系统可以在初始化完成之后下载在线装载的应用程序到分区。
应用可以在分区运行之时装载到分区。
1.3. 运行时模型核心操作系统处理来自每个分区的系统调用,并且在运行系统调用前校验每个系统调用的语句。
使用vThreads分区操作系统的应用拥有完全的vThreads任务间通信机制。
APEX库提供了遵循ARINC653规范的分区管理,进程管理以及时间管理;为分区间通信提供了消息,通道,端口;为分区内通信提供缓冲区,黑板,信号量以及事件。
端口映射允许在VxWorks653模块之外通信。
二.开发APEX应用APEX是位于应用程序和支持ARINC653规范的操作系统之间的API。
对于VxWorks653,操作系统是vThreads分区操作系统和核心操作系统。
APEX给vThreads分区提供了时间、进程管理以及管理周期性和非周期性进程的能力。
APEX提供如下服务:●管理分区●管理进程●管理时间●与其他分区通信(使用消息,端口和通道)●分区内的通信(使用缓冲区,黑板,信号量以及事件)●监控健康2.1. 分区管理分区的管理包含分配分区内存以及依据ARINC653规范初始化分区。
2.1.1.分配分区内存每个分区的资源分配都定义在基于XML的配置和编译过程中,根据指定在该规范中的分区需求,为每个分区分配唯一的物理内存。
通过禁止对超过该分区的内存区域的写访问来确保内存分区。
2.1.2.初始化分区:冷和热启动冷启动:当VxWorks653模块加电并且创建分区时,使用冷启动分区操作模式。
在冷启动模式下,分区对象被分配并且初始化。
热启动:热启动分区操作模式导致一个分区重新初始化或者由于遇到错误重新启动。
在热启动模式下,持久数据不会重新初始化,分区代码也不会重新装载。
每个分区所使用的资源(如通道、进程、队列、信号量或事件等)在系统编译时指定。
在分区的初始化阶段,创建分区所需的资源,然后分区进入NORMAL模式。
2.1.3.分区属性分区属性定义在XML配置文件中。
固定的分区属性包括:●标识符:定义在VxWorks653模块上唯一的分区标识符。
●内存需求:分配给分区的物理内存●周期:分区的激活周期。
用来确定核心操作系统的整个时间帧内的分区激活的运行时位置。
●持续时间:分区的每个周期内核心操作系统给予的处理器时间。
●关键级别:分区的RTCA/DO-178B认证级别。
●通信需求:分区与其他分区通信的通信通道●分区健康监控表(健康监控配置):健康监控器对于故障的动作指令。
2.1.4.获得分区状态GET_PARTITION_STATUS函数可以获得当前情况下的分区状态。
type PARTITION_STATUS_TYPE is recordIDENTIFIER : PARTITION_ID_TYPE;PERIOD : SYSTEM_TIME_TYPE;DURATION : SYSTEM_TIME_TYPE;LOCK_LEVEL : LOCK_LEVEL_TYPE;OPERATING_MODE : OPERATING_MODE_TYPE;START_CONDITION : START_CONDITION_TYPE;end record;type OPERATING_MODE_TYPE is (IDLE, COLD_START, WARM_START, NORMAL);type START_CONDITION_TYPE is (NORMAL_START,PARTITION_RESTART,HM_MODULE_RESTART,HM_PARTITION_RESTART);Where:NORMAL_START is a normal power-up.PARTITION_RESTART is either due to COLD_START or WARM_START by the partitionitself, through the SET_PARTITION_MODE service.HM_MODULE_RESTART is a recovery action taken at module level by the HM.HM_PARTITION_RESTART is a recovery action taken at partition level by the HM.2.1.5.设置分区模式SET_PARTITION_MODE函数可以设置分区模式为IDLE,COLD_START,WARM_START,NORMAL。
其中IDLE模式:分区关闭。
分区未被初始化,没有进程正在运行,但是分配给该分区的时间窗口未被改变。
COLD_START模式:分区重启使用冷启动初始化。
WARM_START模式:分区重启使用热启动初始化。
NORMAL模式:激活的进程被调度。
2.1.6.控制分区中的抢占进程的LOCK_PREEMPTION函数可以为分区中的抢占上锁。
该函数增加了分区的锁级,使得进程不能在分区中重调度。
当进程访问临界区时,或资源被同一分区中的多个进程共享时,这个能力十分重要。
LOCK_PREEMPTION函数不会影响其他分区的调度。
如果一个位于临界区的进程由于分区窗口结束而被中断时,当分区再次运行时仍然是该进程最先运行。
UNLOCK_PREEMPTION函数可以解锁分区的抢占。
这个函数降低了分区的锁级,仅当锁级达到零时,进程的重调度才能恢复。
2.1.7.分区调度对于时间分区,ARINC653提供了两级调度机制。
在核心模块级,采用预先确定的基于时间窗的循环调度算法来调度各个分区,分区没有优先级。
核心操作系统根据每个分区的周期与持续时间信息,维护一个固定时间长度的主时间帧,该主时间帧的时间长度为所有分区周期的最小公倍数。
静态调度算法为每个分区生成该主时间帧内相应的分区调度窗口,每个分区调度窗口由从主时间帧开始的偏移和期待的持续时间来定义。
分区的调度窗口事先定义在配置表中。
每个分区在其分区调度窗口内被激活并占用CPU,并保证每个分区在其调度窗口内运行时不被其他分区打断。
主时间帧在模块的运行期内周期性的重复,每个主时间帧中拥有相同的分区调度窗口执行次序。
2.2. 进程管理APEX进程是包含在APEX分区内的编程单元。
同一分区内的进程可以并发执行。
进程由可执行程序、数据和栈、程序计数器、栈指针以及优先级期限组成。
进程管理包含创建进程、改变进程当前优先级、得到进程的当前状态、得到进程ID、挂起和恢复进程、停止和启动进程、控制抢占等函数。
2.2.1.进程类型●周期性进程●非周期性进程2.2.2.进程调度在分区级,调度单元是APEX进程。
每个进程拥有优先级,调度算法是优先级抢占的。
分区级操作系统总是选择处于就绪状态且具有最高优先级的进程获得处理器资源。
如果多个进程拥有相同的优先级,则分区操作系统选择就绪队列中第一个进程。
进程将控制处理器资源直到另一个进程重调度事件发生。
2.2.3.进程状态变迁2.3. 时间管理2.3.1.调度分区见2.1.7分区调度2.3.2.系统时钟时间系统时钟时间为系统提供了唯一的时间。
GET_TIME函数可以获得系统时钟时间。
2.3.3.请求资源和超时当进程请求一个APEX资源(例如信号量或事件)时,可以指定下列超时类型之一:●INFINITE_TIME_VALUE从不过期。
永久等待●ZERO_TIME_VALUE不等待资源。
如果资源不可得,则返回一个错误●Finite value of timeout等待一个资源的最大时间超时单元是SYSTEM_TIME_TYPE类型,纳秒单位。
2.3.4.调度进程APEX时间管理函数让分区来控制进程。
在每个处理周期(cycle)的末尾,一个周期性的进程请求PERIODIC_WAIT服务来获得一个新的期限。
通过这个进程的下个周期的释放点来计算新的期限。
对于所有进程,TIMED_WAIT服务让进程将自己悬挂一段时间。
在等待时间过去后,进程能够被调度。
REPLENISH服务让进程将它的当前期限推迟一段已过的时间。
分区内的每个进程可以指定一段逝去的时间(叫做时间能力)。
时间能力用来设置处理期限时间,vThreads周期性的评估该时间以确定是否进程在分配的时间内能够完成它的处理。
2.3.5.期限每个进程关联了一个固定的时间能力,表示分配给它的响应时间用于满足它的处理需求。
期限时间可以确定是否进程能够在它的时间能力内完成它的处理。
可以通过REPLENISH服务增加期限时间,在下一次激活时将创建新的期限。
有三种类型的期限:●硬期限如果进程不能在一个指定的时间周期内满足一个硬期限,vThreads将采取补救动作●软期限如果进程不能在一个指定的时间周期内满足一个软期限,失效将被记录,并且处理继续●没有期限如果进程不能在一个指定的时间周期内完成处理,将不采取任何动作对于一个周期性进程,当进程的激活周期开始时,期限时间的倒计时也同时开始。