龙芯CPU开发系统vxWorks BSP规范_1.02
- 格式:pdf
- 大小:1.93 MB
- 文档页数:61
Amine思创黄金开发板S3C44B0X VxWorks BSP 移植笔记版本 1.0修改历史目录1.介绍51.1目的51.2范围51.3定义和缩写51.4参考51.5声明52.开发环境描述52.1思创黄金开发板S3C44B0X 62.2Tornado 2.2 62.3ARM SDT v2.51 62.4Flash Programmer 63.设计目标74.关键主题74.1异常处理74.1.1问题分析74.1.2解决方法1(eking) 94.1.3解决方法2(d3000) 104.1.4解决方法3 114.1.5其他124.2CPU寄存器124.3仿真和写Flash程序的差别124.4时钟134.5串口驱动134.5.1修改134.5.2FIFO 144.5.3连接Console和target server 144.6缓存[Cache] 154.6.1修改154.6.2测试174.7网络驱动184.7.1修改184.7.2寄存器测试194.7.3网络初始化分离194.8TFFS驱动204.8.1Socket 204.8.2MTD 204.8.3格式化204.8.4加载214.9目标机FTP服务启动214.10boot Shell命令扩展224.11简单VxWorks应用235.详细开发过程245.1建立开发环境245.2选择近似BSP模板245.3让最简bootRom运行起来255.4丰富bootRom功能296.操作说明296.1bootRom启动296.2加载VxWorks 306.2.1TFFS自动加载316.2.2TFFS手动加载316.2.3网络自动加载316.2.4网络手动加载326.3VxWorks 启动337.TIPs 358.TODOs 359.?s 3510.附件3510.1代码目录3610.2映象目录3610.3其他36S3C44B0X VxWorks BSP 移植笔记1. 介绍1.1 目的主要从几个关键主题描述S3C44B0X VxWorks BSP定制工作,对整个过程作了详细描述。
VxWorks 系统的BSP 概念及启动过程乔从连(船舶重工集团公司723所,扬州225001)摘要:VxWorks 作为一个高性能的嵌入式实时操作系统,已经得到了广泛的应用。
介绍了实时操作系统VxWorks 的BSP 的概念及组成,详细分析了VxWorks 系统的初始化流程和启动过程。
关键词:板级支持包;初始化;启动过程中图分类号:TP316.89 文献标识码:B 文章编号:CN3221413(2005)0120061204Concept and Starting Procedure of VxWorks System BSPQ IAO Cong 2lian(The 723Institute of CSIC ,Yangzhou 225001,China )Abstract :As a high 2performance embedded real 2time operating system ,VxWorks has been already applied widely.This paper introduces t he concept and component of VxWorks BSP ,analyses t he initialization flow and starting p rocedure of VxWorks system in detail.K eyw ords :board support package ;initialization ;starting p rocedure0 引 言板级支持包(board support package ,BSP )是介于硬件和操作系统之间的一层,应该说是属于操作系统的一部分,主要目的是为了支持操作系统,使之能够更好地运行于硬件。
在使用嵌入式系统VxWorks 时,有时需要根据硬件平台移植BSP 或者对某一配件的驱动进行开发修改。
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。
vxworksbsp:. 基于VxWorks的BSP概念与开发疯狂代码 / ĵ:http://NetworkProgramming/Article33345.html基于VxWorksBSP概念与开发2002年3月B版摘 要:本文以VxWorks操作系统为例阐述了BSP概念和系统启动流程并描述了BSP开发过程关键词:BSP;VxWorks;镜像;boot Rom概述VxWorks操作系统是美国WindRiver公司于1983年设计开发种嵌入式实时操作系统(RTOS)它采用微内核结构具有支持多种处理器丰富网络协议良好兼容性和裁减性等特点同时具有动态链接和下载功能图1 BSP在VxWorks系统中地位图2 压缩可引导镜像启动过程BSP(Board Support Packet——板级支持包)是介于底层硬件和上层软件之间底层软件开发包它主要功能为屏蔽硬件提供操作系统驱动及硬件驱动具体功能包括:·单板硬件化主要是CPU化为整个软件系统提供底层硬件支持;·为操作系统提供设备驱动和系统中断服务;·定制操作系统功能为软件系统提供个实时多任务运行环境;·化操作系统为操作系统正常运行做好准备;BSP在VxWorks系统中地位见图1BSP文件在vxworks/target/config/all和vxworks/target/config/bspname文件夹里其中all文件夹里文件是所有BSP通用文件bspname文件夹文件是用户自己定制BSP文件经过编译、链接并在makefile和depend. bspname等文件控制下原最后将生成镜像VxWorks镜像可分为两类:可下载镜像和可引导镜像·可下载镜像(Loadable Image):实际包括两部分是vxWorks二是boot ROM两部分是独立创建其中boot ROM包括被压缩boot ROM镜像(bootrom)、非压缩boot ROM镜像(bootrom_uncmp)和驻留ROMboot ROM镜像(bootrom_res)三种类型;·可引导镜像(Bootable Image):是将引导和vxWorks融为体镜像它常常是最终产品包括不驻留ROM镜像和驻留ROM镜像两种类型VxWorks系统启动流程般来说所有处理器VxWorks系统启动流程都是相似但有些处理器会有些特殊步骤而另些处理器会跳过几个步骤 下面以CPU为ARM7TDMI为例具体描述(见表1)对于可引导镜像在usrConfig.c文件里执行对于可下载镜像在bootConfig.c文件里执行图2为压缩可引导镜像启动过程图示其中所用到地址说明见表2BSP开发过程建立开发环境主要是以目标板CPUBSP文件为模板在 ornado argetconfig目录下创建用户BSP目录bspname把 ornado argetconfigall下文件和BSP模板文件拷贝到该目录下根据具体情况选择合适VxWorks镜像类型修改模板MakefileMakefile文件控制镜像创建在Makefile文件里使用了将近135个宏最简单Makefile文件要包含以下宏: ·CPU:目标板CPU类型;·TOOL:主机make工具为GNU;·TGT_DIR:target路径默认为$(WIND_BASE)/target;·TARGET_DIR:BSP目录名;·VENDER:目标板生产商名;·BOARD:目标板名;·ROM_TEXT_ADRS:boot ROM入口地址(以16进制表示并且与config.h文件定义相同);·ROM_SIZE:ROM大小;·RAM_LOW_ADRS:加载vxWorks目标地址;·RAM_HIGH_ADRS:boot ROM拷贝到RAM目标地址;·HEX_FLAGS:特殊结构标记用于产生S-记录文件;·MACH_EXTRA:扩展文件用户可以加入自己目标模块;·除此以外Makefile文件还需要包括以下文件:·$(TGT_DIR)/h/make/defs.bsp:Vxworks系统运行标准变量定义;·$(TGT_DIR)/h/make/make.$(CPU)$(TOOL):提供了特别目标机结构和套编译工具如make.ARM7TDMI_Tgnu;·$(TGT_DIR)/h/make/defs.$(WIND_HOST_TYPE):提供了与主机系统有关定义;·rules.bsp:在创建目标文件时所需要规则;·rules. $(WIND_HOST_TYPE):指出创建目标文件时所需从属文件表;·如果没有用all目录下文件而是拷贝到bspname下修改并使用需要定义与这些文件有关宏如BOOTINIT=bootInit.c这样在创建镜像时就不会用all目录下文件而使用bspname目录下相应文件了;·在Makefile文件里凡是16进制数前面都无需加“0x”;bspname.h根据具体目标板设置串行接口、时钟以及I/O设备等在该文件中必须包含以下内容:·中断向量/级别·I/O设备地址·设备寄存器位含义·系统和附加时钟参数(最大和最小速率)config.h根据目标板具体情况配置宏定义注意ROM_TEXT_ADRS、ROM_SIZE、RAM_LOW_ADRS、RAM_HIGH_ADRS要与Makefile文件里定义致LOCAL_MEM_LOCAL_ADRS和LOCAL_MEM_SIZE要正确 romInit.s这是系统上电后运行第个根据具体目标板对寄存器和CPU进行设置;以CPU为ARM7TDMI为例romInit.s 需要进行工作有:·保存启动方式:对于冷启动如果CPU配置是HIGH VECTORS就设置入口地址为0xFFFF0000否则设置入口地址为0x00000000;·屏蔽中断:通过设置cpsrI_BIT和F_BIT都为1来实现还要设置中断寄存器为关模式同时设定运行模式为SVC32模式;·化堆栈指针pc和sp:堆栈指针sp指向STACK_ADRS这个宏定义为当镜像为驻留ROM时该宏值为_sdata当镜像为非驻留ROM时该宏值为_romInit这两个地址经过地址映射后都指向被拷贝镜像在RAM目标地址;·化cache屏蔽cache;·根据具体目标板需要化其他寄存器;·指针跳转到romStart并执行;bootConfig.c般不需要用户修改也可以根据具体情况做适当修改;sysALib.s与romInit.s文件实现功能相似但如果在romInit.s文件里对DRAM和内存控制器进行了化在这里不再进行这项工作;创建VxWorks镜像根据具体需要在命令行环境下利用Makefile创建各种镜像也可以在Tornado集成环境下Build菜单中选择Build Boot ROM来创建各种类型Boot ROM;除此以外如果系统硬件包括串口还要根据具体情况修改sysSerial.c文件;如果包含网络部分要修改configNet.h;如果包含NVRAM要修改bootnv.h文件总之BSP开发要根据具体目标板硬件进行结语我们已经利用基于VxWorksBSP开发包成功进行了线缆调制解调器底层软件开发在开发过程中深感BSP在整个系统软件中重要性——没有正确BSP软件整个系统启动和运行也不会正确另外需要强调是:BSP概念只是针对嵌入式操作系统而言而像DOS、WINDOWS、UNIX等BIOS操作系统是无BSP可言对同目标板而言不同操作系统BSP在本质上是样但是不同操作系统将提供不同支持库另外在BSP结构上也可能会有所不同在做BSP移植时候应该注意■参考文献1. Tornado BSP Developer誷 Kit for VxWorks User誷 GuideTornado2.0Edition 119992. Tornado BSP Developer誷 Kit for VxWorks User誷 GuideTornado 1.0.1Edition 119973. VxWorks Programmer誷 GuidesEdition 11999基于VxWorksBSP概念与开发2002年3月B版摘 要:本文以VxWorks操作系统为例阐述了BSP概念和系统启动流程并描述了BSP开发过程关键词:BSP;VxWorks;镜像;boot Rom概述VxWorks操作系统是美国WindRiver公司于1983年设计开发种嵌入式实时操作系统(RTOS)它采用微内核结构具有支持多种处理器丰富网络协议良好兼容性和裁减性等特点同时具有动态链接和下载功能图1 BSP在VxWorks系统中地位图2 压缩可引导镜像启动过程BSP(Board Support Packet——板级支持包)是介于底层硬件和上层软件之间底层软件开发包它主要功能为屏蔽硬件提供操作系统驱动及硬件驱动具体功能包括:·单板硬件化主要是CPU化为整个软件系统提供底层硬件支持;·为操作系统提供设备驱动和系统中断服务;·定制操作系统功能为软件系统提供个实时多任务运行环境;·化操作系统为操作系统正常运行做好准备;BSP在VxWorks系统中地位见图1BSP文件在vxworks/target/config/all和vxworks/target/config/bspname文件夹里其中all文件夹里文件是所有BSP通用文件bspname文件夹文件是用户自己定制BSP文件经过编译、链接并在makefile和depend. bspname等文件控制下原最后将生成镜像VxWorks镜像可分为两类:可下载镜像和可引导镜像·可下载镜像(Loadable Image):实际包括两部分是vxWorks二是boot ROM两部分是独立创建其中boot ROM包括被压缩boot ROM镜像(bootrom)、非压缩boot ROM镜像(bootrom_uncmp)和驻留ROMboot ROM镜像(bootrom_res)三种类型;·可引导镜像(Bootable Image):是将引导和vxWorks融为体镜像它常常是最终产品包括不驻留ROM镜像和驻留ROM镜像两种类型VxWorks系统启动流程般来说所有处理器VxWorks系统启动流程都是相似但有些处理器会有些特殊步骤而另些处理器会跳过几个步骤 下面以CPU为ARM7TDMI为例具体描述(见表1)对于可引导镜像在usrConfig.c文件里执行对于可下载镜像在bootConfig.c文件里执行图2为压缩可引导镜像启动过程图示其中所用到地址说明见表2BSP开发过程建立开发环境主要是以目标板CPUBSP文件为模板在 ornado argetconfig目录下创建用户BSP目录bspname把 ornado argetconfigall下文件和BSP模板文件拷贝到该目录下根据具体情况选择合适VxWorks镜像类型修改模板MakefileMakefile文件控制镜像创建在Makefile文件里使用了将近135个宏最简单Makefile文件要包含以下宏: ·CPU:目标板CPU类型;·TOOL:主机make工具为GNU;·TGT_DIR:target路径默认为$(WIND_BASE)/target;·TARGET_DIR:BSP目录名;·VENDER:目标板生产商名;·BOARD:目标板名;·ROM_TEXT_ADRS:boot ROM入口地址(以16进制表示并且与config.h文件定义相同);·ROM_SIZE:ROM大小;·RAM_LOW_ADRS:加载vxWorks目标地址;·RAM_HIGH_ADRS:boot ROM拷贝到RAM目标地址;·HEX_FLAGS:特殊结构标记用于产生S-记录文件;·MACH_EXTRA:扩展文件用户可以加入自己目标模块;·除此以外Makefile文件还需要包括以下文件:·$(TGT_DIR)/h/make/defs.bsp:Vxworks系统运行标准变量定义;·$(TGT_DIR)/h/make/make.$(CPU)$(TOOL):提供了特别目标机结构和套编译工具如make.ARM7TDMI_Tgnu;·$(TGT_DIR)/h/make/defs.$(WIND_HOST_TYPE):提供了与主机系统有关定义;·rules.bsp:在创建目标文件时所需要规则;·rules. $(WIND_HOST_TYPE):指出创建目标文件时所需从属文件表;·如果没有用all目录下文件而是拷贝到bspname下修改并使用需要定义与这些文件有关宏如BOOTINIT=bootInit.c这样在创建镜像时就不会用all目录下文件而使用bspname目录下相应文件了;·在Makefile文件里凡是16进制数前面都无需加“0x”;bspname.h根据具体目标板设置串行接口、时钟以及I/O设备等在该文件中必须包含以下内容:·中断向量/级别·I/O设备地址·设备寄存器位含义·系统和附加时钟参数(最大和最小速率)config.h根据目标板具体情况配置宏定义注意ROM_TEXT_ADRS、ROM_SIZE、RAM_LOW_ADRS、RAM_HIGH_ADRS要与Makefile文件里定义致LOCAL_MEM_LOCAL_ADRS和LOCAL_MEM_SIZE要正确 romInit.s这是系统上电后运行第个根据具体目标板对寄存器和CPU进行设置;以CPU为ARM7TDMI为例romInit.s 需要进行工作有:·保存启动方式:对于冷启动如果CPU配置是HIGH VECTORS就设置入口地址为0xFFFF0000否则设置入口地址为0x00000000;·屏蔽中断:通过设置cpsrI_BIT和F_BIT都为1来实现还要设置中断寄存器为关模式同时设定运行模式为SVC32模式;·化堆栈指针pc和sp:堆栈指针sp指向STACK_ADRS这个宏定义为当镜像为驻留ROM时该宏值为_sdata当镜像为非驻留ROM时该宏值为_romInit这两个地址经过地址映射后都指向被拷贝镜像在RAM目标地址;·化cache屏蔽cache;·根据具体目标板需要化其他寄存器;·指针跳转到romStart并执行;bootConfig.c般不需要用户修改也可以根据具体情况做适当修改;sysALib.s与romInit.s文件实现功能相似但如果在romInit.s文件里对DRAM和内存控制器进行了化在这里不再进行这项工作;创建VxWorks镜像根据具体需要在命令行环境下利用Makefile创建各种镜像也可以在Tornado集成环境下Build菜单中选择Build Boot ROM来创建各种类型Boot ROM;除此以外如果系统硬件包括串口还要根据具体情况修改sysSerial.c文件;如果包含网络部分要修改configNet.h;如果包含NVRAM要修改bootnv.h文件总之BSP开发要根据具体目标板硬件进行结语我们已经利用基于VxWorksBSP开发包成功进行了线缆调制解调器底层软件开发在开发过程中深感BSP在整个系统软件中重要性——没有正确BSP软件整个系统启动和运行也不会正确另外需要强调是:BSP概念只是针对嵌入式操作系统而言而像DOS、WINDOWS、UNIX等BIOS操作系统是无BSP可言对同目标板而言不同操作系统BSP在本质上是样但是不同操作系统将提供不同支持库另外在BSP结构上也可能会有所不同在做BSP移植时候应该注意■参考文献1. Tornado BSP Developer誷 Kit for VxWorks User誷 GuideTornado2.0Edition 119992. Tornado BSP Developer誷 Kit for VxWorks User誷 GuideTornado 1.0.1Edition 119973. VxWorks Programmer誷 GuidesEdition 119992008-12-12 15:53:11疯狂代码 /。
智龙开发板手册——基于龙芯1C的嵌入式开发板版本历史版本日期备注V1.02015-05-30基于智龙V1.0,创建手册V2.02015-10-21结合智龙开发者的经验和龙芯官方1C300B开发板手册编写目录1硬件篇 (7)1.1龙芯1C芯片介绍 (8)1.2智龙开发板介绍 (9)1.3智龙开发板硬件接口 (13)SDRAM控制器 (15)SRAM/NOR FLASH控制器 (15)NAND控制器 (15)时钟发生器 (18)I2S控制器 (19)AC97控制器 (19)LCD控制器 (19)Camera接口 (19)MAC控制器 (19)USB2.0控制器 (20)SPI控制器 (20)I2C控制器 (20)UART控制器 (20)GPIO (21)PWM控制器 (21)RTC (21)CAN控制器 (22)SDIO控制器 (22)ADC控制器 (22)1.4串口调试连接 (22)1.5eJtag调试系统 (27)1.6Flash烧写PMON引导系统 (28)1.7Flash烧写linux系统(附带跑马灯实验) (32)2软件篇 (42)2.2Linux内核裁剪和配置 (44)2.2.1安装图形化配置工具Ncurses (44)2.2.2运行图形化配置界面 (45)2.2.3编译Linux内核 (46)2.2.4开发板各模块驱动源码 (46)2.3配置内核各模块驱动 (48)2.3.1配置网卡驱动 (48)2.3.2配置NFS支持 (51)2.3.3配置UBIFS支持 (54)2.3.4配置串口驱动 (57)2.3.5配置LCD驱动 (59)2.3.6配置按键驱动 (61)2.3.7配置SD卡驱动 (63)2.3.8配置U盘驱动 (65)2.3.9配置USB鼠标和键盘驱动 (68)2.3.10配置USB OTG驱动 (72)2.3.11配置音频驱动 (74)2.3.12配置RTC驱动 (76)2.3.13配置PWM驱动 (78)2.3.14配置红外驱动 (81)2.3.15配置CAN总线驱动 (82)2.3.16配置SPI控制器驱动 (85)2.3.17配置I2C控制器驱动 (87)2.3.18配置ADC驱动 (89)2.3.19配置GPIO驱动 (90)2.3.20配置看门狗驱动 (92)2.3.21配置中星微zc301USB摄像头驱动 (93)2.4Linux、PMON、Rootfs镜像制作 (96)2.5Linux系统的交叉编译环境的搭建 (99)2.5.2新建Ubuntu虚拟机 (101)2.5.3安装Ubuntu系统 (109)2.5.4备份恢复Ubuntu虚拟机 (119)2.6使用Ubuntu12.04 (122)2.6.1Ubuntu终端 (122)2.6.2设置Ubuntu虚拟机网络 (124)2.6.3安装VMware Tools (129)2.6.4更新Ubuntu软件包列表 (131)2.6.5设置Windows和Ubuntu的共享文件夹 (131)2.6.6安装配置minicom串口工具 (133)2.6.7安装配置TFTP服务器 (142)2.6.8安装配置NFS服务器 (146)2.6.9建立交叉编译环境 (149)2.7PMON的配置和编译 (150)2.7.1安装依赖库和编译工具 (150)1连网在线安装 (150)2使用源码包安装 (150)2.7.2配置PMON (152)1配置系统启动方式 (152)2配置串口 (152)2.7.3编译PMON (153)2.8基于linux的根文件系统 (153)2.8.1创建文件系统目录 (153)2.8.2创建系统配置文件 (153)2.8.3拷贝库文件 (156)2.9制作根文件系统镜像 (157)2.9.1安装镜像文件制作工具 (157)2.9.2制作根文件系统镜像文件 (160)2.10基于linux的网络配置 (161)2.11基于linux的交叉编译Helloworld (164)2.12基于linux的Python移植 (170)2.13基于linux的PWM控制LED (171)2.14RT-Thread实时系统移植 (177)2.14基于RTT编写PWM驱动 (177)2.15基于RTT的LED和按键的控制 (177)3应用篇 (177)3.1龙芯wifi小车 (177)3.2英国智龙摩尔电码播放器 (178)3.3俄罗斯方块 (195)3.4智龙连接物联网平台智城云 (200)3.5智龙连接微信公众号 (200)3.63D打印机主板 (200)附录 (200)龙芯1C引脚复用表 (200)Linux常用命令 (200)PMON命令 (200)1硬件篇主要介绍龙芯1C芯片以及智龙开发板相关硬件设计图龙芯1C300A图智龙V2.0开发板1.1龙芯1C芯片介绍龙芯1C300(以下简称1C)芯片是基于LS232处理器核的高性价比单芯片系统,可应用于指纹生物识别、物联传感等领域。
基于Vxworks操作系统的BSP开发
周雪赞;张宏
【期刊名称】《工业控制计算机》
【年(卷),期】2004(17)2
【摘要】本文基于Vxworks操作系统讲述了板级支持包BSP的概念并分析了Vxworks的启动过程,重点介绍了BSP的设计与开发过程.
【总页数】2页(P33-34)
【作者】周雪赞;张宏
【作者单位】浙江大学生仪学院生物医学工程系,310027;浙江大学生仪学院生物医学工程系,310027
【正文语种】中文
【中图分类】TP3
【相关文献】
1.基于S698PM的VxWorks操作系统串口模块应用与开发 [J], 肖文斌
2.基于S698P4的VxWorks操作系统定时器模块应用与开发 [J], 肖文斌
3.基于S698的VxWorks操作系统CAN应用与开发 [J], 骆杰华
4.基于S698 PM处理器的VxWorks操作系统1553B总线模块应用与开发 [J], 沈祖崮;龚永红;许怡冰
5.基于VxWorks操作系统的PCI设备驱动程序开发 [J], 常明志
因版权原因,仅展示原文概要,查看原文内容请购买。