资源预览内容
第1页 / 共3页
第2页 / 共3页
第3页 / 共3页
亲,该文档总共3页全部预览完了,如果喜欢就下载吧!
资源描述
VxWorks映像(RAM)初始化流程代码分析Bootrom的部分目前不分析0xfff00100- Bootrom初始化必要的硬件,关闭中断,把VxWorks映像板移到RAM_LOW_ADRS指定的地址入口: RAM_LOW_ADRSsysAlib.s/sysInit清寄存器,初始化OR BR 跳转到usrInit函数/proj/projectxx/prjConfig.c/usrInit函数描述首先调用sysStart函数清除bss段和设置中断向量表基地址。/comps/src/usrstartup.c/sysStart函数void sysStart (startType)#ifdefCLEAR_BSS /CLEAR_BSS宏在VxWorks的kernel Components中配置bzero (edata, end - edata);/清除bss段 ,edata和end符号见link.ram文件#endif#if (CPU_FAMILY = PPC) 初始化全局标准输入/输出/错误为空文件描述符 ioGlobalStdSet (STD_IN, ERROR); ioGlobalStdSet (STD_OUT, ERROR); ioGlobalStdSet (STD_ERR, ERROR);#endif sysStartType = startType; intVecBaseSet (FUNCPTR *) VEC_BASE_ADRS);/初始化向量表基地址为VEC_BASE_ADRS,VEC_BASE_ADRS在VxWorks的memory中设置#if (CPU_FAMILY = PPC) & defined(INCLUDE_EXC_SHOW)/如果定义了INCLUDE_EXC_SHOW宏,那么调用excShowInit函数装载异常,中断,崩溃显示函数(打印到标准输出)INCLUDE_EXC_SHOW宏在show routines中设置 excShowInit ();#endif 调用excVecInit函数初始化向量表vxwork_srctargetsrcarchppcexcArchLib.c其实是把所有的异常向量指向一个默认的异常处理程序,可以观察该函数执行后异常入口的地址(如0x100,0x200)被填入的汇编代码。调用BSP的sysHwInit函数初始化硬件configbspsyslib.c跳转到usrKernelInit函数配置操作系统compssrcusrKernel.cvoid usrKernelInit (void) classLibInit ();/初始化类目标taskLibInit ();/初始化任务目标/初始化一些队列 qInit (&readyQHead, Q_PRI_BMAP, (int)&readyQBMap, 256); qInit (&activeQHead, Q_FIFO); /* FIFO queue for active q */ qInit (&tickQHead, Q_PRI_LIST); /* simple priority semaphore q*/workQInit ();/* queue for deferred work */跳转到kernelInit函数 kernelInit (FUNCPTR) usrRoot, ROOT_STACK_SIZE, MEM_POOL_START, sysMemTop (), ISR_STACK_SIZE, INT_LOCK_LEVEL);/参数说明/usrRoot 根任务(第一个任务)入口函数/ROOT_STACK_SIZE 根任务堆栈大小/ MEM_POOL_START 系统内存池起始地址,位于end符号之后的内存/ sysMemTop () 系统内存池结束地址/ISR_STACK_SIZE 中断堆栈大小/ INT_LOCK_LEVEL 中断禁止级别kernelInit函数对齐各种地址用0xee填充中断堆栈设置中断堆栈启动root任务以下为VxWorks系统内存结构* .CS* - HIGH MEMORY -* - - pMemPoolEnd* | | We have to leave room for this block headers* | 1 BLOCK_HDR |so we can add the root task memory to the pool.* | |* -* | | * | WIND_TCB |* | |* - - pRootStackBase;* | |* | ROOT STACK |* | |* -* | | We have to leave room for these block headers* | 1 FREE_BLOCK |so we can add the root task memory to the pool.* | 1 BLOCK_HDR |* | |* - - pRootMemStart;* -* | |* FREE MEMORY POOL pool initialized in kernelRoot()* | |* - - pMemPoolStart + intStackSize; vxIntStackBase* | |* | INTERRUPT STACK |* | |* - - pMemPoolStart; vxIntStackEndl - LOW MEMORY Root任务函数,注意该任务由VxWorks配置决定void usrRoot (char *pMemPoolStart, unsigned memPoolSize) usrKernelCoreInit (); /* core kernel facilities */ memInit (pMemPoolStart, memPoolSize); /* full featured memory allocator */ memPartLibInit (pMemPoolStart, memPoolSize); /* core memory partition manager */ sysClkInit (); /* System clock component */ selectInit (NUM_FILES); /* select */ usrIosCoreInit (); /* core I/O system */ usrKernelExtraInit (); /* extended kernel facilities */ usrIosExtraInit (); /* extended I/O system */ usrNetworkInit (); /* Initialize the network subsystem */ selTaskDeleteHookAdd (); /* install select task delete hook */ usrToolsInit (); /* software development tools */ usrAppInit (); /* call usrAppInit() (in your usrAppInit.c project file) after startup. */usrKernelCoreInit()函数void usrKernelCoreInit (void) eventLibInit (); /* VxWorks events */ semBLibInit (); /* binary semaphores */ semMLibInit (); /* mutex semaphores */ semCLibInit (); /* counting semaphores */ msgQLibInit (); /* message queues */ wdLibInit (); /* watchdog timers */taskHookInit (); /* user callouts on task creation/deletion/context switch */memInit()函数
收藏 下载该资源
网站客服QQ:2055934822
金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号