walnutcy

【原创】没硬件怎么玩zynq7000?

0
阅读(13192)

手头还没ZYNQ7000的板子,模拟个环境玩玩吧,该博文首发于个人主站:http://gnssinfo.com

没硬件怎么玩zynq7000?

xilinx官网提供了QEMU,可以在前期没有硬件的情况下也可以了解zynq7000,
关于QEMU的详细介绍请参考:http://wiki.xilinx.com/zynq-qemu
当然,这里仅指的是玩ARM内核,参照官网。

官网提供的可执行文件是基于64位Linux的:zynq_linux.tar.gz.

对于32位的系统,需要自己编译,解决方案如下:
1) 下载代码:git clone git://git.xilinx.com/qemu-xarm.git
2) 配置工程:
cd qemu-xarm
./configure --target-list=arm-softmmu --disable-werror --disable-kvm
3) 编译: make
4) 编译结果:
[walt@zynq7k qemu-xarm]$ ls -l arm-softmmu/qemu-system-arm
-rwxrwxr-x. 1 walt walt 18428427 Nov 6 15:27 arm-softmmu/qemu-system-arm
5) 检测环境是否OK,测试如下:
[walt@zynq7k qemu-xarm]$ ./arm-softmmu/qemu-system-arm -h
QEMU emulator version 1.0.50, Copyright (c) 2003-2008 Fabrice Bellard
usage: qemu-system-arm [options] [disk_image]

‘disk_image’ is a raw hard disk image for IDE hard disk 0

Standard options:
-h or -help display this help and exit
-version display version information and exit
-machine [type=]name[,prop[=value][,...]]
selects emulated machine (-machine ? for list)
property accel=accel1[:accel2[:...]] selects accelerator
supported accelerators are kvm, xen, tcg (default: tcg)
-cpu cpu select CPU (-cpu ? for list)
…… ……
注: 若无法执行,请按http://wiki.xilinx.com/zynq-qemu提示安装缺失的动态库。

