vxWorks BSP移植笔记

合集下载

VxWorks开发教程(2024)

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入门

VxWorks入门

1. 概述1.1 TORNADO 组件1.1.1 开发工具1.1.2 实时系统1.1.3 Tornado 文件目录1.2 硬件/软件配置1.3 booting介绍1.4 Tornado开始过程1.5 WDB 代理2 Projects2.1 bootable projects2.2 集成模拟器vxsim2.3 Downloadable projects 2.4 build说明3 WindSh 和Browser3.1 WindSh3.2 Browser4 CrossWind4.1 Debugging简介4.2 任务级Debugging 4.3 系统级DebuggingVxWorks 是美国Wind River System 公司(以下简称风河公司,即WRS 公司)推出的一个实时操作系统。

WRS 公司组建于1981年,是一个专门从事实时操作系统开发与生产的软件公司,该公司在实时操作系统领域被世界公认为是最具有领导作用的公司。

VxWorks 是一个运行在目标机上的高性能、可裁减的嵌入式实时操作系统。

它以其良好的可靠性和卓越的实时性被广泛地应用在通信、军事、航空、航天等高精尖技术及实时性要求极高的领域中,如卫星通讯、军事演习、弹道制导、飞机导航等。

在美国的F-16、FA-18 战斗机、B-2 隐形轰炸机和爱国者导弹上,甚至连1997年4月在火星表面登陆的火星探测器上也使用到了VxWorks。

1984年WRS 公司推出它的第一个版本--VxWorks 1.0.1,在1999年推出了它的最新版本VxWorks 5.4。

从1995年以后,WRS 公司推出了一套实时操作系统开发环境-- Tornado。

1.1 Tornado2.0 组件Tornado是嵌入式实时领域里最新一代的开发调试环境。

Tornado给嵌入式系统开发人员提供了一个不受目标机资源限制的超级开发和调试环境。

T ornado包含三个高度集成的部分:. 运行在宿主机和目标机上的强有力的交叉开发工具和实用程序;. 运行在目标机上的高性能、可裁剪的实时操作系统VxWorks;. 连接宿主机和目标机的多种通讯方式,如:以太网,串口线,ICE或ROM仿真器等。

完整版freeModbus代码解读及移植笔记

完整版freeModbus代码解读及移植笔记

完整版freeModbus代码解读及移植笔记1. FreeModbus协议分析协议必须首先调用初始化功能eMBinit()函数。

后调用eMBEnable(),最后,在循环体或者单独一个任务中调用eMBPoll()函数。

2. 应用层协议2.1. 系统的启动2.1.1. eMBInit()函数的源码分析以RTU方式为例,首先,检查调用的地址是否合法。

如不合法,返回错误。

如果合法则继续执行,首先,针对RTU方式还是ASCII方式,选择不同的编译模块。

对需要调用的函数指针进行复制。

如果移植需要改变其他用途,则要修改相应的指针,包括如下赋值:pvMBFrameStartCur = eMBRTUStart;pvMBFrameStopCur = eMBRTUStop;peMBFrameSendCur = eMBRTUSend;peMBFrameReceiveCur = eMBRTUReceive;pvMBFrameCloseCur = MB_PORT_HAS_CLOSE ? vMBPortClose :NULL;pxMBFrameCBByteReceived= xMBRTUReceiveFSM;pxMBFrameCBTransmitterEmpty = xMBRTUTransmitFSM;pxMBPortCBTimerExpired = xMBRTUTimerT35Expired;然后调用eStatus =eMBRTUInit( ucMBAddress, ucPort, ulBaudRate, eParity);具体初始化通讯端口。

2.1.2. eMBRTUIniteMBRTUInit这个函数主要干两件事:第一,初始化串口:if( xMBPortSerialInit(ucPort, ulBaudRate, 8, eParity ) != TRUE ) {eStatus = MB_EPORTERR;}这个函数在portserial.c中,需要用户在移植的时候根据自己的处理器编写。

vxworks_01_bspOverview

vxworks_01_bspOverview

