|
自从上次莫名其妙的解决了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
也加上,搞得我们这些后辈人人郁闷之至...(我在网上看到了很多跟我一样郁闷的人,敬意此帖奉上)