如何深入理解和应用zynq的fsbl文件

如何深入理解和应用zynq的fsbl文件,第1张

fsbl是zynq开发中fsnq-7000

ap

soc启动中用户自厅轮定义的一弊友些初始化代码,用来选择初始化sd卡读写、以太网接口这样的外设。在sdk

for

vivado的2013版本中,在已经生成了bsp的情租伏槐况下,可以直接新建fsbl工程并自动选择生成启动映像!

第 9 章 ZedBoard 入门

前面大家已经对 ZYNQ 架构以及相应的开发工具有一定的认识,接下来我们将带领大家来一起 体验 ZYNQ,体验软硬件协同设计的魅力。由于时间的关系,袭迟下面的一些实验(本章及后续章节的实验) 可能有不完善的地方,欢迎读者向我们反馈。 9.1 跑马灯 本实验将指导大家使用 Vivado 集成设计环境创建本书的第一个 Zynq 设计。这里,我们使用跑马灯 这个入门实验来向大家介绍 Vivado IDE 的 IP Integrator 环境,并在 Zedboard 上实现这个简单的 Zynq 嵌 入式系统。之后,我们将会使用 SDK 创建一个简单的软件应用程序,并下载到 Zynq 的 ARM 处理器中, 对在 PL 端实现的硬件进行控制。本实验分为三个小节来向大家进行介绍: ? 第一节我们将使用 Vivado IDE 创建一个工程。 ? 在第一节的基础上,第二节我们将继续构建一个 Zynq 嵌入式处理系统,并将完成后的硬件导入 到 SDK 中进行软件设计。 ? 最后一节我们将使用 SDK 编写 ARM 测试应用程序, 并下载到 ZedBoard 上进行调试。 实验环境:Windows 7 x64 *** 作系统, Vivado2013.4,SDK 2013.4

9.1.1 Vivado 工程创建

1) 双击桌面 Vivado 快捷方式 ,或者浏览 Start >All Programes >Xilinx Design Tools >Vivado

2013.4 >Vivado 2013.4 来启动 Vivado. 2) 当拍睁李 Vivado 启动后,可以看到图 9-1 的 Getting Started 页面。

图 9- 1 Vivado 开始界面

3) 选择 Create New Project 选项,图 9-2 所示的 New Project 向导将会打开,点击 Next。

图 9- 2 New Project 对话框 4) 在 Project Name 对话框中,输入 first_zynq_design 作为 Project name, 选择 C:/XUP/Zed 作为 Project location,确保 Create project subdirectory 被勾选上,如图 9-3,点击 Next。

图 9- 3 Project Name 对话框 5) 在 Project Type 对话框中,选择 RTL Project,确保 Do not specify sources at this time 选项没有 被勾选,如图 9-4,点击 Next。

图 9- 4 Project Type 对话框 6) 在 Add Source 对话框中, 选择 Verilog 作为目标语言,如果你对 VHDL 熟悉的话, 你也可以 选择 VHDL,如果这里你忘记了选择,在工程创建完成后,也可以在工程设置中选择你熟悉的 HDL 语言。如果你已经有了源文件,在这里就可以选择 Add file 或者 Add directory 进行添加, 由于我们没有任何的源文件, 所以这里我们直接点击 Next 即可,如图 9-5。

图 9- 5 添加源文件 7) 在 Add Existing IP 对话框中,点击 Next。 8) 在 Add Constraints 对话框中,点击 Next。 9) 在 Default Part 对话框中,在 Specify 框中选择 Boards 选项,在下面的 Board 列表中选择 ZedBoard Zynq Evaluation and Development Kit,点击 Next,如图 9-6。

图 9- 6 芯片选择 10) 在 New Project Summary 对话框中,点解 Finish 完成工程创建,至此,我们已经使用 Vivado 创建了一个 Zynq 设计的工程框架,图 9-7 为 Vivado 的工程界面,在第四章我们已经对该界面 进行过介绍,如果还不熟悉的读者再回到前面复习一下。下面我将使用 Flow Navigator 的 IP Integrator 功能完成第二节的嵌入式早卖系统设计。

图 9- 7 Vivado 工程界面

9.1.2 在 Vivado 中创建 Zynq 嵌入式系统 这一节我们将创建一个简单的 Zynq 嵌入式系统,该系统使用 Zynq PL 部分实现一个通用 I/O 控制 器 (GPIO),控制器同 ZedBoard 上的 8 个 LED 相连接,并且通过 AXI 总线连接到 PS 端,这样我们就可 以通过将要在第三小节中实现的 ARM 应用程序来对 LED 进行控制。系统结构图如图 9-8 所示。

官网提供的可执行文件是基于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>


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/yw/8268187.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-04-14
下一篇 2023-04-14

发表评论

登录后才能评论

评论列表(0条)

保存