bootrom从tffs加载vxWorks.Z,出现Cannot open "/tffs0/vxWorks.Z".
首先通过网络加载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);
}