笑含风的个人空间 https://blog.eetop.cn/miaofng [收藏] [复制] [分享] [RSS]

空间首页 动态 记录 日志 相册 主题 分享 留言板 个人资料

日志

终于搞定“packet too big”,哇哈哈哈

已有 5231 次阅读| 2007-12-2 20:15

天气: 阴雨
心情: 高兴

自从上次莫名其妙的解决了u-boot-1.3.0&eldk malloc 问题后,终于能够正常进入U-BOOT命令行界面.

首先试一下ping 命令,因为总不至于用kermit/JTAG把程序down来down去吧,网络才是王道,结果:(

u-boot-1.3.0 => run ping
sending ICMP for 0102a8c0
ARP broadcast 1
eth_send() start...
eth_rx() start...
chip id = 0x50,0x70
eth_rx(): rtl8019 packet received with no error
eth_rx()->nic_to_pc()


nic_to_pc() start ...
next_packet_pointer=2
nf: NetReceive() packet received
Receive from protocol 0x806
Got ARP
Got ARP REPLY, set server/gtwy eth addr (00:1c:23:86:48:2f)
Got it
ARP broadcast 1
eth_send() start...
nic_to_pc() current_point = 2  //rtl8019内部ram地址明明是0x40~0x80,怎么可能是2,晃点我老人家呀~~~~
eth_rx()->boundary=2 //
eth_rx(): rtl8019 packet received with no error
eth_rx()->nic_to_pc()


nic_to_pc() start ...
next_packet_pointer=2
packet too big! <rxlen = 65532 bytes>   //!!!!!!!!!!!

这个问题整整花了两周时间,今天终于搞定了,哇哈哈哈哈哈哈

我的U-BOOT 是从1.1升级过来的,按理说1.1.1上面能够正常运行的移植到1.3版本之后不会发生什么大的问题的。

去网上搜索了一下,不少N人说是硬件时序问题。可是老版本明明正常工作的呀。(备注:关于RTL8019 寄存器baseaddress

问题,如果开发板上只接了5根地址线,那么base address仅仅跟gcs引脚相关, 与rtl8019的0x200,0x300没有任何关系随便

0x06000000还是0x06000100,0x06000200,0x06000300都能正常工作)

就在我试了各种方法,什么电路,代码,datasheet,sniffer...毫无办法准备放弃之时终于找到了“救星”

http://blackfin.uclinux.org/gf/project/toolchain/tracker/?action=TrackerItemEdit&tracker_item_id=719

摘要如下:

Problem:
bfin-elf-gcc compiler generates wrong code with optimization {-Os} (By default
Makefile has optimization for size). (Disabling the optimization solves the
problem)

Code snippet: File -drivers/rtl8019.c Function -nic_to_pc()
rec_head_status = get_reg (RTL8019_DMA_DATA);
next_packet_pointer = get_reg (RTL8019_DMA_DATA);
packet_length0 = get_reg (RTL8019_DMA_DATA);
packet_length1 = get_reg (RTL8019_DMA_DATA);

Instead of generating asm instruction four times for get_reg function. The
toolchain optimizes & generates code for a single get_reg . This is wrong
and will cause wrong packet size.

Regards,
Manigandan

reply:

In the driver, RTL8019_DMA_DATA may be the MMR. Each read will return a new
value. But gcc don't know of this information if you don't tell it.

By defining get_reg() as following, you may get what you want:

static unsigned char get_reg (unsigned int regno)
{
return (*(volatile unsigned char *) regno);
}

原来都是因为少了它---->!!!!!!volatile!!!!!!!

加上一切搞定:)

u-boot-1.3.0 => run ping
sending ICMP for 0102a8c0
ARP broadcast 1
eth_send() start...
eth_rx() start...
chip id = 0x50,0x70
eth_rx(): rtl8019 packet received with no error
eth_rx()->nic_to_pc()


nic_to_pc() start ...
next_packet_pointer=77
nf: NetReceive() packet received
Receive from protocol 0x806
Got ARP
Got ARP REPLY, set server/gtwy eth addr (00:1c:23:86:48:2f)
Got it
eth_send() start...
nic_to_pc() current_point = 77    //这才乖^_^
eth_rx()->boundary=77
eth_rx(): rtl8019 packet received with no error
eth_rx()->nic_to_pc()


nic_to_pc() start ...
next_packet_pointer=78
nf: NetReceive() packet received
Receive from protocol 0x800
Got IP
len=28, v=45
PingHandler() start...
PingHandler() return NETLOOP_SUCCESS
nic_to_pc() current_point = 78
eth_rx()->boundary=78
host 192.168.2.1 is alive

说来也奇怪,在1.3.0的代码中明明已经有人把put_reg中的volatile加上了,干嘛不一起把get_reg中的volatile

也加上,搞得我们这些后辈人人郁闷之至...(我在网上看到了很多跟我一样郁闷的人,敬意此帖奉上)


点赞

评论 (0 个评论)

facelist

您需要登录后才可以评论 登录 | 注册

  • 关注TA
  • 加好友
  • 联系TA
  • 0

    周排名
  • 0

    月排名
  • 0

    总排名
  • 0

    关注
  • 1

    粉丝
  • 0

    好友
  • 0

    获赞
  • 5

    评论
  • 398

    访问数
关闭

站长推荐 上一条 /2 下一条


小黑屋| 手机版| 关于我们| 联系我们| 在线咨询| 隐私声明| EETOP 创芯网
( 京ICP备:10050787号 京公网安备:11010502037710 )

GMT+8, 2024-12-22 15:56 , Processed in 0.025231 second(s), 13 queries , Gzip On, Redis On.

eetop公众号 创芯大讲堂 创芯人才网
返回顶部