Chapter1OverviewTornado BSP Training Workshop© Copyright Wind River Systems1-1Wind River SystemsOverview1.1Integration IssuesVxWorks Boot SequenceTornado Directory StructureConventions and ValidationTornado BSP Training Workshop© Copyright Wind River Systems1-2Wind River SystemsWhat is a BSP?•Provides VxWorks with primary interface to hardwareenvironment.•BSP Responsibilities:q Hardware initialization on power-up.q Support for VxWorks access to hardware drivers.q Integration of hardware-dependent and hardware-independent software in VxWorks.•Components consist of:q Source, include, and make files.q Derived files.q Binary driver modules.•May be validated to be WRS compliant.Tornado BSP Training Workshop© Copyright Wind River Systems1-3Wind River SystemsWind River Systems Tornado BSP Training Workshop © Copyright Wind River Systems 1-4What a BSP is Not• A BSP is not a hardware driver:q A hardware driver accesses hardware.•Hardware drivers are classified as generic or BSPspecific:qGeneric drivers manage devices which can be moved from one target environment to another (e.g. LAN chip).q BSP drivers manage devices which are specific to thetarget environment (e.g. interrupt controller).•BSP developer responsible for:q Complete support for BSP specific drivers.q Integration of generic device drivers.• A BSP provides support for accessing drivers through VxWorks. This ishow a BSP provides access to the system hardware environment.Wind River Systems Tornado BSP Training Workshop © Copyright Wind River Systems 1-5BSPs and VxWorksHardware-independent SoftwareTools - ApplicationI/O SystemVxWorks Libraries TCP/IP File S ystemMUXHardware-Dependent Software Hardware wind KernelBSP LAN Driver SCSIDriverLAN Controller SCSIControllerSCC TimerBSP Responsibility: HardwareInitialization•VxWorks boot sequence specifics will vary withprocessors and hardware environments.•Common initialization requirements:q Provide code at specific location in memory whichprocessor will jump to on reset or power-up.q Set processor in a specific state.q Initialize memory and memory addressing.q Disable interrupts.q Pass control to additional bootstrapping code.q Load required VxWorks segment(s) into RAM.q Place hardware in quiescent state before initializingVxWorks kernel.Tornado BSP Training Workshop© Copyright Wind River Systems1-6Wind River SystemsWind River Systems Tornado BSP Training Workshop © Copyright Wind River Systems 1-7BSP Responsibility: VxWorks Access To Hardware Drivers•Some driver support is provided by BSP . Examples:qDriver defines ISR(s), but BSP connects ISR(s) to interrupt vector table.qBSP creates structures (objects) which are passed to driver for initialization.q Offset constants and access macros for hardwareregisters provided by BSP and used by driver.•Provides portability for hardware driver code.•Device configuration management:qAccess to full range of device features (possibly at a later time).q Separate development/production configurations.•Example - Portability for LAN driver code would allow developer to:qTransport LAN driver to new hardware environment.q Provide new LAN driver for familiar hardware environment.Wind River Systems Tornado BSP Training Workshop © Copyright Wind River Systems 1-8BSP Responsibility: Integration of Hardware Dependent Software•Provides code flexibility and portability:qCompile-time flexibility.q Run-time portability.•Compile-time flexibility:q Uses preprocessor macros to customize system.q Provides ability to produce optimized modules without changing source code.•Run-time portability:qUses pointers to access routines.qProvides portability for compiled object modules.•Combining techniques allows compile-time macros to implement run-time vectored routines. This is the preferred method at WRS.Wind River Systems Tornado BSP Training Workshop © Copyright Wind River Systems 1-9•Primary BSP files:qSource files.qInclude files.q Make files.•Source files:q Generic code is written in C. Architecture specific and performance optimized code is assembly.•Include files:q All includes and definitions specific to a CPU board are localized in two files.•Make file:q Controls building of all images.•The two BSP specific include files are distinguished by definitions whichare fixed once the physical hardware environment is fixed, anddefinitions which allow configuration of the hardware environment after the physical hardware environment is fixed.•All images are built using a compact primary makefile which accessesmake sub-files.Wind River Systems Tornado BSP Training Workshop © Copyright Wind River Systems 1-10•Derived BSP files are created using:qPrimary BSP files.qDriver source files.q Modules in VxWorks archive libraries.•Derived BSP files are classified as:q Hardware initialization object modules.q VxWorks boot object modules.qVxWorks images.q VxWorks binary symbol table.• A complete BSP port will generate all of these files.•End users will recreate some of these files whenconfiguring the system.•There are two “non-standard” derived BSP files:qIf text segment write protection for VxWorks has been activated,there is an object module to guarantee that text and data do not share a common memory page. This functionality supports VxVMI. If this functionality has not been included this will be a null object module,however, it is still required.q There is an ASCII file derived from an nroff file containing BSPspecific information.Wind River Systems Tornado BSP Training Workshop © Copyright Wind River Systems 1-11BSP Development•Development should occur in incremental steps:qFirst set up development environment (down-load path(s), debug strategies, etc.).qWrite pre-kernel initialization code.qOptionally activate WDB agent and Tornado tools using polled serial or ethernet interface.qStart minimal VxWorks kernel adding support for a system clock, and install interrupts.qComplete BSP providing all necessary support for hardware environment (full network support etc.).q Clean-up, testing and documentation.•Course material will be presented following thissequence as closely as possible.•Pre-kernel Tornado ethernet interface provided by NetROM which willbe discussed later in the course.BSP Development - cont.•Development time may be reduced by purchasing:q The BSP Developer’s Kit.q Appropriate reference BSP.•BSP Developers Kit provides:q A Validation Test Suite (VTS).q Template BSP (all architectures).q Template device drivers.• Purchasing a reference BSP which most closely matches target environment:q Specific device drivers which are not part ofreference BSP can also be purchased from WRS.•Reference BSP obtained when Tornado is purchased.Tornado BSP Training Workshop© Copyright Wind River Systems1-12Wind River SystemsWind River Systems Tornado BSP Training Workshop © Copyright Wind River Systems 1-13BSP Validation•BSP validation:qWRS validated.q Non WRS validated.• A WRS validated BSP:q Classified as Tornado Certified, and may be distributed displaying this information.q Contact WRS to obtain validation requirements.•BSP validation uses a Validation Test Suite (VTS):q Automated test suite which runs on host and target to exercise BSP and report defects.q Included in BSP Developer’s Kit.q VTS distribution includes source to allow extension.•BSP Porting Kit includes:qValidation Test Suite.qBSP Porting Kit Manual.qSample driver source code.q Template BSP files (all architectures).•Optional enhanced features - Engineering Services developmentsupport.OverviewIntegration Issues1.2VxWorks Boot SequenceTornado Directory StructureConventions and ValidationTornado BSP Training Workshop© Copyright Wind River Systems1-14Wind River SystemsWind River Systems Tornado BSP Training Workshop © Copyright Wind River Systems 1-15VxWorks Image Types•There are three classes of VxWorks images:qLoadable images.qROM-based images - compressed/uncompressed.q ROM-Resident images.•Loadable images are loaded into RAM by boot code.qBoot code is “burned” into ROM or Flash.qBoot code is a stand-alone VxWorks application.•ROM-based images load themselves into RAM from ROM or Flash.•ROM-resident images execute out of ROM or Flash.q Only the data segment of the VxWorks image isloaded into RAM.•VxWorks images consist of:qText segment - Executable instructions.qData Segment - Initialized global and static variables.q BSS (Block Started by Symbol) Segment - Un-initialized global andstatic variables. (ANSI C/C++ requires these variables to be initialized to zero.).•These are generic components common to all VxWorks images.Component details will depend on the Object Module Format for the image:qa.out qCOFF q ELF•BSS segments of VxWorks images are zeroed by initialization code afterappropriate image segments are relocated.Some Terminology•VxWorks boot image - A VxWorks image designed toload another VxWorks image containing applicationcode (often referred to as “boot code”).q“Burned” into ROM or loaded into Flash.q May execute in ROM/Flash (ROM-resident).q May execute out of RAM.•VxWorks image - A VxWorks image containing“end-user” code. Sub-types:q Loadable VxWorks image - VxWorks images loadedby VxWorks boot image.q VxWorks ROM image - VxWorks image “burned”into ROM or loaded into Flash. May execute inROM/Flash (ROM-resident) or RAM.Tornado BSP Training Workshop© Copyright Wind River Systems1-16Wind River SystemsVxWorks Startup Sequence•The sequence of events which occur at power-up are afunction of the type of VxWorks image which will run.•The initial phase of the start-up sequence is the sameacross all VxWorks image types.•Processor is “jumped” to the entry point of boot-strapcode in ROM or Flash. This code:q Disables interrupts (via the processor).q Initializes target memory.q Loads appropriate VxWorks image segments.q Jumps to code to place target in a quiet state.•Various startup sequences are discussed next.Tornado BSP Training Workshop© Copyright Wind River Systems1-17Wind River SystemsWind River Systems Tornado BSP Training Workshop © Copyright Wind River Systems 1-18Boot Sequence - Loadable VxWorks Image•Bootstrap code executes and loads text and datasegments of boot code (from ROM or Flash) into RAM.Scenarios are:qBoot code compressed - Decompression during copy qBoot code uncompressed - Copy q Boot code is ROM-resident - Copy data segment only •Boot program executes and loads VxWorks image into RAM. Jumps to VxWorks load point.•System initialization code statically linked into loaded VxWorks image executes and completes initialization.•Memory allocated in RAM for boot code is reclaimed by VxWorks.•VxWorks startup sequence is sometimes referred to as a “boot”sequence.•Image stored in ROM/Flash is a boot-ROM image.•Loaded image will be a “end-user” or “application” image.Wind River Systems Tornado BSP Training Workshop © Copyright Wind River Systems 1-19Loadable VxWorks ImageBootStrapProgramsROM/FlashRAM VxWorksBoot ProgramROMBoot Program RAM_LOW_ADRSRAM_HIGH_ADRSFREE_RAM_ADRS LOCAL_MEM_LOCAL_ADRS •LOCAL_MEM_LOCAL_ADRS is the beginning of RAM.•RAM_LOW_ADRS is the load point for VxWorks. It is also the start of thetext segment of VxWorks.•FREE_RAM_ADRS marks the end of the VxWorks image. Usually thesystem memory pool or the target server memory pool begins here.•RAM_HIGH_ADRS is the load point for the boot program. It is also thestart of the text segment for the boot program unless the boot image is ROM-resident, in which case it is the start of the data segment for the boot module.Startup Sequence - ROM-basedVxWorks Image•Bootstrap code executes and loads text and datasegments of VxWorks (from ROM or Flash) into RAM.Scenarios are:q VxWorks compressed - Decompression during copyq VxWorks uncompressed - Copy•Control transfers to VxWorks initialization code inRAM.•System initialization code statically linked intoVxWorks image executes (in RAM) and completesinitialization.Tornado BSP Training Workshop© Copyright Wind River Systems1-20Wind River SystemsWind River Systems Tornado BSP Training Workshop © Copyright Wind River Systems 1-21ROM-based VxWorks ImageBootStrapProgramsROM/FlashRAM VxWorksRAM_LOW_ADRSFREE_RAM_ADRS ROM-basedVxWorksImage LOCAL_MEM_LOCAL_ADRS •LOCAL_MEM_LOCAL_ADRS is the beginning of RAM.•RAM_LOW_ADRS is the load point for VxWorks. It is also the start of thetext segment of VxWorks.•FREE_RAM_ADRS marks the end of the VxWorks image. Usually thesystem memory pool or the target server memory pool begins here.Startup Sequence - ROM-residentVxWorks Image•Bootstrap code executes and loads data segment ofVxWorks image (from ROM or Flash) into RAM.•Control branches to VxWorks initialization code inROM or Flash.•System initialization code statically linked intoVxWorks image executes (in ROM or Flash) andcompletes initialization.Tornado BSP Training Workshop© Copyright Wind River Systems1-22Wind River SystemsWind River Systems Tornado BSP Training Workshop © Copyright Wind River Systems 1-23ROM-resident VxWorks ImageBootStrapProgramsROM/FlashRAM RAM_LOW_ADRS FREE_RAM_ADRSVxWorks Data + BSS VxWorksTextVxWorksData + BSS LOCAL_MEM_LOCAL_ADRS •LOCAL_MEM_LOCAL_ADRS is the beginning of RAM.•RAM_LOW_ADRS is the load point for VxWorks. It is also the start of thedata segment of VxWorks.•FREE_RAM_ADRS marks the end of the VxWorks image. Usually thesystem memory pool or the target server memory pool begins here.Wind River Systems Tornado BSP Training Workshop © Copyright Wind River Systems 1-24Startup Sequence - VxWorks Initialization•After (“end-user”) VxWorks segment(s) are loaded into RAM, system initialization code statically linked intoVxWorks image executes to complete the bootsequence.•This code will:qPlace hardware environment in a quiet state.qInitialize and start the wind kernel.q Spawn a task to complete system initialization.•System initialization task will initialize support for end-user specified facilities, and start the end-user’sapplication.•Loadable VxWorks images do not assume that they have been loaded by VxWorks boot code, so most initialization performed by boot-strap code must be duplicated in loaded image.•The system initialization task will install drivers and ISRs, create devices, initialize the I/O system, etc. Usually, it will spawn a user application initialization task just before it terminates.•The specifics of a VxWorks boot image will be discussed later in the course.OverviewIntegration IssuesVxWorks Boot Sequence1.3Tornado Directory StructureConventions and ValidationTornado BSP Training Workshop© Copyright Wind River Systems1-25Wind River SystemsWind River Systems Tornado BSP Training Workshop © Copyright Wind River Systems 1-26•Tornado is composed of a set of modular components.•Modularity aids in portability, flexibility of use, andmaintenance.•Tornado modules are:qHost Support Package (HSP).qGeneric (target independent) VxWorks.qArchitecture Module.q Board Support Package.q Wind Debug Agent (WDB Agent).•Tornado modules have been designed to minimizeinterdependence.•The Host Support Package is the host-specific component of Tornado(cross-compiler, dynamic loader, Tornado tools, etc.).•The generic VxWorks component is independent of host or targetenvironments (wind kernel, semaphore libraries, I/O system, etc.).•The architecture module provides support for target processor(s).•The Board Support Package provides support for target hardware.•The WDB agent provides target agency for the host resident Tornadotools. Because it is independent of VxWorks it can be run as task or a “virtual ROM monitor”.Wind River Systems Tornado BSP Training Workshop © Copyright Wind River Systems 1-27GenericVxWorks ArchBSPHSPWDBAgentTornado Modularity and theTornado Directory Tree•Files which make up Tornado are organized to reflectTornado’s component modularity.•At the highest level files (relevant for BSP development) are separated into host and target directories.•All BSP specific files are in the target directory.However, many tools useful in developing a BSP are inthe host directory.•Files which will be modified in developing a BSP are ina configuration sub-directory of the target directory.Tornado BSP Training Workshop© Copyright Wind River Systems1-28Wind River SystemsWind River Systems Tornado BSP Training Workshop © Copyright Wind River Systems 1-29Tornado Directory TreeTornado host share target Tornado host-resident toolsShared XDR codeVxWorks OSBoard supportpackage•The shared XDR code is used in the transfer of data between tools andthe target.•The Tornado directory tree can be installed anywhere that is convenient.Wind River Systems Tornado BSP Training Workshop © Copyright Wind River Systems 1-30Host Directory Treeinclude Header files for Tornado toolshost-os Host-specific toolsbin Tornado and GNU host executableslib Tornado Tool librariesmanGNU man pages resourceGUI, Tcl, and Help support files tclStandard Tcl distribution manUNIX man pages on Tornado tools host src Source for VxColor demo•The directory host-os is named for your host’s hardware and operatingsystem.Wind River Systems Tornado BSP Training Workshop © Copyright Wind River Systems 1-31Target Directory Treeconfig Files to configure and build VxWorksall Generic configuration filesbspName Board Support Package (BSP)hVxWorks header files lib Libraries provided by VxWorksman UNIX man pagessrc Partial VxWorks source codeunsupported Tools, driverstarget •The directory bspName is named for your target’s Board SupportPackage.Wind River Systems Tornado BSP Training Workshop © Copyright Wind River Systems 1-32BSP Relevant Files•All code which executes at power-up is in files withinthe config directory.•BSP code vs. generic driver code:qGeneric device driver code is designed to be usable with multiple BSPs (network drivers, serial drivers,etc.).q BSP (device driver) code is tightly coupled to thetarget environment and is not designed to be used with other BSPs.•BSP specific code will always reside in ../<bspName>.•Generic device driver code not supplied by WRS willreside in the <bspName> directory or a subdirectory of<bspName>.•Generic device driver code supplied by WRS will reside insubdirectories under ../src/drv and ../h/drv .OverviewIntegration IssuesVxWorks Boot SequenceTornado Directory Structure1.4Conventions and ValidationTornado BSP Training Workshop© Copyright Wind River Systems1-33Wind River SystemsWind River Systems Tornado BSP Training Workshop © Copyright Wind River Systems 1-34BSP Conventions and Validation•BSP conventions and validation procedures aredesigned to help guarantee integrity of BSP .•BSP conventions fall into categories:qCoding conventions qDocumentation guidelines.qBSP packaging.q Driver guidelines.•Validation test:q Package validation.q Installation test.q Functional test (VTS).q Code review process and WRS validation process.•Users guide in BSP development kit contains discussion of BSPconventions and validation issues.Summary•BSP responsible for supporting system hardwareenvironment:q Initialization of hardware environment.q VxWorks/application access to hardware drivers.q Hardware/software integration.•Provides VxWorks with primary interface to hardwareenvironment.•Components consist of:q Source, include, and make files.q Derived files.•May be validated to be WRS compliant.Tornado BSP Training Workshop© Copyright Wind River Systems1-35Wind River Systems。

