小男孩‘自慰网亚洲一区二区,亚洲一级在线播放毛片,亚洲中文字幕av每天更新,黄aⅴ永久免费无码,91成人午夜在线精品,色网站免费在线观看,亚洲欧洲wwwww在线观看

分享

VxWorks BSP和啟動(dòng)過程

 天蝎淚 2005-10-26

>>Drew的主頁(yè)--->VxWorks--------->BSP和啟動(dòng)過程

 

VxWork BSP 和啟動(dòng)過程

 

開發(fā)BSP主要的兩點(diǎn):

  1. 系統(tǒng)image的生成,image的種類,image的download下載過程,系統(tǒng)的啟動(dòng)順序和過程,調(diào)試環(huán)境的配置及遠(yuǎn)端調(diào)試的方式和方法,相應(yīng)BSP設(shè)置文件的修改(網(wǎng)絡(luò),串口..),BSP各文件的組成和作用.

  1. 要對(duì)系統(tǒng)底層驅(qū)動(dòng)清楚,也就是對(duì)CPU及相關(guān)的硬件有所了解.主要是32微處理器(上電啟動(dòng)過程, download image的方式方法,讀寫ROM,地址空間分配,MMU,寄存器,中斷定義,..).參照硬件資料,多讀一些源碼會(huì)有所幫助.

Tornado 2 開發(fā)調(diào)試環(huán)境協(xié)議框圖

主機(jī)開發(fā)(Host Development System)

目標(biāo)機(jī)(Target System)

Tornado 工具

 

WTX協(xié)議通信<==========>

Editor
Project
Shell
Debugger
Browser
Windview

Target Server

|

Target Agent
VxWorks Target Simulator

WDB協(xié)議通信
<==========>

Application
VxWorks OS
VxWorks Target (WDB)Agent

兩個(gè)主要兩個(gè)協(xié)議

WTX協(xié)議(Wind River Tool eXchange): 用于開發(fā)機(jī)內(nèi)部Tornado工具與Target Server之間通信.

WDB協(xié)議(Wind DeBug): 用于主機(jī)Target Server與目標(biāo)機(jī)之間的通信.

 

一.基本概念

BSP定義:

Provides VxWorks with primary interface to hardware environment.

作用: 

  • 在通電后,初始化硬件.

  • 支持VxWorks和硬件驅(qū)動(dòng)通信.

  • 使hardware-dependent 和 hardware-independent在VxWorks系統(tǒng)中很好的結(jié)合.

主要BSP主要文件目錄的組成及主要文件的作用:

  • 目錄target/config/All:

這個(gè)目錄下的文件是所有BSP文件共享的,不是特別需要不要更改里面的任何文件.

configAll.h:

缺省定義了所有VxWorks的設(shè)置.如果不用缺省的設(shè)置,可在BSP目錄下的config.h文件中用#define或#undef方式來更改設(shè)置.

bootInit.c:

在romInit.s后,完成Boot ROM的第二步初始化.程序從romInit.s中的romInit()跳到這個(gè)文件中的romStart().來執(zhí)行必要的解壓和ROM image的放置.

bootConfig.c: 完成Boot ROM image的初始化和控制.

usrConfig.c: VxWorks image的初始化代碼.

  • 目錄target/config/comps/src:

涉及系統(tǒng)核心的components,主要由target/config/All中usrConfig.c中函數(shù)調(diào)用

  • 目錄target/config/bspname:

包含系統(tǒng)或硬件相關(guān)的BSP文件.

Makefile

一些命令行控制images的生成,參見 BSP設(shè)置部分及生成下載

README

BSP發(fā)布紀(jì)錄,版本,總的文檔

config.h

包括所有涉及CPU主板的設(shè)置及定義(includes,definations),參見 BSP設(shè)置文件及生成下載

configNet.h

網(wǎng)絡(luò)驅(qū)動(dòng)的主要設(shè)置文件,主要對(duì)END驅(qū)動(dòng)設(shè)置.

romInit.s

匯編語(yǔ)言文件,是VxWorks Boot ROM和ROM based image的入口,參見 系統(tǒng)啟動(dòng)部分

sysALib.s

匯編語(yǔ)言文件,程序員可以把自己的匯編函數(shù)放在這個(gè)文件里,在上層調(diào)用.VxWorks image的入口點(diǎn)_sysInit在這個(gè)文件里,是在RAM中執(zhí)行的第一個(gè)函數(shù).

sysLib.c

包含一些系統(tǒng)相關(guān)的函數(shù)例程,提供了一個(gè)board-level的接口,VxWorks和應(yīng)用程序可以以system-indepent的方式生成.這個(gè)文件還能包含目錄target/config/comps/src的驅(qū)動(dòng).

sysScsi.c

可選文件用于Scsi設(shè)備設(shè)置和初始化.

