嵌入式 uboot中ping或者tftp的错误“Retry count exceeded; starting again”

来源:互联网 发布:mplayerx mac 白屏 编辑:程序博客网 时间:2024/05/29 14:27

今天在u-boot对DM9000X网卡的支持的移植。最后通过tftp下载时候,遇到如下问题:

tf[u-boot@MINI2440]# tp 0x30000000 root_qtopia-128M.img
Filename 'root_qtopia-128M.img'.
Load address: 0x30000000
Loading: T ##########T T #####################################################T
##T T
         #T T T T ######
Retry count exceeded; starting again
dm9000 i/o: 0x20000300, id: 0x90000a46
DM9000: running in 16 bit mode
MAC: 12:34:56:78:9a:bc
operating at 100M full duplex mode
Using dm9000 device
TFTP from server 10.1.0.128; our IP address is 10.1.0.129
Filename 'root_qtopia-128M.img'.
Load address: 0x30000000
Loading: T ###T ###T T ########

一直无休止循环,经网上搜索得知Uboot 端 tftp 程序传过来的Timeout参数不符合服务器端定义引起的Retry count exceeded; starting again

 解决方法:

    tftp客户端传过来的timeout是7810,而服务器端定义的范围在1-255秒之间,不是服务器的问题,而是 uboot中tftp参数设置的问题,参见TFTP Unsupported option(s) requested 问题详细分析及解决。打开/net/net.c

在uboot跟目录下,输入

gedit net/net.c

定位到104行附近,修改如下:

#if defined(CONFIG_CMD_NET)

DECLARE_GLOBAL_DATA_PTR;

#ifndef CONFIG_ARP_TIMEOUT
# define ARP_TIMEOUT  10000UL*CONFIG_SYS_HZ/1000 //5000UL
#else
# define ARP_TIMEOUT  CONFIG_ARP_TIMEOUT
#endif

 

定位到573行附近,修改如下:

#ifndef CONFIG_NET_MULTI
 //NetSetTimeout (10000UL, startAgainTimeout);
 NetSetTimeout (10000UL*CONFIG_SYS_HZ/1000, startAgainTimeout);
 NetSetHandler (startAgainHandler);
#else

 

定位到585行附近,修改如下:

eth_init (gd->bd);
 if (NetRestartWrap) {
  NetRestartWrap = 0;
  if (NetDevExists && !once) {
   //NetSetTimeout (10000UL, startAgainTimeout);
   NetSetTimeout (10000UL*CONFIG_SYS_HZ/1000, startAgainTimeout);
   NetSetHandler (startAgainHandler);
  } else {
   NetState = NETLOOP_FAIL;
  }

 

 

定位到779行附近,修改如下:

#define CDP_SYSOBJECT_TLV  0x0015
#define CDP_MANAGEMENT_ADDRESS_TLV 0x0016

#define CDP_TIMEOUT   (250UL*CONFIG_SYS_HZ/1000) //250UL

static int CDPSeq;
static int CDPOK;

 

打开/net/tftp.c

中端输入命令:gedit net/tftp.c

定位到16行,修改如下:

#define TIMEOUT  60000UL //5000UL

 

然后重新编译后下载测试:

[u-boot@MINI2440]# tftp 0x30000000 root_qtopia-128M.img
dm9000 i/o: 0x20000300, id: 0x90000a46
DM9000: running in 16 bit mode
MAC: 12:34:56:78:9a:bc
operating at 100M full duplex mode
Using dm9000 device
TFTP from server 10.1.0.128; our IP address is 10.1.0.129
Filename 'root_qtopia-128M.img'.
Load address: 0x30000000
Loading: T T T T T T T T T T
Retry count exceeded; starting again
dm9000 i/o: 0x20000300, id: 0x90000a46
DM9000: running in 16 bit mode
MAC: 12:34:56:78:9a:bc
operating at 100M full duplex mode
Using dm9000 device
TFTP from server 10.1.0.128; our IP address is 10.1.0.129
Filename 'root_qtopia-128M.img'.
Load address: 0x30000000
Loading: #################################################################
         #################################################################

         ... ...
         #################################################################
         ####################
done
Bytes transferred = 58487616 (37c7340 hex)
[u-boot@MINI2440]#

在yaffs2文件系统镜像下载到内存后:

[u-boot@MINI2440]# nand erase 0 0x40000

NAND erase: device 0 offset 0x0, size 0x40000
Erasing at 0x2000000000004 --   0% complete.
OK
[u-boot@MINI2440]# nand write 0x30000000 0 0x40000

NAND write: device 0 offset 0x0, size 0x40000
Writing at 0x2000000020000 -- 100% is complete. 262144 bytes written: OK
[u-boot@MINI2440]#

 可以看到,yaffs2文件系统烧录成功。

0 0
原创粉丝点击