VxWorks系统的BSP概念及启动过程

VxWorks系统的BSP概念及启动过程

VxWorks系统的BSP概念及启动过程
乔从连
【期刊名称】《舰船电子对抗》
【年(卷),期】2005(28)1
【摘要】VxWorks作为一个高性能的嵌入式实时操作系统,已经得到了广泛的应用.介绍了实时操作系统VxWorks的BSP的概念及组成,详细分析了VxWorks系统的初始化流程和启动过程.
【总页数】4页(P61-64)
【作者】乔从连
【作者单位】船舶重工集团公司723所,扬州,225001
【正文语种】中文
【中图分类】TP316.89
【相关文献】
1.基于Pentium处理器VxWorks实时操作系统BSP的设计 [J], 张勇
2.嵌入式实时操作系统VxWorks下BSP分析及VxWorks裁减 [J], 褚哲;孟小锁
3.嵌入式语音通信系统中VxWorks BSP的设计实现 [J], 孙敬国;刘庆华
4.VxWorks系统的BSP设计与实现 [J], 王彦刚;吕遵明;万留进
5.基于MPC850 VxWorks系统的BSP设计 [J], 冯先成;李寒;张铁男
因版权原因,仅展示原文概要,查看原文内容请购买。

北邮研究生嵌入式系统实验课程——第4-4节 VxWorks网络编程

北邮研究生嵌入式系统实验课程——第4-4节 VxWorks网络编程
12
VxWorks网络组件
basic network initialization components: 基本的网络初始化组件
– VxWorks基本网络支持 – 网络设备的启动
network devices:网络设备
– 网络设备的类型
networking protocols:网络协议
– TCP/IP组件 – 应用及路由协议
2
1、网络基础
OSI七层协议 TCP/IP协议 路由 Internet Protocol(IP)
– 数据报(Datagram)通信协议 – 是一种尽力而为业务(Best-effort ) 数据丢失(Loss) 重新排序(Reordering) 数据重复(Duplication) 延时(Delay) – 主机到主机的数据传送
Block until connection established
Socket() Connect()
Connection establishment
send()
Communication message (request)
recv()
Process request
send()
Communication message (reply)
传输协议(Transport Protocols)
用户数据报协议( User Datagram Protocol (UDP))
– 对数据进行校验 – 仍然是尽力而为的服务
传输控制协议(Transmission Control Protocol (TCP))
– 对数据进行校验 – 可靠的字节流传送 – 流量和拥塞控制
3
IP地址
32-bit的识别符 (IPv4, IPv6=128 bits) 点分方式的四个十进制数来表示: 192.118.56.25 -> 167.208.101.28

什么是bsp

什么是bsp

BSP(Board Support Package)是板级支持包,是介于主板硬件和操纵系统之间的一层,应该说是属于操纵系统的一部分,主要目的是为了支持操纵系统,使之能够更好的运行于硬件主板.BSP是相对于操纵系统而言的,不同的操纵系统对应于不同定义形式的BSP,例如VxWorks 的BSP和Linux的BSP相对于某一CPU 来说尽管实现的功能一样,可是写法和接口定义是完全不同的,所以写BSP一定要按照该系统BSP的定义形式来写(BSP的编程过程大多数是在某一个成型的 BSP模板上进行修改).这样才能与上层OS保持正确的接口,良好的支持上层OS.例如:在VxWorks中的网卡驱动,首先在config.h中包含该网卡,然后将网卡含网卡的信息的参数放进数组 END_TBL_ENTRY endDevTbl [] 中,系统通过函数muxDevLoad( )调用这个数组来安装网卡驱动.而在Linux中的网卡驱动,是在space.c中声明该网络设备,再把网卡驱动的一些函数加到dev结构中,由函数ether_setup()来完成网卡驱动的安装.纯粹的BSP所包含的内容一般说来是和系统有关的驱动和程序,如网络驱动和系统中网络协议有关,串口驱动和系统下载调试有关等等.离开这些驱动系统就不能正常工作.Tornado中BSP的编译和上层应用程序不同,用命令行或直接在Tornado环境下Build,在Tornado下不能跟踪调试.用户也可以添加自己的程序到BSP中,但严格来说不应该算BSP.一般来说这种做法不建议.由于一旦操纵系统能良好运行于终极的主板硬件后,BSP也就固定了,不需要做任何改动.而用户自己在BSP中的程序还会不断的升级更新,这样势必对BSP有不好的影响,对系统造成影响,同时由于BSP调试编译环境较差,也不利于程序的编译调试.上层程序Tools - ApplicationsI/O SystemVxWorks LibrariesTCP/IPWind KernelBSPSCSI ControllerrSerial ControllerClock TimerEthernet Controller.. ..硬件BSP在嵌进式系统和Windows系统中的不同实在运行与PC机上的windows或linux系统也是有BSP的.只是PC机均采用同一的X86体系架构,这样一定操纵系统 (windows,linux..)的BSP相对x86架构是单一确定的,不需要做任何修改就可以很轻易支持OS在x86上正常运行,所以在PC机上谈论 BSP这个概念也没什么意义了.而对嵌进式系统来说情况则完全不同,目前市场上多种结构的嵌进式 CPU(RISC)并存(PPC,ARM,MIPS....),为了性能的需要,外围设备也会有不同的选择和定义.一个嵌进式操纵系统针对不同的CPU, 会有不同的BSP,即使同一种CPU,由于外设的一点差别(如外部扩展DRAM的大小,类型改变),BSP相应的部分也不一样.所以根据硬件设计编写和修改BSP,保证系统正常的运行是非常重要的.BSP和PC机主板上的BIOS区别BSP 和PC机主板上的BIOS区别很大,BIOS主要是负责在电脑开启时检测、初始化系统设备(设置栈指针,中断分配,内存初始化..)、装进操纵系统并调度操纵系统向硬件发出的指令,它的Firmware代码是在芯片生产过程中固化的,一般来说用户是无法修改.实在是为下载运行操纵系统做预备,把操纵系统由硬盘加载到内存,并传递一些硬件接口设置给系统.在OS 正常运行后,BIOS的作用基本上也就完成了,这就是为什么更改BIOS一定要从新关机开机.PC 机BIOS的作用更象嵌进式系统中的Bootloader(最底层的引导软件,初始化主板的基本设置,为接收外部程序做硬件上的预备).与 Bootloader不同的是BIOS在装载OS系统的同时,还传递一些参数设置(中断端口定义,...),而Bootloader只是简单的装载系统.BSP 是和操纵系统绑在一起运行在主板上的,尽管BSP的开始部分和BIOS所做的工作类似,可是大部分和BIOS不同,作用也完全不同.此外BSP还包含和系统有关的基本驱动(串口,网口...),此外程序员还可以编程修改BSP,在BSP中任意添加一些和系统无关的驱动或程序,甚至可以把上层开发的统统放到 BSP中.而BIOS程序是用户不能更改,编译编程的,只能对参数进行修改设置.更不会包含一些基本的硬件驱动.BSP在嵌进式开发中的位置和作用BSP开发处于整个嵌进式开发的前期,是后面系统上应用程序能够正常运行的保证.大概步骤如下:1.硬件主板研制,测试.2.操纵系统的选定,BSP编程.3.上层应用程序的开发.BSP部分在硬件和操纵系统,上层应用程序之间.所以这就要求BSP程序员对硬件,软件和操纵系统都要有一定的了解.这样才能做好BSP编程.熟悉工具方面:电表,示波器,逻辑分析仪.硬件仿真器,仿真调试环境。