替换官方下载的压缩包中的文件为新编译的qemu-system-arm,测试执行如下:
[walt@zynq7k zynq_linux]# ./start_qemu.sh
ram size=40000000
error reading QSPI block device
error no mtd drive for nand flash
a0mpcore_priv: smp_priv_base f8f00000
error no sd drive for sdhci controller (0)
error no sd drive for sdhci controller (1)
Number of configured NICs 0×1
ram_size 40000000, board_id d32, loader_start 0
Uncompressing Linux… done, booting the kernel.
Booting Linux on physical CPU 0
Linux version 3.3.0-14.2-build1 (relman@xcobldal824) (gcc version 4.6.1 (Sourcery CodeBench Lite 2011.09-50) ) #1 SMP PREEMPT Thu Jul 12 09:04:32 MDT 2012
CPU: ARMv7 Processor [410fc090] revision 0 (ARMv7), cr=10c5387d
CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
Machine: Xilinx Zynq Platform, model: Xilinx Zynq ZC702
bootconsole [earlycon0] enabled
Memory policy: ECC disabled, Data cache writealloc
PERCPU: Embedded 7 pages/cpu @c190b000 s5696 r8192 d14784 u32768
Built 1 zonelists in Zone order, mobility grouping on. Total pages: 255744
Kernel command line: console=ttyPS0,115200 root=/dev/ram rw initrd=0×800000,8M ip=:::::eth0:dhcp earlyprintk
PID hash table entries: 4096 (order: 2, 16384 bytes)
Dentry cache hash table entries: 131072 (order: 7, 524288 bytes)
Inode-cache hash table entries: 65536 (order: 6, 262144 bytes)
Memory: 240MB 768MB = 1008MB total
Memory: 1009280k/1009280k available, 39296k reserved, 270336K highmem
Virtual kernel memory layout:
vector : 0xffff0000 – 0xffff1000 ( 4 kB)
fixmap : 0xfff00000 – 0xfffe0000 ( 896 kB)
vmalloc : 0xf0000000 – 0xff000000 ( 240 MB)
lowmem : 0xc0000000 – 0xef800000 ( 760 MB)
pkmap : 0xbfe00000 – 0xc0000000 ( 2 MB)
modules : 0xbf000000 – 0xbfe00000 ( 14 MB)
.text : 0xc0008000 – 0xc040bdb0 (4112 kB)
.init : 0xc040c000 – 0xc0430640 ( 146 kB)
.data : 0xc0432000 – 0xc045fd20 ( 184 kB)
.bss : 0xc045fd44 – 0xc0479f5c ( 105 kB)
Preemptible hierarchical RCU implementation.
Verbose stalled-CPUs detection is disabled.
NR_IRQS:128
xlnx,ps7-ttc-1.00.a #0 at 0xf0000000, irq=43
Console: colour dummy device 80×30
Calibrating delay loop… 147.35 BogoMIPS (lpj=736768)
pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
CPU0: thread -1, cpu 0, socket 0, mpidr 80000000
smp_twd: clock not found: -2
Calibrating local timer… 84.48MHz.
hw perfevents: enabled with ARMv7 Cortex-A9 PMU driver, 1 counters available
Setting up static identity map for 0x2f3000 – 0x2f3034
CPU1: Booted secondary processor
CPU1: thread -1, cpu 1, socket 0, mpidr 80000001
Brought up 2 CPUs
SMP: Total of 2 processors activated (271.66 BogoMIPS).
devtmpfs: initialized
NET: Registered protocol family 16
L2x0 series cache controller enabled
l2x0: 8 ways, CACHE_ID 0×00000000, AUX_CTRL 0×72060000, Cache size: 524288 B
registering platform device ‘pl330′ id 0
registering platform device ‘arm-pmu’ id 0
hw-breakpoint: debug architecture 0×0 unsupported.
xslcr xslcr.0: at 0xF8000000 mapped to 0xF0008000
bio: create slab at 0
gpiochip_add: registered GPIOs 0 to 245 on device: xgpiops
xgpiops e000a000.gpio: gpio at 0xe000a000 mapped to 0xf000a000
SCSI subsystem initialized
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
Switching to clocksource xttcpss_timer1
NET: Registered protocol family 2
IP route cache hash table entries: 32768 (order: 5, 131072 bytes)
TCP established hash table entries: 131072 (order: 8, 1048576 bytes)
TCP bind hash table entries: 65536 (order: 7, 786432 bytes)
TCP: Hash tables configured (established 131072 bind 65536)
TCP reno registered
UDP hash table entries: 512 (order: 2, 16384 bytes)
UDP-Lite hash table entries: 512 (order: 2, 16384 bytes)
NET: Registered protocol family 1
RPC: Registered named UNIX socket transport module.
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
RPC: Registered tcp NFSv4.1 backchannel transport module.
Trying to unpack rootfs image as initramfs…
rootfs image is not initramfs (junk in compressed archive); looks like an initrd
Freeing initrd memory: 8192K
xscugtimer xscugtimer.0: ioremap fe00c200 to f000c200 with size 400
pl330 dev 0 probe success
highmem bounce pool size: 64 pages
JFFS2 version 2.2. (NAND) (SUMMARY) © 2001-2006 Red Hat, Inc.
msgmni has been set to 1459
io scheduler noop registered
io scheduler deadline registered
io scheduler cfq registered (default)
e0001000.uart: ttyPS0 at MMIO 0xe0001000 (irq = 82) is a xuartps
console [ttyPS0] enabled, bootconsole disabled
console [ttyPS0] enabled, bootconsole disabled
e0000000.uart: ttyPS1 at MMIO 0xe0000000 (irq = 59) is a xuartps
xdevcfg f8007000.devcfg: ioremap f8007000 to f0060000 with size 100
brd: module loaded
loop: module loaded
GEM: BASEADDRESS hw: e000b000 virt: f0062000
XEMACPS mii bus: probed
xemacps e000b000.eth: invalid address, use assigned
MAC updated d2:c4:43:31:6b:d0
eth0, pdev->id -1, baseaddr 0xe000b000, irq 54
ehci_hcd: USB 2.0 ‘Enhanced’ Host Controller (EHCI) Driver
xusbps-ehci xusbps-ehci.0: Xilinx PS USB EHCI Host Controller
xusbps-ehci xusbps-ehci.0: new USB bus registered, assigned bus number 1
xusbps-ehci xusbps-ehci.0: irq 53, io mem 0×00000000
xusbps-ehci xusbps-ehci.0: USB 2.0 started, EHCI 0.00
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 0 ports detected
Initializing USB Mass Storage driver…
usbcore: registered new interface driver usb-storage
USB Mass Storage support registered.
Xilinx PS USB Device Controller driver (Apr 01, 2011)
mousedev: PS/2 mouse device common for all mice
i2c /dev entries driver
Linux video capture interface: v2.00
gspca_main: v2.14.0 registered
uvcvideo: Unable to create debugfs directory
usbcore: registered new interface driver uvcvideo
USB Video Class driver (1.1.1)
WDT OF probe
xwdtps f8005000.swdt: Xilinx Watchdog Timer at 0xf0066000 with timeout 10 seconds
sdhci: Secure Digital Host Controller Interface driver
sdhci: Copyright(c) Pierre Ossman
sdhci-pltfm: SDHCI platform and OF driver helper
mmc0: SDHCI controller on e0100000.sdhci [e0100000.sdhci] using ADMA
usbcore: registered new interface driver usbhid
usbhid: USB HID core driver
TCP cubic registered
NET: Registered protocol family 17
VFP support v0.3: implementor 41 architecture 3 part 40 variant 0 rev 0
Registering SWP/SWPB emulation handler
drivers/rtc/hctosys.c: unable to open rtc device (rtc0)
GEM: lp->tx_bd ffdfb000 lp->tx_bd_dma 2f2b2000 lp->tx_skb ee9199c0
GEM: lp->rx_bd ffdfc000 lp->rx_bd_dma 2f2b1000 lp->rx_skb ee9198c0
GEM: MAC 0x3143c4d2, 0x0000d06b, d2:c4:43:31:6b:d0
GEM: phydev ee90ec00, phydev->phy_id 0x1410cc2, phydev->addr 0×17
eth0, phy_addr 0×17, phy_id 0x01410cc2
eth0, attach [Marvell 88E1111] phy driver
Sending DHCP requests ., OK
IP-Config: Got DHCP answer from 10.0.2.2, my address is 10.0.2.15
IP-Config: Complete:
device=eth0, addr=10.0.2.15, mask=255.255.255.0, gw=10.0.2.2,
host=10.0.2.15, domain=, nis-domain=(none),
bootserver=10.0.2.2, rootserver=10.0.2.2, rootpath=
RAMDISK: ext2 filesystem found at block 0
RAMDISK: Loading 8192KiB [1 disk] into ram disk… done.
VFS: Mounted root (ext2 filesystem) on device 1:0.
devtmpfs: mounted
Freeing init memory: 144K
Starting rcS…
++ Mounting filesystem
++ Setting up mdev
eth0: link up (1000/FULL)
++ Starting telnet daemon
++ Starting http daemon
++ Starting ftp daemon
++ Starting dropbear (ssh) daemon
rcS Complete
zynq> uname -v
#1 SMP PREEMPT Thu Jul 12 09:04:32 MDT 2012
zynq> df
Filesystem 1K-blocks Used Available Use% Mounted on
none 508808 0 508808 0% /tmp
zynq>
但使用标准流程编译的zynq7000,则会失败,应该是检测了外部钟,还需要再检查下,提示如下:
[root@zynq7k zynq_linux]# ./start_qemu.sh
ram size=40000000
error reading QSPI block device
error no mtd drive for nand flash
a0mpcore_priv: smp_priv_base f8f00000
error no sd drive for sdhci controller (0)
error no sd drive for sdhci controller (1)
Number of configured NICs 0×1
ram_size 40000000, board_id d32, loader_start 0
Uncompressing Linux… done, booting the kernel.
Booting Linux on physical CPU 0
Linux version 3.5.0-14.3-build2walt (gnssinfo@zynq7k) (gcc version 4.6.1 (Sourcery CodeBench Lite 2011.09-50) ) #1 SMP PREEMPT Fri Nov 2 10:27:55 CST 2012
CPU: ARMv7 Processor [410fc090] revision 0 (ARMv7), cr=10c5387d
CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
Machine: Xilinx Zynq Platform
bootconsole [earlycon0] enabled
cma: CMA: reserved 16 MiB at 2e800000
Memory policy: ECC disabled, Data cache writealloc
PERCPU: Embedded 7 pages/cpu @c2109000 s6784 r8192 d13696 u32768
Built 1 zonelists in Zone order, mobility grouping on. Total pages: 259840
Kernel command line: console=ttyPS0,115200n8 root=/dev/ram rw initrd=0×00800000,16M earlyprintk mtdparts=physmap-flash.0:512K(nor-fsbl),512K(nor-u-boot),5M(nor-linux),9M(nor-user),1M(nor-scratch),-(nor-rootfs)
PID hash table entries: 4096 (order: 2, 16384 bytes)
Dentry cache hash table entries: 131072 (order: 7, 524288 bytes)
Inode-cache hash table entries: 65536 (order: 6, 262144 bytes)
Memory: 1024MB = 1024MB total
Memory: 1000396k/1000396k available, 48180k reserved, 270336K highmem
Virtual kernel memory layout:
vector : 0xffff0000 – 0xffff1000 ( 4 kB)
fixmap : 0xfff00000 – 0xfffe0000 ( 896 kB)
vmalloc : 0xf0000000 – 0xff000000 ( 240 MB)
lowmem : 0xc0000000 – 0xef800000 ( 760 MB)
pkmap : 0xbfe00000 – 0xc0000000 ( 2 MB)
modules : 0xbf000000 – 0xbfe00000 ( 14 MB)
.text : 0xc0008000 – 0xc048e060 (4633 kB)
.init : 0xc048f000 – 0xc04b4a80 ( 151 kB)
.data : 0xc04b6000 – 0xc04f3c20 ( 248 kB)
.bss : 0xc04f3c44 – 0xc051f104 ( 174 kB)
Preemptible hierarchical RCU implementation.
Dump stacks of tasks blocking RCU-preempt GP.
NR_IRQS:128
Zynq clock init
Xilinx, no compatible timer found, using default
xlnx,ps7-ttc-1.00.a #0 at 0xf0000000, irq=43
————[ cut here ]————
WARNING: at arch/arm/kernel/smp_twd.c:345 time_init+0×20/0×30()
twd_local_timer_of_register failed (-19)
Modules linked in:
[] (unwind_backtrace+0×0/0x11c) from [] (warn_slowpath_common+0x4c/0×64)
[] (warn_slowpath_common+0x4c/0×64) from [] (warn_slowpath_fmt+0x2c/0x3c)
[] (warn_slowpath_fmt+0x2c/0x3c) from [] (time_init+0×20/0×30)
[] (time_init+0×20/0×30) from [] (start_kernel+0x1ac/0×300)
[] (start_kernel+0x1ac/0×300) from [<00008040>] (0×8040)
—[ end trace 1b75b31a2719ed1c ]—
sched_clock: 32 bits at 100 Hz, resolution 10000000ns, wraps every 4294967286ms
Console: colour dummy device 80×30
Calibrating delay loop…