当前位置:首页 » 编程软件 » zynqbuild编译优化

zynqbuild编译优化

发布时间: 2022-04-17 17:59:23

㈠ 没硬件怎么玩zynq7000

官网提供的可执行文件是基于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)
moles : 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 mmy 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 mole.
RPC: Registered udp transport mole.
RPC: Registered tcp transport mole.
RPC: Registered tcp NFSv4.1 backchannel transport mole.
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 scheler noop registered
io scheler deadline registered
io scheler 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: mole loaded
loop: mole 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的功耗

Zynq系列是赛灵思公司(Xilinx)推出的行业第一个可扩展处理平台,旨在为视频监视、汽车驾驶员辅助以及工厂自动化等高端嵌入式应用提供所需的处理与计算性能水平。该系列四款新型器件得到了工具和IP 提供商生态系统的支持,将完整的 ARM® Cortex™-A9 MPCore 处理器片上系统 (SoC) 与 28nm 低功耗可编程逻辑紧密集成在一起,可以帮助系统架构师和嵌入式软件开发人员扩展、定制、优化系统,并实现系统级的差异化。
实际上,Zynq就是两大功能块:双核Arm的SoC和FPGA。根据Xilinx提供的手册,PS: 处理系统 (Processing System) , 就是与FPGA无关的ARM的SOC的部分。PL: 可编程逻辑 (Progarmmable Logic), 就是FPGA部分。这有点像xilinx以前推出的powerPC+FPGA平台。下图为官方文档中介绍的ZYNQ内部结构。

从图中可以看到,ZYNQ的绝大多数外设都是PL逻辑部分相连,比如说GPIO,IIS,XADC等等,所以如果我们要使用这些外设的话必须在PL逻辑部分对其进行配置。OK,下面我们就以一个简单的例子来看看如何使用PL和PS进行交互。在下面的例子中,我们通过设置8个开关来对应点亮8个LED灯。
首先打开XPS,由于XILINX内部已经帮我们做好了GPIO部分的IP核,所以我们只需要直接使用即可(如果要用自己的ip核,则可以使用ISE先把IP核写好再导入进来)。新建立一个工程,选择“Create New Project Using Base System Builder”,

填好项目工程文件的路径,其它不需要更改,直接点OK
由于我们用的就是ZEDBOARD,所以在这里我们选择的是ZYNQ开发板,直接点击NEXT,

该界面表示当前工程里已经默认把GPIO和4位的led包含进去了,由于我们这里和光放的ZYNQ开发板还有点差别,所以就不需要这些默认设置了,直接选中点击REMOVE,最后点击FINISH完成工程的建立。

双击图中所示的AXI General Purpose IO,添加该IP核到ZYNQ中,注意在Width中选择8,表示当前的GPIO的宽度为8,当然如果你需要更宽也可以进行其它设置,但最多不能超过32 位。我们这里的SW开关和LED都为8个,所以我们把宽度设置为8.一路点击OK按钮,把该IP核加入到工程中。

由于我们有SW开关和LED两个外设并且一个为输入一个为输出,所以还需要按照同样的方法再添加一个GPIO核。完成添加后看右边的BUS INTERFACES,可以看到GPIO 0和GPIO1均添加到了系统中。


点击PORT栏,进入到端口设置部分,在这里我们把一个GPIO设置为输出,它与8个LED灯相连,另外一个设置为输入,它与8个SW开关相连。完成设置后的结果如下图所示

下面就是编辑约束文件,给定义的端口分配管脚了,

双击project栏中的UCF,打开约束编辑(在这里有个问题,难道ISE14.2中没有专门的约束编辑器吗?),输入以下内容

上面表示8个LED等,下面表示8个SW按键,注意,在DS中,8个SW按键是连接到VCC_ADJ上的,所以我们这里使用LVCMOS18电平标准。完成这些设置后,依次点击Generate BitStream和Export Design按钮,完成流配置文件的生成和导出到SDK中。


上面就是PL部分的配置了,下面我们就根据PL的配置来进行PS部分的编程。打开SDK工具,新建工程(具体如何新建可以参考ZedBoard_CTT_v14.1文档,该文档在ZEDBOARD.org网站上有下载)后更改其中的main函数为以下形式

点击编译,成功生成ELF文件后即可进行下载,当然在下载ELF文件前还要先把FPGA的配置下载进去。
总结一下,zynq虽然是一个新的东西,但它的基本开发流程和开发原理和xilinx以往的产品基本一样,ISE,XPS,SDK等等的使用方法也基本相同,所不同的是,ZYNQ系列中包含了两个ARM核,极大的提高了系统的性能。