BSP理解文档

BSP理解文档

BSP是Board Support Package的缩写。

该术语通常用于嵌入式领域,主要指在开发嵌人式应用时系统开发商提供的各种粗动支持库。

在嵌人式领域人们对BSP有各种不同的理解:(1) 操作系统的驱动程序。

嵌人式系统提供商的权威— WindRiver 公司对BSP的理解偏向于是OS的驱动程序(从其BSP的文档中可以看出),因为嵌人式系统中的各种设备的确名目挤多,因此将BSP 定位于OS的驱动的确有一定的道理.(2) 驱动程序。

对于认为BSP就是驱动程序的人来讲,他们通常接触的是嵌人式系统提供商提供的某种应用解决方案的应用系统(total solution)。

在这种开发系统中,BSP完全有理由被认为是所有驱动程序,因为开发人员没有必要自己去开发驱动程序,而只是验证驱动程序在自己的系统中是否正确即可.(3) HAL(Hardware Abstract Layer)。

对于开发嵌人式OS的人来讲,倾向于将BSP看成是对硬件平台的抽象层(HAW和处理器)的驱动程序更恰当.实际上各种理解都只是侧重于某个方面。

由于每个嵌人式系统提供商都根据自己的操作系统而提出对BSP的不同理解,因此,在涉及到BSP的具体涵义时,人们往往有一种似是而非的感觉.实际是各种理解都有其道理,但由于出发点不同,对BSP的理解都有失全面甚至有错误的地方,这也是初学者容易混淆的原因。

