bootrom从tffs加载vxWorks.Z,出现Cannot open "/tffs0/vxWorks.Z".

程序员ai健身 2016-11-09 08:27:24
首先通过网络加载vxWorks.Z启动系统之后,使用download frimware 192.168.5.1 vxWork.Z,然后在uboot设置从tffs0启动,出现如下打印。
Copyright 2016-2016 UTEK Technology (SHENZHEN) Co.,LTD.

CPU: AT91SAM9G25 - ARM926EJS (Thumb)
Version: VxWorks5.5.1
BSP Version: 1.2/0
Creation date: Nov 9 2016, 20:04:19


Get bootline OK tffs=0,0(0,0)host:vxWorks.Z e=192.168.5.2:ffffff00 h=192.168.5.1 g=192.168.5.1 u=target f=0x80 tn=targetname


0
auto-booting...

zlh-bootLoad:drive = 0 removable = 0 bootFile = vxWorks.Z bootDev = tffs=0,0

Get bootline OK
zlh-tffsLoad:read_firmware_flag = 1
TFFS Version 2.2
0: socket=RFA: type=0x1f47, unitSize=0x10000, mediaSize=0xf00000
zlh-tffsLoad:drive = 0 removable = 0 fileName = /tffs0/vxWorks.Z
done.
Loading /tffs0/vxWorks.Z...
fd = 0xffffffff,Cannot open "/tffs0/vxWorks.Z".

Error loading file: errno = 0x380003.
Can't load boot file!!

tffsLoad()函数代码如下:

LOCAL STATUS tffsLoad
(
int drive, /* TFFS drive number (0 - (noOfDrives-1)) */
int removable, /* 0 - nonremovable flash media */
char * fileName, /* file name to download */
FUNCPTR * pEntry
)
{
int fd;
unsigned short read_firmware_flag=0;
if (tffsDrv () != OK)
{
printErr ("Could not initialize.\n");
return (ERROR);
}

/* printf ("Attaching to TFFS... ");*/

dosFsInit (NUM_DOSFS_FILES); /* initialize DOS-FS */

/*zlh@2016.11.09,create /tffs0*/
if (usrTffsConfig (drive, removable, "/tffs0") == ERROR)
{
printErr ("usrTffsConfig failed.\n");
return (ERROR);
}

NvRamGet_FirmwareFlag(&read_firmware_flag);

/*zlh@2016.11.09,tffs test*/
printf ("zlh-tffsLoad:read_firmware_flag = %d\n",read_firmware_flag);
tffsShowAll();
if ( (read_firmware_flag!=1) && (read_firmware_flag!=2) )
{
printf ( "can't run without firmware\n" );
return ERROR;
}
else if(read_firmware_flag ==1)
{
//sprintf ( fileName, "/tffs0/first.Z" );
sprintf ( fileName, "/tffs0/vxWorks.Z" );
}
else if(read_firmware_flag ==2)
{
sprintf ( fileName, "/tffs0/second.Z" );
}
/*kevin liu add end*/

/*zlh@2016.11.09,tffs test*/
printf ("zlh-tffsLoad:drive = %d removable = %d fileName = %s\n",
drive,removable,fileName);
/*
if (usrTffsConfig (drive, removable, fileName) == ERROR)
{
printErr ("usrTffsConfig failed.\n");
return (ERROR);
}
*/
printErr ("done.\n");

/* load the boot file */

printErr ("Loading %s...", fileName);

if ((fd = open (fileName, O_RDONLY, 0)) == ERROR)
{
printErr ("\nfd = 0x%x,Cannot open \"%s\".\n", fd,fileName);
return (ERROR);
}

if (bootLoadModuleInflate (fd, pEntry) != OK)
goto tffsLoadErr;

close (fd);
return (OK);

tffsLoadErr:

close (fd);
return (ERROR);
}
...全文
959 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
程序员ai健身 2016-11-28
  • 打赏
  • 举报
回复
这部分代码是没有问题的,后面发现是在系统起来之后,download firmware的时候做了备份。将vxWorks.Z文件修改为first.z和second.Z进行双备份。download一次之后名字被修改了。

2,179

社区成员

发帖
与我相关
我的任务
社区描述
xworks是美国 Wind River System 公司( 以下简称风河公司 ,即 WRS 公司)推出的一个实时操作系统。
社区管理员
  • VxWorks开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