sysSerial.c

可選文件用于所有的串口設(shè)置和初始化.

bootrom.hex

ASIC文件包含VxWorks Boot ROM代碼

VxWorks

運(yùn)行在目標(biāo)機(jī)上,完整的,連結(jié)后的VxWorks二進(jìn)制文件.

VxWorks.sym

完全的,連結(jié)后帶有符號(hào)表的VxWorks二進(jìn)制文件

VxWorks.st

完全的,連結(jié)后,standalone,帶有符號(hào)表的VxWorks二進(jìn)制文件

 

  • BSP用"make"來編譯連接生成(Created),而不是用Tornado的工具.

  • BSP和應(yīng)用程序都可以在"make"或"tornade"上開發(fā)(developed)

  • BSP被設(shè)置包括以下驅(qū)動(dòng):

中斷控制interrupt controller,計(jì)時(shí)器timer(sys/aux),串口UART(serial),顯示屏LCD,鍵盤Keyboard(opt),觸摸屏touch-screen(opt).

前面三個(gè)是BSP的主要部分.

  • BSP默認(rèn)的download VxWorks RAM image方式是從ethernet.

  • 串口電纜需要用來和開發(fā)板(COM1)通信,通過協(xié)議WDB.

    VxWorks Image的種類:

  • Loadable images.

  • ROM-based images---compressed/uncompressed.

  • ROM-Resident images.

ROM-resident image 對(duì)一些系統(tǒng)內(nèi)存RAM資源較少的情況下,為了節(jié)省資源,只拷貝image中的數(shù)據(jù)部分(data segment)到內(nèi)存RAM,留下程序部分(text segment)在ROM中執(zhí)行。這樣空出更多的RAM空間給應(yīng)用程序。
并不是所用得板子都支持這種VxWorks image.

  • 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.

Loadable VxWorks image是通過VxWorks boot image裝載的VxWorks images. 

  • 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(通過網(wǎng)口或串口下載到RAM):

vxWorks - basic Tornado, shell 和 symbol table 在主機(jī)端 
vxWorks.st(文件很大)- 獨(dú)立的 image,包含shell和 symbol table在目標(biāo)板運(yùn)行

ROM based images(直接燒入ROM的VxWorks):

vxWorks_rom - Tornado in ROM,非壓縮, 在 RAM 中運(yùn)行
vxWorks.res_rom_nosym - Tornado in ROM, 非壓縮,在 ROM 中運(yùn)行
vxWorks.st_rom - Stand-alone in ROM, 壓縮, RAM 中運(yùn)行
vxWorks.res_rom - Stand-alone in ROM, 非壓縮, ROM 中運(yùn)行

 

非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 時(shí),在makefile 文件中用 MACH_EXTRA 代替 LIB_EXTRA, 這樣生成的VxWorks時(shí)不壓縮的在ROM中運(yùn)行的程序(uncompressed ROM-based VxWorks image),否則就是壓縮的在RAM中運(yùn)行的程序(compressed RAM-based VxWorks image).

 

啟動(dòng)順序的一些概念

  • The sequence of events which occur as power-up are a function of type VxWorks image with will run.

  • 處理器"跳"到再ROM或Flash中Boot-strap 程序的起點(diǎn). 這個(gè)程序主要有以下作用:

  • 關(guān)閉中斷(來自處理器)

  • 初始化目標(biāo)內(nèi)存(target memory)

  • 裝載要運(yùn)行的VxWorks image segments

  • Jumps to code to place target in quiet state

  • 啟動(dòng)順序 Boot Sequence--Loadable VxWorks image

  • Bootstrap code executes and loads text and data segments of boot code(from ROM or Flash) into RAM.具體執(zhí)行如下:

  • Boot code compressed-Decompression during copy

  • Boot code uncompressed-copy

  • 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.

  • Startup Sequence--VxWorks 初始化

做以下工作:

  • Place hardware environment in a quiet state.

  • Initalize and start the wind kernel

  • Spawn a tast to complete system initialization

  • System initialization task will initialize support for end-user specified facilities,and start the end-user‘s application

 

二.系統(tǒng)啟動(dòng)順序

  • VxWorks image

分為在ROM中運(yùn)行和在RAM中運(yùn)行兩種.兩者啟動(dòng)順序的區(qū)別在于sysInit()函數(shù)的調(diào)用.該函數(shù)在RAM運(yùn)行的VxWorks中初始化RAM.

  • ROM中運(yùn)行的VxWorks

VxWorks在ROM中運(yùn)行,即寫入ROM中的VxWorks是非壓縮的,不需要解壓,系統(tǒng)直接跳到ROM的首地址,運(yùn)行VxWorks.注意:ROM運(yùn)行的VxWorks并不支持所有的主扳,應(yīng)以主扳手冊(cè)為準(zhǔn).

文件romInit.s中的romInit()---->文件bootInit.c中的romStart()---->文件usrConfig.c中的usrInit()----->sysHwInit()----->usrKernelInit()----->KernelInit(usrRoot,...)

   VxWorks在ROM中運(yùn)行主要是為了節(jié)省RAM空間,以便應(yīng)用程序有更大的空間運(yùn)行.只把VxWorks image的data段復(fù)制到RAM的LOCAL_LOW_ADRS, text部分留在ROM并在ROM中執(zhí)行.

ROM中運(yùn)行的VxWorks缺點(diǎn)是運(yùn)行速度慢.

  • RAM中運(yùn)行的VxWorks

VxWorks在RAM中運(yùn)行,即寫入ROM中的Boot或VxWorks Image是壓縮的,需要先解壓copy所有的text和data到RAM的LOCAL_LOW_ADRS中,下面sysInit()主要是初始化RAM用的,系統(tǒng)直接跳到RAM的首地址,運(yùn)行VxWorks

usrInit()前面不壓縮,即romInit(),romStart()不能壓縮.

文件romInit.s中的romInit()---->文件bootInit.c中的romStart()---->sysaLib.s中的sysInit()---->文件usrConfig.c中的usrInit()----->sysHwInit()----->usrKernelInit()----->KernelInit(usrRoot,...)

  RAM運(yùn)行的Boot或VxWorks image的text段或data段會(huì)從ROM復(fù)制到RAM,在RAM中運(yùn)行.

其中usrRoot()是VxWorks啟動(dòng)的第一個(gè)任務(wù),由它來初始化 driver,network等

描述: romInit.s first execute in flash,minal initiliz,then jump to romStart.

  romStart() 開始裝載和解壓image到RAM,sysaLib.s是在RAM中執(zhí)行的第一個(gè)函數(shù).

  • BootROM image

  • BootROM image

最少的系統(tǒng)初始化,主要用于啟動(dòng)裝載VxWorks image.一般有壓縮和不壓縮兩種形式,如bootrom和boot_uncmp.與VxWorks image的區(qū)別在于一個(gè)Bootrom調(diào)用bootConfig.c,而VxWorks調(diào)用usrConfig.c.

文件romInit.s中的romInit()---->文件bootInit.c中的romStart()---->文件bootConfig.c中的usrInit()----->sysHwInit()----->usrKernelInit()----->KernelInit(usrRoot,...)

    其中 /target/config/all/bootConfig.c是Boot ROM設(shè)置模塊.用于通過網(wǎng)絡(luò)加載VxWorks image.

usrRoot()---->bootCmdLoop(void)命令行選擇,或autobooting----->bootLoad(pLine, &entry)加載模塊到內(nèi)存(網(wǎng)絡(luò),TFFS,TSFS...)----->netifAttach()---->go(entry)----->(entry)()從入口開始執(zhí)行,不返回.

  • 各個(gè)函數(shù)的主要作用

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()

  • 初始化內(nèi)存分區(qū)表(memory partition library)

  • 初始化系統(tǒng)系統(tǒng)時(shí)鐘(system clock)

  • 初始化輸入輸出系統(tǒng)(I/O system)----可選

  • Create devices----可選

  • 設(shè)置網(wǎng)絡(luò)(Configure network)--------可選

  • 激活WDB目標(biāo)通信(Activate WDB agent)---------可選

  • 調(diào)用程序(Activate application)

 

VxWorks Image在RAM中解壓的位置

 

RAM Low Address

RAM High Address

VxWorks運(yùn)行的位置
Boot image由ROM解壓后Copy的位置,即bootRom區(qū)

RAM Low Address,RAM High Address和有關(guān)定義在BSP,config.h,makefile文件中定義.可參見BSP配置文件及生成下載

 

VxWorks 在ROM中的情況

 
ROM 低高地址位

 

 

ROM 低地址位
壓縮的VxWorks Imgage
沒有壓縮的romInit.s和romStart()在ROM的起始位置,系統(tǒng)power up后,從這個(gè)起始位開始執(zhí)行,即執(zhí)行romInit(),起始位置由硬件定義,一般為0x00000000

注:淺藍(lán)色為整個(gè)VxWorks Image.

其中 RAM_LOW_ADRS, RAM_HIGH_ADRS 等一些地址在makefile 和BSP config.h中定義.可參見BSP配置文件及生成下載

    本站是提供個(gè)人知識(shí)管理的網(wǎng)絡(luò)存儲(chǔ)空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點(diǎn)。請(qǐng)注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購(gòu)買等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊一鍵舉報(bào)。
    轉(zhuǎn)藏 分享 獻(xiàn)花(0

    0條評(píng)論

    發(fā)表

    請(qǐng)遵守用戶 評(píng)論公約

    類似文章 更多