对于进行硬件和软件开发的人员,第三种理解比较合适,后面的分析也是建立在这个基础之上的。

这里通过BSP(Board Support Package)和BIOS(BasicInput and Output System)的对比,来说明板级支持包的功能。

BSP 说得简单一点,就是一段启动代码,与计算机主板的BIOS差不多.提供的功能却有较大的差别。

我们都知道,在通用8051等系列单片机开发的过程中,要有小段程序设堆栈指针、软复位和中断屏蔽等等可以把这短程序称为它的BSP,实时操作系统的BSP相对复杂一点,但通常也是设t堆栈指针,建立中断向量表,初始化寄存器(控制外围器件如DRAM和EDO RAM条,控制I/O Q的寄存器、片选信号等),配里地址空间以及系统启动方式。

  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

广州致远电子有限公司 VxWorks技术笔记 基于s3c2440a的VxWorks BSP移植 TN01010101 V0.01 Date:2009/04/08

VxWorks BSP移植技术笔记

类别 内容 关键词 VxWorsk BSP s3c2440a 摘 要 VxWorks的BSP开发

Technical Note 广州致远电子有限公司 VxWorks技术笔记

VxWorks技术笔记 ©2009 Guangzhou ZHIYUAN Electronics CO.,

LTD.

i

VxWorks BSP移植技术笔记 修订历史 版本 日期 原因 V0.01 2009/04/08 创建文档 广州致远电子有限公司 VxWorks技术笔记

VxWorks技术笔记 ©2009 Guangzhou ZHIYUAN Electronics CO.,

LTD.

ii

VxWorks BSP移植技术笔记 销售与服务网络(一) 广州周立功单片机发展有限公司 地址:广州市天河北路689号光大银行大厦12楼F4 邮编:510630 电话:(020)38730916 38730917 38730972 38730976 38730977 传真:(020)38730925 网址:www.zlgmcu.com

