|
usrAppInit函数里增加自动模块加载:
int status = ERROR ;
int fd = ERROR ;
MODULE_ID hModule ;
FUNCPTR taskAppEntry = NULL ;
SYM_TYPE * pType ;
/* 打开第一个可执行文件位于ram0 */
fd = open("ram0/myapp.out", O_RDONLY, 0);
if(fd == ERROR) {
printf("Can not open application program file. \n\r") ;
return(ERROR);
} else {
printf("Application program file opened. \n\r") ;
}
/* 加载模块 */
printf("Autoload application model...\n");
if((hModule = loadModule(fd, LOAD_ALL_SYMBOLS)) == NULL) {
close(fd);
printf("LoadModule for application is error = 0x%x. \n\r", errno);
return(ERROR);
}
close(fd);
/* 查找初始化函数的符号 */
status = symFindByName(sysSymTbl, "myInit_Task", (char **)&taskAppEntry, pType);
if(status == ERROR) {
printf("symFindByName error = %d. \n\r", errno);
return(ERROR);
} else {
printf("taskAppEntry = 0x%x, type = %d \n\r", (int)taskAppEntry, (int)*pType);
}
return(OK);
/* 激活初始化任务 */
status = taskSpawn("myInit", 100, 0, 30000, taskAppEntry, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
if(status == ERROR) {
printf("taskSpawn error = %d. \n\r", errno);
return(ERROR);
}
printf("\n\r");
return(OK);
运行到status = symFindByName(sysSymTbl, "myInit_Task", (char **)&taskAppEntry, pType);就出错,tRootTask被挂起,弹出
data access
Exception current instruction address: 0x00026974
Machine Status Register: 0x00009030
Data Access Register: 0x05ed5754
Condition Register: 0x40000084
Data storage interrupt Register: 0x0000000b
Task: 0x1ed57c0 "tRootTask"
在VXWORKS组件中已经包含独立符号表。奇怪的是上述函数在SHELL里面分别逐个运行则不会有任何错误。POWERPC860平台
请高手指点。
|
|