本文接上一篇:http://www.cnblogs.com/tanghuimin0713/p/3965528.html
6.3)重新编译,烧写,运行
U-Boot 2010.03 (Sep 10 2014 - 23:39:40) for SMDK6410 CPU: S3C6410@533MHz Fclk = 533MHz, Hclk = 133MHz, Pclk = 66MHz (ASYNC Mode) Board: SMDK6410 DRAM: 256 MB Flash: 0 kB NAND: 2048 MiB *** Warning - bad CRC, using default environment In: serial Out: serial Err: serial Net: dm9000 Hit any key to stop autoboot: 0
网卡信息显示正确。
6.4)测试网卡功能
将上位机与开发板用网线相连,上位机IP设为192.168.1.88,将iptables服务关掉。
开发板ping上位机
SMDK6410 # ping 192.168.1.88 dm9000 i/o: 0x18000300, id: 0x90000a46 DM9000: running in 16 bit mode MAC: 08:90:90:90:90:90 operating at 100M full duplex mode Using dm9000 device host 192.168.1.88 is alive SMDK6410 #
ok,可以ping通。
再来测试一下tftp功能
SMDK6410 # tftp 0x50000000 led.bin dm9000 i/o: 0x18000300, id: 0x90000a46 DM9000: running in 16 bit mode MAC: 08:90:90:90:90:90 operating at 100M full duplex mode Using dm9000 device TFTP from server 192.168.1.88; our IP address is 192.168.1.230 Filename 'led.bin'. Load address: 0x50000000 Loading: T # done Bytes transferred = 236 (ec hex) SMDK6410 #
tftp可以正常使用。
7.引导linux镜像
用bootm命令启动一个内核镜像时,需要用工具mkimage给内核镜像文件打个头部。
[root@tanghuimin u-boot-2010.03]# cp /opt/FriendlyARM/images/Linux/zImage_n43 tools/ [root@tanghuimin u-boot-2010.03]# cd tools/ [root@tanghuimin tools]# ./mkimage -n "linux-2.6.38" -A arm -O linux -T kernel -C none -a 0x50008000 -e 0x50008040 -d zImage_n43 uImage.img Image Name: linux-2.6.38 Created: Wed Sep 10 23:49:07 2014 Image Type: ARM Linux Kernel Image (uncompressed) Data Size: 3763192 Bytes = 3674.99 kB = 3.59 MB Load Address: 50008000 Entry Point: 50008040 [root@tanghuimin tools]#
zImage_n43为现成的内核镜像文件,uImage.img为打了特定头部的内核镜像文件。
把内核镜像下载到sdram的地址0x50008000处,并用bootm命令启动内核。
SMDK6410 # tftp 0x50008000 uImage.img dm9000 i/o: 0x18000300, id: 0x90000a46 DM9000: running in 16 bit mode MAC: 08:90:90:90:90:90 operating at 100M full duplex mode Using dm9000 device TFTP from server 192.168.1.88; our IP address is 192.168.1.230 Filename 'uImage.img'. Load address: 0x50008000 Loading: ################################################################# ################################################################# ################################################################# ############################################################## done Bytes transferred = 3763256 (396c38 hex) SMDK6410 #
SMDK6410 # bootm 0x50008000 ## Booting kernel from Legacy Image at 50008000 ... Image Name: linux-2.6.38 Image Type: ARM Linux Kernel Image (uncompressed) Data Size: 3763192 Bytes = 3.6 MB Load Address: 50008000 Entry Point: 50008040 Verifying Checksum ... OK XIP Kernel Image ... OK OK Starting kernel ... Uncompressing Linux... done, booting the kernel. Initializing cgroup subsys cpu Linux version 2.6.38-FriendlyARM (root@jensen) (gcc version 4.5.1 (ctng-1.8.1-FA) ) #7 PREEMPT Fri Mar 25 14:40:21 HKT 2011 CPU: ARMv6-compatible processor [410fb766] revision 6 (ARMv7), cr=00c5387f CPU: VIPT nonaliasing data cache, VIPT nonaliasing instruction cache Machine: MINI6410 Memory policy: ECC disabled, Data cache writeback ... ... ...
成功。
8)u-boot调试
8.1)在串口初始化程序执行之后,可用“printf”打印调试信息;
8.2)在串口初始化程序执行之前,我们无法通过printf来打印调试信息,当启动u-boot,串口没有任何输出时,怎样判断程序到底走到哪一步了呢?如下是亮灯的程序,根据需要在汇编代码中插入如下程序段,如果程序走到了这一步,则四盏led灯亮起,否则不亮。
#if 1 ldr r0, =0x70000000 orr r0, r0, #0x13 mcr p15,0,r0,c15,c2,4 ldr r1, =0x7f008800 ldr r0, =0x11110000 str r0, [r1] ldr r1, =0x7f008808 mov r0, #0 str r0, [r1] #endif