广州专卖店 地址:广州市天河区新赛格电子城203-204室 电话:(020)87578634 87569917 传真:(020)87578842 南京周立功 地址:南京市珠江路280号珠江大厦2006室 电话:(025)83613221 83613271 83603500 传真:(025)83613271

北京周立功 地址:北京市海淀区知春路113号银网中心A座1207-1208室(中发电子市场斜对面) 电话:(010)62536178 62536179 82628073 传真:(010)82614433 重庆周立功 地址:重庆市石桥铺科园一路二号大西洋国际大厦(赛格电子市场)1611室 电话:(023)68796438 68796439 传真:(023)68796439

杭州周立功 地址:杭州市天目山路217号江南电子大厦502室 电话:(0571) 28139611 28139612 28139613 28139615 28139616 28139618 传真:(0571) 28139621 成都周立功 地址:成都市一环路南二段1号数码同人港401室(磨子桥立交西北角) 电话:(028)85439836 85437446 传真:(028)85437896

深圳周立功 地址:深圳市深南中路 2070号电子科技大厦C座4楼D室 电话:(0755)83781788(5线) 传真:(0755)83793285 武汉周立功 地址:武汉市洪山区广埠屯珞瑜路158号12128室(华中电脑数码市场) 电话:(027)87168497 87168297 87168397 传真:(027)87163755

上海周立功 地址:上海市北京东路668号科技京城东座7E室 电话:(021)53083452 53083453 53083496 传真:(021)53083491 西安办事处 地址:西安市长安北路54号太平洋大厦1201室 电话:(029)87881296 83063000 87881295 传真:(029)87880865 广州致远电子有限公司 VxWorks技术笔记

VxWorks技术笔记 ©2009 Guangzhou ZHIYUAN Electronics CO.,

LTD.

iii

VxWorks BSP移植技术笔记 销售与服务网络(二) 广州致远电子有限公司 地址:广州市天河区车陂路黄洲工业区3栋2楼 邮编:510660 传真:(020)38601859 网址:www.embedtools.com (嵌入式系统事业部) www.embedcontrol.com (工控网络事业部) www.ecardsys.com (楼宇自动化事业部)

技术支持: CAN-bus: 电话:(020)22644381 22644382 22644253 邮箱:can.support@embedcontrol.com iCAN及数据采集: 电话:(020)28872344 22644373 邮箱:ican@embedcontrol.com

MiniARM: 电话:(020)28872684 28267813 邮箱:miniarm.support@embedtools.com 以太网: 电话:(020)22644380 22644385 邮箱:ethernet.support@embedcontrol.com

无线通讯: 电话:(020) 22644386 邮箱:wireless@embedcontrol.com 串行通讯: 电话:(020)28267800 22644385 邮箱:serial@embedcontrol.com

编程器: 电话:(020)22644371 邮箱:programmer@embedtools.com 分析仪器: 电话:(020)22644375 28872624 28872345 邮箱:tools@embedtools.com

ARM嵌入式系统: 电话:(020)28872347 28872377 22644383 22644384 邮箱:arm.support@zlgmcu.com 楼宇自动化: 电话:(020)22644376 22644389 28267806 邮箱:mjs.support@ecardsys.com mifare.support@zlgmcu.com

销售: 电话:(020)22644249 22644399 22644372 22644261 28872524 28872342 28872349 28872569 28872573 38601786

维修: 电话:(020)22644245 广州致远电子有限公司 VxWorks技术笔记

移植技术笔记 ©2009 Guangzhou ZHIYUAN Electronics CO., LTD.

1

VxWorks BSP移植技术笔记 目 录 1. 适用范围 ................................................................................................................... 1 2. BSP分析 ................................................................................................................... 2 2.1 BSP的文件构成 ....................................................................................................... 2 2.2 BSP的执行逻辑 ....................................................................................................... 3 2.2.1 BootROM image ............................................................................................... 3 2.2.2 VxWorks image ................................................................................................. 4 2.2.3 Driver加载的时机 ........................................................................................... 5 3. 移植要点 ................................................................................................................... 6 3.1 异常处理 ................................................................................................................... 6 3.2 中断处理 ................................................................................................................... 9 3.3 时钟 ......................................................................................................................... 11 3.4 串口驱动 ................................................................................................................. 11 3.4.1 概述 ................................................................................................................. 11 3.4.2 ttyDrv(包括tyLib) ..................................................................................... 12 3.4.3 xxDrv驱动的实现 .......................................................................................... 15 3.5 编译链接 ................................................................................................................. 22 4. 参考资料 ................................................................................................................. 23

相关文档
最新文档