开发BSP主要的两点:
两个主要两个协议:
BSP定义:
Provides VxWorks with primary interface to hardware environment.
作用:
主要BSP主要文件目录的组成及主要文件的作用:
BSP用"make"来编译连接生成(Created),而不是用Tornado的工具.
BSP和应用程序都可以在"make"或"tornade"上开发(developed)
BSP被设置包括以下驱动:
前面三个是BSP的主要部分.
BSP默认的download VxWorks RAM image方式是从ethernet.
串口电缆需要用来和开发板(COM1)通信,通过协议WDB.
VxWorks Image的种类:
Loadable images.
ROM-based images---compressed/uncompressed.
ROM-Resident images.
VxWorks boot images---A VxWorks image designed to load another VxWorks images containing application code (often refer to as "boot code")
"Burned" into ROM or loaded into Flash.
Maybe execute in ROM/Flash (ROM-resident).
Maybe execute out of RAM.
VxWorks images---A VxWorks image containing "end-user" code,Sub-types:
Loadable VxWorks image--VxWorks images loaded by VxWorks boot image.
VxWorks ROM image--VxWorks image "burned" into ROM or loaded into Flash.May execute in Flash.
VxWorks images consist of:
Text segment---executable instruction.
Data segment---Initilized global and static varibles.
BSS.
VxWorks Image文件类型的说明
Uploaded images(通过网口或串口下载到RAM):
vxWorks - basic Tornado, shell 和 symbol table 在主机端
vxWorks.st(文件很大)- 独立的 image,包含shell和 symbol table在目标板运行
ROM based images(直接烧入ROM的VxWorks):
vxWorks_rom - Tornado in ROM,非压缩, 在 RAM 中运行
vxWorks.res_rom_nosym - Tornado in ROM, 非压缩,在 ROM 中运行
vxWorks.st_rom - Stand-alone in ROM, 压缩, RAM 中运行
vxWorks.res_rom - Stand-alone in ROM, 非压缩, ROM 中运行
非BSP make文件中包括:
include $(TGT_DIR)/h/make/rules.library
include $(TGT_DIR)/h/make/defs.default(define default value for makefile)
...............
BSP make文件中包括: include $(TGT_DIR)/h/make/rules.bsp ...
ARM7 做VxWorks imgage 时,在makefile 文件中用 MACH_EXTRA 代替 LIB_EXTRA, 这样生成的VxWorks时不压缩的在ROM中运行的程序(uncompressed ROM-based VxWorks image),否则就是压缩的在RAM中运行的程序(compressed RAM-based VxWorks image).
The sequence of events which occur as power-up are a function of type VxWorks image with will run.
处理器"跳"到再ROM或Flash中Boot-strap 程序的起点. 这个程序主要有以下作用:
Bootstrap code executes and loads text and data segments of boot code(from ROM or Flash) into RAM.具体执行如下:
Startup Sequence--VxWorks 初始化
做以下工作:
VxWorks image
分为在ROM中运行和在RAM中运行两种.两者启动顺序的区别在于sysInit()函数的调用.该函数在RAM运行的VxWorks中初始化RAM.
ROM中运行的VxWorks
VxWorks在ROM中运行,即写入ROM中的VxWorks是非压缩的,不需要解压,系统直接跳到ROM的首地址,运行VxWorks.注意:ROM运行的VxWorks并不支持所有的主扳,应以主扳手册为准.
文件romInit.s中的romInit()--文件bootInit.c中的romStart()--文件usrConfig.c中的usrInit()---sysHwInit()---usrKernelInit()---KernelInit(usrRoot,...)
VxWorks在ROM中运行主要是为了节省RAM空间,以便应用程序有更大的空间运行.只把VxWorks image的data段复制到RAM的LOCAL_LOW_ADRS, text部分留在ROM并在ROM中执行.
ROM中运行的VxWorks缺点是运行速度慢.
RAM中运行的VxWorks
VxWorks在RAM中运行,即写入ROM中的Boot或VxWorks Image是压缩的,需要先解压copy所有的text和data到RAM的LOCAL_LOW_ADRS中,下面sysInit()主要是初始化RAM用的,系统直接跳到RAM的首地址,运行VxWorks
usrInit()前面不压缩,即romInit(),romStart()不能压缩.
文件romInit.s中的romInit()--文件bootInit.c中的romStart()--sysaLib.s中的sysInit()--文件usrConfig.c中的usrInit()---sysHwInit()---usrKernelInit()---KernelInit(usrRoot,...)
RAM运行的Boot或VxWorks image的text段或data段会从ROM复制到RAM,在RAM中运行.
其中usrRoot()是VxWorks启动的第一个任务,由它来初始化 driver,network等
描述: romInit.s first execute in flash,minal initiliz,then jump to romStart.
romStart() 开始装载和解压image到RAM,sysaLib.s是在RAM中执行的第一个函数.
BootROM image
BootROM image
最少的系统初始化,主要用于启动装载VxWorks image.一般有压缩和不压缩两种形式,如bootrom和boot_uncmp.与VxWorks image的区别在于一个Bootrom调用bootConfig.c,而VxWorks调用usrConfig.c.
文件romInit.s中的romInit()--文件bootInit.c中的romStart()--文件bootConfig.c中的usrInit()---sysHwInit()---usrKernelInit()---KernelInit(usrRoot,...)
其中 /target/config/all/bootConfig.c是Boot ROM设置模块.用于通过网络加载VxWorks image.
usrRoot()--bootCmdLoop(void)命令行选择,或autobooting---bootLoad(pLine, &entry)加载模块到内存(网络,TFFS,TSFS...)---netifAttach()--go(entry)---(entry)()从入口开始执行,不返回.
各个函数的主要作用
romInit()-----power up,disable interrupt,put boot type on the stack,clears caches.
romStart()-----load Image Segments into RAM.
usrInit()-----Interrupt lock out,save imformation about boot type,handle all the Initialization before the kernel is actually started,then starts the kernel execution to create an initial task usrRoot().This task completes the start up.
sysHwInit()-----Interrup locked,Initializes hardware,registers,activation kernel
KernelInit(usrRoot,...)-----
Initializes and starts the kernel.
Defines system memory partition.
Activates a task tUsrRoot to complete initalization.
Unlocks inierrupts.
Uses usrInit()stack.
usrRoot()
初始化内存分区表(memory partition library)
初始化系统系统时钟(system clock)
初始化输入输出系统(I/O system)----可选
Create devices----可选
设置网络(Configure network)--------可选
激活WDB目标通信(Activate WDB agent)---------可选
调用程序(Activate application)
VxWorks 在ROM中的情况:
ROM 低地址位为没有压缩的romInit.s和romStart()在ROM的起始位置,系统power up后,从这个起始位开始执行,即执行romInit(),起始位置由硬件定义,一般为0x00000000
ROM 高地址位为压缩的VxWorks Imgage
其中 RAM_LOW_ADRS, RAM_HIGH_ADRS 等一些地址在makefile 和BSP config.h中定义