Press any key to stop auto-boot...
1
auto-booting...
boot device : motetsec
unit number : 0
processor number : 0
host name : host
file name : vxWorks
inet on ethernet (e) : 192.168.0.207:ffffff00
host inet (h) : 192.168.0.106
user (u) : xygm
ftp password (pw) : xygm
flags (f) : 0x8
target name (tn) : xygm
Booting from flash ...
Loading /vxWorks @ 0xf0400000 ... Not found
Loading /vxWorks @ 0xf0a00000 ... Not found
192.168.0.106 @ motetsec0(192.168.0.107:ffff0000)
Loading... 2269760 + 557152
Starting at 0x100000...
即vxworks启动过程中死机了,有的项目是加载到这里卡死,不动,直到看门狗复位重启。有的项目是加载到这里,死机了马上重启。本项目是加载到这里卡死不动。
2.解决办法:
解决此办法必须了解vxworks的启动流程,大致如下:
辅助办法 : <1> 点灯,直接操作GPIO引脚,观察启动过程中led的状态变化。
<2> 加汇编指令, 如WRS_ASM(“EIEO”);通过仿真器查看CPU最终的运行状态。
显然方法1 能更快捷的定位问题。
定位步骤如下:
一般会首先联想到是驱动问题。
PrjConfig.c (hardWareInterFaceBusInit)
如果这里还不能解决问题,就需要按照vxworks的启动流程,步步跟踪,查看出问题的地方在哪里.
函数调用过程
usrInit(prjconfig.c)->SysHwInit(sysLib.c) ->hardWareInterFaceInit(prjconfig.c) ->hardWareInterFaceBusInit(prjconfig.c)->
usrInit 很有多重要的初始化
void usrInit (int startType)
{
sysStart (startType); /* clear BSS and set up the vector table base address. */
usrBootHwInit (); /* call usrBootHwInit() routine */
cacheLibInit (USER_I_CACHE_MODE, USER_D_CACHE_MODE); /* include cache support */
excShowInit (); /* exception show routines */
excVecInit (); /* exception handling */
vxCpuLibInit (); /* Enable the initialization of CPU identification routines */
sysHwInit (); /* call the BSPs sysHwInit routine during system startup */
usrCacheEnable (); /* optionally enable caches */
objInfoInit (); /* object management routines that requires lookup in a list of objects, such as the objNameToId() routine. */
objLibInit ((OBJ_ALLOC_FUNC)FUNCPTR_OBJ_MEMALLOC_RTN, (OBJ_FREE_FUNC)FUNCPTR_OBJ_MEMFREE_RTN, OBJ_MEM_POOL_ID, OBJ_LIBRARY_OPTIONS); /* object management */
vxMemProbeInit (); /* Initialize vxMemProbe exception handler support */
classListLibInit (); /* object class list management */
semLibInit (); /* semaphore support infrastructure */
/* mutex semaphores */
/* mutex semaphore creation routine */
classLibInit (); /* object class management */
kernelBaseInit (); /* required component DO NOT REMOVE. */
taskCreateHookInit (); /* user callouts on task creation/deletion */
sysDebugModeInit (); /* a flag indicating the system is in 'debug' mode */
usrKernelInit (VX_GLOBAL_NO_STACK_FILL); /* context switch and interrupt handling (DO NOT REMOVE). */
}
usrKernelInit(target/config/comps/src/usrkernel.c) ->usrRoot->
usrRoot 会调用usrAppInit,用户函数入口。
void usrRoot (char *pMemPoolStart, unsigned memPoolSize)
{
// *(volatile UINT32*)(0xffe00000 + 0xF008) =0; //运行到这里来
usrKernelCoreInit (); /* core kernel facilities */
poolLibInit(); /* memory pools of fixed size items */
memEdrInit (); /* Memory Error Detection and Reporting */
memInit (pMemPoolStart, memPoolSize, MEM_PART_DEFAULT_OPTIONS); /* full featured memory allocator */
memPartLibInit (pMemPoolStart, memPoolSize); /* core memory partition manager */
memEdrInit2(); /* Memory Error Detection and Reporting */
usrAimMmuConfig (); /* AIM MMU configlette */
if (memDefaultAlignment<16) memDefaultAlignment = 16; /* Because FileSytem use malloc() to allocate ATA I/O buffer, if the buffer is not aligned 16 bytes, driver for some ATA controller(such as, CS5530), will copy data to/from aligned buffer before write/read. This is a serious reduction in efficiency. Include me to avoid it. */
/* basic MMU component */
usrMmuInit ((VIRT_ADDR) pMemPoolStart, memPoolSize); /* MMU global map support */
usrKernelCreateInit (); /* object creation routines */
memInfoInit (); /* memory allocator info routines */
envLibInit (ENV_VAR_USE_HOOKS); /* unix compatible environment variables */
usrPmInit (); /* reboot-safe protected memory region manager */
usrEdrInit (); /* reboot-safe protected error log */
edrStubInit (); /* protected error log stub initialization */
usrTextProtect (); /* write-protect program text */
excIntNestLogInit(); vxMsrSet(vxMsrGet() | taskMsrDefault); /* Enable interrupts at appropriate point in root task */
// *(volatile UINT32*)(0xffe00000 + 0xF008) =0; //运行到这里来
logInitEarly(MAX_LOG_MSGS); /* ZYHD extend of logLib */
// *(volatile UINT32*)(0xffe00000 + 0xF008) =0; //运行到这里来
usrSysHwInit2(); /* call the usrSysHwInit2 routine during
这个函数要注意,往往不执行什么。
void usrSysHwInit2 (void)
{
//因为vxworks必须肯定定义了该组件,所以不会执行sysHwInit2
#ifndef INCLUDE_SYSCLK_INIT
sysHwInit2();
#endif
}
system startup
// *(volatile UINT32*)(0xffe00000 + 0xF008) =0; //运行到这里来
sysClkInit (); /* System clock component */
void sysClkInit (void)
{
/* set up the system timer */
sysClkConnect ((FUNCPTR) usrClock, 0); /* connect clock ISR */
sysClkRateSet (SYS_CLK_RATE); /* set system clock rate */
sysClkEnable (); /* start it */
}
//==========================此时钟有问题
*(volatile UINT32*)(0xffe00000 + 0xF008) =0; //XXXXX运行BU 到这里来
usrIosCoreInit (); /* core I/O system */
// *(volatile UINT32*)(0xffe00000 + 0xF008) =0; //XXXXXX运行BU到这里来
usrKernelExtraInit (); /* extended kernel facilities */
usrIosExtraInit (); /* extended I/O system */
sockLibInit (); /* Socket API */
usrNetworkInit (); /* Initialize the network subsystem */
selTaskDeleteHookAdd (); /* selectInit, part 2, install task delete hook */
cpuPwrLightMgrInit (); cpuPwrMgrEnable (TRUE); /* Idle-halt CPU power management */
cplusCtorsLink (); /* run compiler generated initialization functions at system startup */
usrCplusLibInit (); /* Basic support for C++ applications */
cplusDemanglerInit (); /* Support library for kernel shell and loader: provides human readable forms of C++ identifiers */
// *(volatile UINT32*)(0xffe00000 + 0xF008) =0; //XXXXXX 没运行到这里来
usrToolsInit (); /* software development tools */
usrMmuOptimize (); /* Optimize configlette */
// *(volatile UINT32*)(0xffe00000 + 0xF008) =0; //xxxxxx运行不到这里来
usrAppInit (); /* call usrAppInit() (in your usrAppInit.c project file) after startup. */
wdbIpAddr(); /* BOOL wdbIpAddr(BOOL bShow). if not INCLUDE_WDB_COMM_END, the routine is dummy. */
}
还有一种方法是去掉hwconfig.c中的设备列表,去掉之后,prjconfig.c中的相关设备驱动就无法加载,两者效果是一致的。
这里解决办法是,修改设备列表的内容,而不是像以前那样注释掉hardWareInit里面的注册函数,两者效果应该是一致的,但是前者可以rebuild,后者rebuild 后要手动修改。