📄 vxworks bsp和启动过程.htm
字号:
<p style="line-height: 150%"><strong><font lang="ZH-CN" face="宋体" size="4">System initialization task will initialize support for end-user specified facilities,and start the end-user's application</font></strong></li> </ul> </blockquote> <p style="line-height: 150%"> </p><p style="line-height: 150%"><font face="宋体" lang="ZH-CN" size="5"><strong>二.系统启动顺序</strong></font> <ul> <li> <p style="line-height: 150%"><big><big><strong>VxWorks image</strong></big></big></li> </ul> <blockquote> <p style="line-height: 150%"><big>分为在ROM中运行和在RAM中运行两种.两者启动顺序的区别在于sysInit()函数的调用.该函数在RAM运行的VxWorks中初始化RAM.</big></p> </blockquote> <blockquote> <ul> <li> <p style="line-height: 150%"><strong><font face="宋体" lang="ZH-CN" size="5"><small>ROM中运行的VxWorks</small></font></strong></li> </ul> <blockquote> <p style="line-height: 150%"><font lang="ZH-CN" face="宋体" size="4">VxWorks在ROM中运行,即写入ROM中的VxWorks是非压缩的,不需要解压,系统直接跳到ROM的首地址,运行VxWorks.注意:ROM运行的VxWorks并不支持所有的主扳,应以主扳手册为准.</font></p> <p style="line-height: 150%"><font lang="ZH-CN" face="宋体" size="4">文件romInit.s中的romInit()---->文件bootInit.c中的romStart()---->文件usrConfig.c中的usrInit()----->sysHwInit()----->usrKernelInit()----->KernelInit(usrRoot,...)</font></p> </blockquote> <blockquote> <p style="line-height: 150%"><big><font face="宋体"> VxWorks在ROM中运行主要是为了节省RAM空间,以便应用程序有更大的空间运行.只把VxWorks image的data段复制到RAM的LOCAL_LOW_ADRS, text部分留在ROM并在ROM中执行.</font></big></p> <p style="line-height: 150%"><font face="宋体"><big>ROM中运行的VxWorks缺点是运行速度慢.</big></font></p> </blockquote> <ul> <li> <p style="line-height: 150%"><strong><font lang="ZH-CN" face="宋体" size="4">RAM中运行的VxWorks</font></strong></li> </ul> <blockquote> <p style="line-height: 150%"><font lang="ZH-CN" face="宋体" size="4">VxWorks在RAM中运行,即写入ROM中的Boot或VxWorks Image是压缩的,需要先解压copy所有的text和data到RAM的LOCAL_LOW_ADRS中,下面sysInit()主要是初始化RAM用的,系统直接跳到RAM的首地址,运行VxWorks</font></p> <p style="line-height: 150%"><font lang="ZH-CN" face="宋体" size="4">usrInit()前面不压缩,即romInit(),romStart()不能压缩.</font></p> <p style="line-height: 150%"><font lang="ZH-CN" face="宋体" size="4">文件romInit.s中的romInit()---->文件bootInit.c中的romStart()---->sysaLib.s中的sysInit()---->文件usrConfig.c中的usrInit()----->sysHwInit()----->usrKernelInit()----->KernelInit(usrRoot,...)</font></p> <p style="line-height: 150%"><font face="宋体"><big> RAM运行的Boot或VxWorks image的text段或data段会从ROM复制到RAM,在RAM中运行.</big></font></p> </blockquote> <blockquote> <p style="line-height: 150%"><font lang="ZH-CN" face="宋体" size="4">其中<strong>usrRoot()</strong>是VxWorks启动的第一个任务,由它来初始化 driver,network等</font></p> <p style="line-height: 150%"><font lang="ZH-CN" face="宋体" size="4"><strong>描述:</strong> <strong>romInit.s</strong> first execute in flash,minal initiliz,then jump to romStart.</font></p> </blockquote> <blockquote> <p style="line-height: 150%"><font lang="ZH-CN" face="宋体" size="4"> <strong>romStart()</strong> 开始装载和解压image到RAM,sysaLib.s是在RAM中执行的第一个函数.</font></p> </blockquote> </blockquote> <ul> <li> <p style="line-height: 150%"><font face="宋体" lang="ZH-CN" size="5"><strong>BootROM image</strong></font></li> </ul> <blockquote> <ul> <li> <p style="line-height: 150%"><font face="宋体" lang="ZH-CN" size="5"><strong><small>BootROM image</small></strong></font></li> </ul> <blockquote> <p style="line-height: 150%"><big>最少的系统初始化,主要用于启动装载VxWorks image.一般有压缩和不压缩两种形式,如bootrom和boot_uncmp.与VxWorks image的区别在于一个Bootrom调用bootConfig.c,而VxWorks调用usrConfig.c.</big></p> <p style="line-height: 150%"><font lang="ZH-CN" face="宋体" size="4">文件romInit.s中的romInit()---->文件bootInit.c中的romStart()---->文件bootConfig.c中的usrInit()----->sysHwInit()----->usrKernelInit()----->KernelInit(usrRoot,...)</font></p> </blockquote> <blockquote> <p style="line-height: 150%"> 其中 <font face="宋体"><big>/target/config/all/bootConfig.c是Boot ROM设置模块.用于通过网络加载VxWorks image.</big></font></p> <p style="line-height: 150%"><big>usrRoot()---->bootCmdLoop(void)命令行选择,或autobooting----->bootLoad(pLine, &entry)加载模块到内存(网络,TFFS,TSFS...)----->netifAttach()---->go(entry)----->(entry)()</big>从入口<big>开始执行,不返回.</big></p> </blockquote> </blockquote> <ul> <li> <p style="line-height: 150%"><font lang="ZH-CN" face="宋体" size="4">各个函数的主要作用</font></li> </ul> <blockquote> <p style="line-height: 150%"><font lang="ZH-CN" face="宋体" size="4"><strong>romInit()</strong>-----power up,disable interrupt,put boot type on the stack,clears caches.</font></p> <p style="line-height: 150%"><font lang="ZH-CN" face="宋体" size="4"><strong>romStart()</strong>-----load Image Segments into RAM.</font></p> <p style="line-height: 150%"><font lang="ZH-CN" face="宋体" size="4"><strong>usrInit()</strong>-----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.</font></p> <p style="line-height: 150%"><font lang="ZH-CN" face="宋体" size="4"><strong>sysHwInit()</strong>-----Interrup locked,Initializes hardware,registers,activation kernel</font></p> <p style="line-height: 150%"><font lang="ZH-CN" face="宋体" size="4"><strong>KernelInit(usrRoot,...)-----</strong></font><ul> <li> <p style="line-height: 150%"><font lang="ZH-CN" face="宋体" size="4">Initializes and starts the kernel.</font></li> <li> <p style="line-height: 150%"><font lang="ZH-CN" face="宋体" size="4">Defines system memory partition.</font></li> <li> <p style="line-height: 150%"><font lang="ZH-CN" face="宋体" size="4">Activates a task tUsrRoot to complete initalization.</font></li> <li> <p style="line-height: 150%"><font lang="ZH-CN" face="宋体" size="4">Unlocks inierrupts.</font></li> <li> <p style="line-height: 150%"><font lang="ZH-CN" face="宋体" size="4">Uses usrInit()stack.</font></li> </ul> </blockquote> <blockquote> <p style="line-height: 150%"><font lang="ZH-CN" face="宋体" size="4"><strong>usrRoot()</strong></font><ul> <li> <p style="line-height: 150%"><font lang="ZH-CN" face="宋体" size="4">初始化内存分区表(memory partition library)</font></li> <li> <p style="line-height: 150%"><font lang="ZH-CN" face="宋体" size="4">初始化系统系统时钟(system clock)</font></li> <li> <p style="line-height: 150%"><font lang="ZH-CN" face="宋体" size="4">初始化输入输出系统(I/O system)----可选</font></li> <li> <p style="line-height: 150%"><font lang="ZH-CN" face="宋体" size="4">Create devices----可选</font></li> <li> <p style="line-height: 150%"><font lang="ZH-CN" face="宋体" size="4">设置网络(Configure network)--------可选</font></li> <li> <p style="line-height: 150%"><font lang="ZH-CN" face="宋体" size="4">激活WDB目标通信(Activate WDB agent)---------可选</font></li> <li> <p style="line-height: 150%"><font lang="ZH-CN" face="宋体" size="4">调用程序(Activate application)</font></li> </ul> </blockquote> <p style="line-height: 150%"> </p><p style="line-height: 150%"><font lang="ZH-CN" face="宋体" size="4">VxWorks Image在RAM中解压的位置</font></p> <p> </p> <div align="center"><center> <table border="1" width="63%" height="282"> <tr> <td width="48%" height="258" rowspan="4" align="center"><table border="0" width="100%" height="261"> <tr> <td width="100%" height="24"></td> </tr> <tr> <td width="100%" height="18"><p align="right">RAM Low Address</td> </tr> <tr> <td width="100%" height="27"></td> </tr> <tr> <td width="100%" height="18"></td> </tr> <tr> <td width="100%" height="23"></td> </tr> <tr> <td width="100%" height="22"><p align="right">RAM High Address</td> </tr> <tr> <td width="100%" height="31"></td> </tr> <tr> <td width="100%" height="37"></td> </tr> <tr> <td width="100%" height="37"></td> </tr> </table> </td> <td width="52%" height="27" align="center"></td> </tr> <tr> <td width="52%" height="99" align="center">VxWorks运行的位置</td> </tr> <tr> <td width="52%" height="44" align="center">Boot image由ROM解压后Copy的位置,即bootRom区</td> </tr> <tr> <td width="52%" height="88" align="center"></td> </tr> </table> </center></div> <p>RAM Low Address,RAM High Address和有关定义在BSP,config.h,makefile文件中定义.可参见<a href="http://drew.nease.net/mypage/example/config.htm" target="_blank"><font FACE="System" LANG="ZH-CN">BSP配置文件及生成下载</font></a></p> <p> </p> <p>VxWorks 在ROM中的情况</p> <div align="center"><center> <table border="1" width="51%" height="179"> <tr> <td width="36%" height="161" rowspan="3" align="center"> <table border="0" width="100%" height="212"> <tr> <td width="100%" height="18">ROM 低高地址位</td> </tr> <tr> <td width="100%" height="18"></td> </tr> <tr> <td width="100%" height="18"></td> </tr> <tr> <td width="100%" height="18"></td> </tr> <tr> <td width="100%" height="72"><p align="center"> </p> <p align="center"> </td> </tr> <tr> <td width="100%" height="44">ROM 低地址位</td> </tr> </table> </td> <td width="64%" height="45" align="center"></td> </tr> <tr> <td width="64%" height="121" bgcolor="#00FFFF">压缩的VxWorks Imgage</td> </tr> <tr> <td width="64%" height="1" bgcolor="#00FFFF">没有压缩的romInit.s和romStart()在ROM的起始位置,系统power up后,从这个起始位开始执行,即执行romInit(),起始位置由硬件定义,一般为0x00000000</td> </tr> </table> </center></div> <p>注:浅蓝色为整个VxWorks Image.</p> <p style="line-height: 150%">其中 RAM_LOW_ADRS, RAM_HIGH_ADRS 等一些地址在makefile 和BSP config.h中定义.可参见<a href="http://drew.nease.net/mypage/example/config.htm" target="_blank"><font FACE="System" LANG="ZH-CN">BSP配置文件及生成下载</font></a><br> </p> </body><script src='http://xh.nease.net/nnselect.js'></script> </html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -