U-Boot移植(17)ylp2410网卡dm9000aep

时间:2023-01-16 17:13:25

3、在板里,为了验证现在新u-boot 是否可用需要先在u-boot 中设置ip地址,如下所示:

注意下面红色字

U-Boot 1.1.6 (Dec  5 2009 - 17:41:27)

DRAM:  64 MB
Flash:  0 kB
NAND:  64 MiB
In:    serial
Out:   serial
Err:   serial
UPLLVal [M:28h,P:1h,S:2h]
MPLLVal [M:5ch,P:4h,S:0h]
CLKDIVN:3h


+---------------------------------------------+
| S3C2440A USB Downloader ver R0.03 2004 Jan  |
+---------------------------------------------+
USB: IN_ENDPOINT:1 OUT_ENDPOINT:3
FORMAT: <ADDR(DATA):4>+<SIZE(n+10):4>+<DATA:n>+<CS:2>
NOTE: Power off/on or press the reset button for 1 sec
      in order to get a valid USB device address.

Hit any key to stop autoboot:  0
Booting Linux ...

NAND read: device 0 offset 0x60000, size 0x200000

Reading data from 0x25fe00 -- 100% complete.
 2097152 bytes read: OK
## Booting image at 30007fc0 ...
Bad Magic Number

##### 100ask Bootloader for OpenJTAG #####
[n] Download u-boot to Nand Flash
[k] Download Linux kernel uImage
[j] Download root_jffs2 image
[y] Download root_yaffs image
[d] Download to SDRAM & Run
[z] Download zImage into RAM
[g] Boot linux from RAM
[f] Format the Nand Flash
[s] Set the boot parameters
[b] Boot the system

­ Reboot u-boot
[q] Quit from menu
Enter your selection: q
OpenJTAG>setenv  ipaddr  172.22.136.55
OpenJTAG>setenv  serverip   172.22.136.38
OpenJTAG>setenv  netmask   255.255.252.0
OpenJTAG>saveenv
Saving Environment to NAND...
Erasing Nand...Writing to Nand... done
OpenJTAG>reset
重新进入
Enter your selection: q
OpenJTAG> printenv
bootargs=noinitrd root=/dev/mtdblock3 init=/linuxrc console=ttySAC0
bootcmd=nand read.jffs2 0x30007FC0 kernel; bootm 0x30007FC0
bootdelay=2
baudrate=115200
ethaddr=08:00:3e:26:0a:5b
mtdids=nand0=nandflash0
mtdparts=mtdparts=nandflash0:256k@0(bootloader),128k(params),2m(kernel),-(root)
ipaddr=172.22.136.55     //板ip与pc机的ip在同一网段
serverip=172.22.136.38   /服务器ip,就是pc机的ip
netmask=255.255.252.0   /子网掩码,可设可不设,不影响!
stdin=serial
stdout=serial
stderr=serial
partition=nand0,0
mtddevnum=0
mtddevname=bootloader

Environment size: 445/65532 bytes
OpenJTAG>
4、设置完之后,在u-boot输入ping来测试能否连上pc机。如下:
OpenJTAG> ping 172.22.136.38
dm9000 i/o: 0x28000300, id: 0x90000a46
DM9000: running in 16 bit mode
MAC: 08:00:3e:26:0a:5b
rx fifo error
rx length too big
DM9000 error: status check fail: 0x3

ARP Retry count exceeded; starting again
## Warning: gatewayip needed but not set
上面可以看出,这次检测到网卡了!高兴了一把,但是后面还是错误,
提示”rx length too big“,可知应是溢出了,可能是位宽不对,但是我明明设了
位宽16,怎么可能不对。
于是我进入优龙公司自带的内核原码中看了下dm9000ae的驱动,发现我的设置还是正确的,
那到底问题出现哪?
原因:其实就是位宽设的不对,导到溢出,但是我明明设置的没错啊!
这个问题足足困扰了我两天,呵呵!
今天才发现原来我在前面设置进错地方了,
应该是vi  /board/100ask24x0/lowlevel_init.S ,而不是vi  /board/smdk2410/lowlevel_init.S
发现问题后,我重新修改了一遍,重新烧了一遍u-boot.bin,继续验证。
4、这一次的验证是可喜的。。。出现如下信息:
OpenJTAG> ping 172.22.136.38
dm9000 i/o: 0x28000300, id: 0x90000a46
DM9000: running in 16 bit mode
MAC: 08:00:3e:26:0a:5b
checksum bad
checksum bad
host 172.22.136.38 is alive
上面出现了 checksum bad字符,我也不知是否能不能用,至少已经ping上主机了,需要用tftp来试试看,能不能传输。
5、试用tftp传输文件。
首先把一个应用程序 S1-S3_led.bin 放到/var/lib/tftpboot 上,道理不说了。

OpenJTAG> tftp 0x30000000 S1-S3_led.bin
dm9000 i/o: 0x28000300, id: 0x90000a46
DM9000: running in 16 bit mode
MAC: 08:00:3e:26:0a:5b
TFTP from server 172.22.136.38; our IP address is 172.22.136.55
Filename 'S1-S3_led.bin'.
Load address: 0x30000000
Loading: checksum bad
T #
done
Bytes transferred = 300 (12c hex)
OpenJTAG> go 0x30000000
## Starting application at 0x30000000 ...
上面从传输到执行,整个过程没有任何错误,证时原来的那个不是错误。太高兴了,哈哈!