㈢ 如何利用Zynq-7000的PL和PS进行交互

在Zynq-7000上编程PL大致有3种方法:
1. 用FSBL,将bitstream集成到boot.bin中
2. 用U-BOOT命令
3. 在Linux下用xdevcfg驱动。

步骤:
1. 去掉bitstream的文件头

用FSBL烧写PL Images没有什么好说的,用Xilinx SDK的Create Boot Image工具即可完成,不再赘述。用后两种方法需要把bitstream文件的文件头用bootgen工具去掉。

一个典型的bif文件如下所示:
the_ROM_image:
{
[bootloader]<fsbl_name>.elf
<pl_bitstream_name>.bit
<u-boot_name>.elf
}
bif文件可以用文本编辑器写,也可以用Xilinx SDK的Create Boot Image工具生成。然后在命令行下用以下命令即可去掉bitstream文件的文件头。
bootgen -image <bootimage>.bif -split bin -o i BOOT.BIN
"-split”参数可以生成以下文件:
<pl_bitstream_name>.bit.bin

2. 在U-BOOT下烧写PL Image
命令”fpga load”和”fpga loadb”都可以。区别是前一个命令接受去掉了文件头的bitstream文件,后一个命令接受含有文件头的bitstream文件。

在OSL 2014.2上,缺省编译就可以完整支持写入PL Image的功能。但是在Petalinux 2013.10下,尽管可以在U-BOOT下看到命令”fpga”,还需要在文件
<PROJ>/subsystems/linux/configs/u-boot/platform-top.h 中增加以下内容后重新编译才可以支持具体的功能。

/* Enable the PL to be downloaded */
#define CONFIG_FPGA
#define CONFIG_FPGA_XILINX
#define CONFIG_FPGA_ZYNQPL
#define CONFIG_CMD_FPGA
#define CONFIG_FPGA_LOADFS

在OSL 2014.2 U-BOOT中,具体的功能是在zynqpl.c的zynq_load()中实现的。

3. 在Linux下烧写PL Image
OSL Linux 2014.2.01中已经含有xdevcfg驱动了(之前就有,不过本文是在这个版本上验证的),直接用以下命令就可以完成PL Image写入。
cat <path_to_storage_media>/<pl_bitstream_name>.bit.bin > /dev/xdevcfg

Linux驱动的源代码在xilinx_devcfg.c中。因为驱动的编号是通过alloc_chrdev_region()动态分配的,所以不需要手工用mknod命令手动建立设备节点。

在Linux驱动中,每次往DevCfg中写入4096字节,直到全部写完。

4. 在用户程序中烧写PL Image

目前没有现成的源码来完成这个功能,不过可以用mmap()把DevCfg的寄存器映射到用户程序的虚地址中,然后参考一些现成的软件代码来完成这个功能:
* FSBL中的pcap.c
* U-BOOT中的zynqpl.c
* Linux中的xilinx_devcfg.c
* Xilinx SDK中的例子。例子位于以下位置,随SDK的版本会有变化。
C:\Xilinx\SDK\2014.1\data\embeddedsw\XilinxProcessorIPLib\drivers\devcfg_v3_0\examples\index.html

小结:
DevCfg外设内部有自己的DMA,只需要简单的配置PL Image的基地址和长度到DevCfg寄存器,就可以完成Zynq-7000 PL Image的加载。Xilinx已经提供了灵活的解决方案,如果开发者要把这个功能集成在自己的应用程序中,也有很多的代码可以参考,并不是很困难的任务。

热点内容
pythonwindowsweb 发布:2024-04-28 16:10:29 浏览:542
王牌竞速如何找到最开始的服务器 发布:2024-04-28 14:53:09 浏览:403
airpod安卓怎么切换下一曲 发布:2024-04-28 14:23:03 浏览:835
百姓网源码 发布:2024-04-28 14:18:56 浏览:893
war包防止反编译 发布:2024-04-28 14:17:16 浏览:328
linuxll命令 发布:2024-04-28 14:16:27 浏览:860
阿里云服务器增强安全配置取消 发布:2024-04-28 14:16:12 浏览:867
war3存储空间不足 发布:2024-04-28 13:20:54 浏览:949
微信密码已经忘记了如何找回 发布:2024-04-28 11:54:13 浏览:306
腾讯云服务器可以备案几个网站 发布:2024-04-28 11:54:12 浏览:458