FC2カウンター FPGAの部屋 ZYBO Z7-20 用のVitis アクセラレーション・プラットフォームを作成した
fc2ブログ

FPGAやCPLDの話題やFPGA用のツールの話題などです。 マニアックです。 日記も書きます。

FPGAの部屋

FPGAの部屋の有用と思われるコンテンツのまとめサイトを作りました。Xilinx ISEの初心者の方には、FPGAリテラシーおよびチュートリアルのページをお勧めいたします。

ZYBO Z7-20 用のVitis アクセラレーション・プラットフォームを作成した

フィクスターズさんのブログでも紹介されているが、私もZYBO Z7-20 の Vitis アクセラレーション・プラットフォームを作成した。

フィクスターズさんのブログは、”Zybo+VitisでSDSoC相当の高位合成やってみた”で、私のやっていないVitis GUI でのアクセラレーション・プラットフォームを使ったアプリケーション・プロジェクトを作成して実験しているので、あとでやってみたいと思う。今回は、ZYBO Z7-20 のVitis アクセラレーション・プラットフォームについて紹介する。

最初にVivado のハードウェア・プラットフォームを紹介する。プロジェクト名は zybo_z7_20_min とした。
VitisP_ZYBO_Z7_20_1_191126.png

zybo_z7_20_min ブロックデザインを示す。
VitisP_ZYBO_Z7_20_2_191126.png

Clock Wizard のクロックの設定を示す。
VitisP_ZYBO_Z7_20_4_191126.png

clk_out3 の 100 MHz クロックをデフォルトとして、id = 0 に設定してある。

Platform の設定を示す。これだけのポート、クロック、IRQ をイネーブルしてある。IRQ は使わないのかも知れない?
VitisP_ZYBO_Z7_20_3_191126.png

zybo_z7_20_min.xsa ファイルを出力している。
VitisP_ZYBO_Z7_20_5_191126.png

PetaLinux のビルドは Ultra96-V2 とほとんど同じ方法でビルドした。ただし、linux.bif や system-user.dtsi の記述はZYBO Z7-20 用に変更している。これは後で詳しく書きたい。

ZYBO Z7-20 のVitis アクセラレーション・プラットフォームの zybo_z7_20_min を置いたので、試して欲しい。
zybo_z7_20_min を試すための Root File System の cortexa9t2hf-neon-xilinx-linux-gnueabi を置いておいた。
どちらも無保証なので、自分の責任で使って欲しい。

使い方を示す。
ダウンロードした ZYBO Z7-20 用 Vitis アクセラレーション・プラットフォーム(zybo_z7_20_min.zip)を解凍する。
解凍したzybo_z7_20_min ディレクトリをVitis インストール・ディレクトリの Vitis/2019.2/platforms に移動する。
VitisP_ZYBO_Z7_20_6_191126.png

Vitis と XRT と PetaLinux(これは要らないかも知れないが。。。)の環境を設定する。つまり各ツールのインストール・フォルダの settings**.sh (XRT は setup.sh だった。確か)を source コマンドで起動する。
そう、つまりこの 3 点セットをインストールする必要がある。私はAlveo U200 のXRT を使用している。

適当なディレクトリに Xilinx/Vitis_Accel_Examples の hello_world サンプルを git clone する。
git clone https://github.com/Xilinx/Vitis_Accel_Examples.git

Vitis_Accel_Examples/hello_world/ に入って、make する。
cd Vitis_Accel_Examples/hello_world/
make all TARGET=hw DEVICE=zybo_z7_20_min HOST_ARCH=aarch32 SYSROOT=Vitis/platfoms の絶対パス/zybo_z7_20_min/sw/zybo_z7_20_min/linux_domain/sysroot/cortexa9t2hf-neon-xilinx-linux-gnueabi/


cp のエラーで止まってしまう。
VitisP_ZYBO_Z7_20_8_191127.png

hello_world ディレクトリの Makefile の cp の行をコメントアウトする。
VitisP_ZYBO_Z7_20_9_191127.png

もう一度 make する。
make all TARGET=hw DEVICE=zybo_z7_20_min HOST_ARCH=aarch32 SYSROOT=Vitis/platfoms の絶対パス/zybo_z7_20_min/sw/zybo_z7_20_min/linux_domain/sysroot/cortexa9t2hf-neon-xilinx-linux-gnueabi/
VitisP_ZYBO_Z7_20_10_191127.png

hello_world/build_dir.hw.zybo_z7_20_min/sd_card ディレクトリの image.ub をコピーする。
VitisP_ZYBO_Z7_20_11_191127.png

hello_world/sd_card ディレクトリにペーストした。
VitisP_ZYBO_Z7_20_12_191127.png

hello_world/sd_card ディレクトリの内容をMicroSD カードの第1パーティションに書き込む。

ダウンロードした cortexa9t2hf-neon-xilinx-linux-gnueabi.zip を展開して、 Micro SD カードの第2パーティションに書き込む。(注:Vitis アクセレーション・プラットフォーム内の cortexa9t2hf-neon-xilinx-linux-gnueabi ディレクトリの内容を書き込むとLinux がブートしないようです。必ずダウンロードして展開した cortexa9t2hf-neon-xilinx-linux-gnueabi の内容を書き込む必要があるようです)
VitisP_ZYBO_Z7_20_13_191127.png

Micro SDカードをZYBO Z7-20 に挿入して、電源ON するとLinux が起動するはず。
下の画面はgtkterm の画面で、ZYBO Z7-20 とシリアル接続しています。
root ノーパスでログインした。
VitisP_ZYBO_Z7_20_14_191127.png

zocl ドライバを insmod でロードした。
insmod /lib/modules/4.19.0-xilinx-v2019.2/extra/zocl.ko
VitisP_ZYBO_Z7_21_14_191127.png

次に第1パーティションに行って、hello_world サンプルを実行した。
cd /run/media/mmcblk0p1/
export XILINX_XRT=/usr
./init.sh

VitisP_ZYBO_Z7_21_15_191127.png

Device[0]: program successful!
TEST PASSED


と表示されているはずだ。

最後にリブートから hello_world サンプルを実行するまでの表示を貼っておく。

U-Boot 2019.01 (Nov 25 2019 - 04:39:59 +0000) Xilinx Zynq ZC702

CPU:   Zynq 7z020
Silicon: v3.1
DRAM:  ECC disabled 1 GiB
MMC:   mmc@e0100000: 0
Loading Environment from SPI Flash... SF: Detected s25fl128s_64k with page size 256 Bytes, erase size 64 KiB, total 16 MiB
*** Warning - bad CRC, using default environment

In:    serial@e0001000
Out:   serial@e0001000
Err:   serial@e0001000
Net:   ZYNQ GEM: e000b000, phyaddr ffffffff, interface rgmii-id
eth0: ethernet@e000b000
U-BOOT for zybo_z7_20_min

ethernet@e000b000 Waiting for PHY auto negotiation to complete......... TIMEOUT !
Hit any key to stop autoboot:  0 
Device: mmc@e0100000
Manufacturer ID: 9f
OEM: 5449
Name: SPCCBus Speed: 25000000
Mode : SD Legacy
Rd Block Len: 512
SD version 3.0
High Capacity: Yes
Capacity: 14.6 GiB
Bus Width: 4-bit
Erase Group Size: 512 Bytes
4124340 bytes read in 360 ms (10.9 MiB/s)
## Loading kernel from FIT Image at 10000000 ...
   Using 'conf@system-top.dtb' configuration
   Verifying Hash Integrity ... OK
   Trying 'kernel@1' kernel subimage
     Description:  Linux kernel
     Type:         Kernel Image
     Compression:  uncompressed
     Data Start:   0x100000f4
     Data Size:    4108384 Bytes = 3.9 MiB
     Architecture: ARM
     OS:           Linux
     Load Address: 0x00008000
     Entry Point:  0x00008000
     Hash algo:    sha1
     Hash value:   4be0ff978b7eac351ee07468445ce106499d57b3
   Verifying Hash Integrity ... sha1+ OK
## Loading fdt from FIT Image at 10000000 ...
   Using 'conf@system-top.dtb' configuration
   Verifying Hash Integrity ... OK
   Trying 'fdt@system-top.dtb' fdt subimage
     Description:  Flattened Device Tree blob
     Type:         Flat Device Tree
     Compression:  uncompressed
     Data Start:   0x103eb254
     Data Size:    14061 Bytes = 13.7 KiB
     Architecture: ARM
     Hash algo:    sha1
     Hash value:   a12b86da0bc898497d48a5922cc1004d39ccb195
   Verifying Hash Integrity ... sha1+ OK
   Booting using the fdt blob at 0x103eb254
   Loading Kernel Image ... OK
   Loading Device Tree to 07ff9000, end 07fff6ec ... OK

Starting kernel ...

Booting Linux on physical CPU 0x0
Linux version 4.19.0-xilinx-v2019.2 (oe-user@oe-host) (gcc version 8.2.0 (GCC)) #1 SMP PREEMPT Mon Nov 25 04:37:41 UTC 2019
CPU: ARMv7 Processor [413fc090] revision 0 (ARMv7), cr=18c5387d
CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
OF: fdt: Machine model: xlnx,zynq-7000
earlycon: cdns0 at MMIO 0xe0001000 (options '115200n8')
bootconsole [cdns0] enabled
Memory policy: Data cache writealloc
cma: Reserved 256 MiB at 0x30000000
random: get_random_bytes called from start_kernel+0x80/0x3c4 with crng_init=0
percpu: Embedded 16 pages/cpu @(ptrval) s34956 r8192 d22388 u65536
Built 1 zonelists, mobility grouping on.  Total pages: 260608
Kernel command line: console=ttyPS0,115200 earlycon root=/dev/mmcblk0p2 rw rootwait
Dentry cache hash table entries: 131072 (order: 7, 524288 bytes)
Inode-cache hash table entries: 65536 (order: 6, 262144 bytes)
Memory: 767092K/1048576K available (6144K kernel code, 202K rwdata, 1596K rodata, 1024K init, 246K bss, 19340K reserved, 262144K cma-reserved, 0K highmem)
Virtual kernel memory layout:
    vector  : 0xffff0000 - 0xffff1000   (   4 kB)
    fixmap  : 0xffc00000 - 0xfff00000   (3072 kB)
    vmalloc : 0xf0800000 - 0xff800000   ( 240 MB)
    lowmem  : 0xc0000000 - 0xf0000000   ( 768 MB)
    pkmap   : 0xbfe00000 - 0xc0000000   (   2 MB)
    modules : 0xbf000000 - 0xbfe00000   (  14 MB)
      .text : 0x(ptrval) - 0x(ptrval)   (7136 kB)
      .init : 0x(ptrval) - 0x(ptrval)   (1024 kB)
      .data : 0x(ptrval) - 0x(ptrval)   ( 203 kB)
       .bss : 0x(ptrval) - 0x(ptrval)   ( 247 kB)
rcu: Preemptible hierarchical RCU implementation.
rcu:  RCU restricting CPUs from NR_CPUS=4 to nr_cpu_ids=2.
 Tasks RCU enabled.
rcu: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=2
NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
efuse mapped to (ptrval)
slcr mapped to (ptrval)
L2C: platform modifies aux control register: 0x72360000 -> 0x72760000
L2C: DT/platform modifies aux control register: 0x72360000 -> 0x72760000
L2C-310 erratum 769419 enabled
L2C-310 enabling early BRESP for Cortex-A9
L2C-310 full line of zeros enabled for Cortex-A9
L2C-310 ID prefetch enabled, offset 1 lines
L2C-310 dynamic clock gating enabled, standby mode enabled
L2C-310 cache controller enabled, 8 ways, 512 kB
L2C-310: CACHE_ID 0x410000c8, AUX_CTRL 0x76760001
zynq_clock_init: clkc starts at (ptrval)
Zynq clock init
sched_clock: 64 bits at 333MHz, resolution 3ns, wraps every 4398046511103ns
clocksource: arm_global_timer: mask: 0xffffffffffffffff max_cycles: 0x4ce07af025, max_idle_ns: 440795209040 ns
Switching to timer-based delay loop, resolution 3ns
clocksource: ttc_clocksource: mask: 0xffff max_cycles: 0xffff, max_idle_ns: 537538477 ns
timer #0 at (ptrval), irq=17
Console: colour dummy device 80x30
Calibrating delay loop (skipped), value calculated using timer frequency.. 666.66 BogoMIPS (lpj=3333333)
pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 2048 (order: 1, 8192 bytes)
Mountpoint-cache hash table entries: 2048 (order: 1, 8192 bytes)
CPU: Testing write buffer coherency: ok
CPU0: Spectre v2: using BPIALL workaround
CPU0: thread -1, cpu 0, socket 0, mpidr 80000000
Setting up static identity map for 0x100000 - 0x100060
rcu: Hierarchical SRCU implementation.
smp: Bringing up secondary CPUs ...
CPU1: thread -1, cpu 1, socket 0, mpidr 80000001
CPU1: Spectre v2: using BPIALL workaround
smp: Brought up 1 node, 2 CPUs
SMP: Total of 2 processors activated (1333.33 BogoMIPS).
CPU: All CPU(s) started in SVC mode.
devtmpfs: initialized
VFP support v0.3: implementor 41 architecture 3 part 30 variant 9 rev 4
clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
futex hash table entries: 512 (order: 3, 32768 bytes)
pinctrl core: initialized pinctrl subsystem
NET: Registered protocol family 16
DMA: preallocated 256 KiB pool for atomic coherent allocations
hw-breakpoint: found 5 (+1 reserved) breakpoint and 1 watchpoint registers.
hw-breakpoint: maximum watchpoint size is 4 bytes.
zynq-ocm f800c000.ocmc: ZYNQ OCM pool: 256 KiB @ 0x(ptrval)
zynq-pinctrl 700.pinctrl: zynq pinctrl initialized
e0001000.serial: ttyPS0 at MMIO 0xe0001000 (irq = 25, base_baud = 6249999) is a xuartps
console [ttyPS0] enabled
console [ttyPS0] enabled
bootconsole [cdns0] disabled
bootconsole [cdns0] disabled
vgaarb: loaded
SCSI subsystem initialized
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
media: Linux media interface: v0.10
videodev: Linux video capture interface: v2.00
pps_core: LinuxPPS API ver. 1 registered
pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
PTP clock support registered
EDAC MC: Ver: 3.0.0
FPGA manager framework
Advanced Linux Sound Architecture Driver Initialized.
clocksource: Switched to clocksource arm_global_timer
NET: Registered protocol family 2
tcp_listen_portaddr_hash hash table entries: 512 (order: 0, 6144 bytes)
TCP established hash table entries: 8192 (order: 3, 32768 bytes)
TCP bind hash table entries: 8192 (order: 4, 65536 bytes)
TCP: Hash tables configured (established 8192 bind 8192)
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.
hw perfevents: no interrupt-affinity property for /pmu@f8891000, guessing.
hw perfevents: enabled with armv7_cortex_a9 PMU driver, 7 counters available
workingset: timestamp_bits=30 max_order=18 bucket_order=0
jffs2: version 2.2. (NAND) (SUMMARY)  © 2001-2006 Red Hat, Inc.
bounce: pool size: 64 pages
io scheduler noop registered
io scheduler deadline registered
io scheduler cfq registered (default)
io scheduler mq-deadline registered
io scheduler kyber registered
dma-pl330 f8003000.dmac: Loaded driver for PL330 DMAC-241330
dma-pl330 f8003000.dmac:  DBUFF-128x8bytes Num_Chans-8 Num_Peri-4 Num_Events-16
brd: module loaded
loop: module loaded
m25p80 spi0.0: found s25fl128s, expected n25q512a
m25p80 spi0.0: s25fl128s (16384 Kbytes)
4 fixed-partitions partitions found on MTD device spi0.0
Creating 4 MTD partitions on "spi0.0":
0x000000000000-0x000000500000 : "boot"
0x000000500000-0x000000520000 : "bootenv"
0x000000520000-0x000000fa0000 : "kernel"
0x000000fa0000-0x000001000000 : "spare"
libphy: Fixed MDIO Bus: probed
CAN device driver interface
libphy: MACB_mii_bus: probed
RTL8211E Gigabit Ethernet e000b000.ethernet-ffffffff:00: attached PHY driver [RTL8211E Gigabit Ethernet] (mii_bus:phy_addr=e000b000.ethernet-ffffffff:00, irq=POLL)
macb e000b000.ethernet eth0: Cadence GEM rev 0x00020118 at 0xe000b000 irq 27 (00:0a:35:00:1e:53)
e1000e: Intel(R) PRO/1000 Network Driver - 3.2.6-k
e1000e: Copyright(c) 1999 - 2015 Intel Corporation.
ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
ehci-pci: EHCI PCI platform driver
usbcore: registered new interface driver usb-storage
i2c /dev entries driver
cdns-wdt f8005000.watchdog: Xilinx Watchdog Timer with timeout 10s
EDAC MC: ECC not enabled
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.mmc [e0100000.mmc] using ADMA
ledtrig-cpu: registered to indicate activity on CPUs
usbcore: registered new interface driver usbhid
usbhid: USB HID core driver
xlnk xlnk: Major 244
xlnk xlnk: xlnk driver loaded
xlnk xlnk: xlnk_pdev is not null
fpga_manager fpga0: Xilinx Zynq FPGA Manager registered
NET: Registered protocol family 10
Segment Routing with IPv6
sit: IPv6, IPv4 and MPLS over IPv4 tunneling driver
NET: Registered protocol family 17
can: controller area network core (rev 20170425 abi 9)
NET: Registered protocol family 29
can: raw protocol (rev 20170425)
can: broadcast manager protocol (rev 20170425 t)
can: netlink gateway (rev 20170425) max_hops=1
Registering SWP/SWPB emulation handler
of-fpga-region fpga-full: FPGA Region probed
hctosys: unable to open rtc device (rtc0)
of_cfs_init
of_cfs_init: OK
ALSA device list:
  No soundcards found.
Waiting for root device /dev/mmcblk0p2...
mmc0: Problem switching card into high-speed mode!
mmc0: new SDHC card at address 0001
mmcblk0: mmc0:0001 SPCC 14.6 GiB 
 mmcblk0: p1 p2
EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Opts: (null)
VFS: Mounted root (ext4 filesystem) on device 179:2.
devtmpfs: mounted
Freeing unused kernel memory: 1024K
Run /sbin/init as init process
INIT: version 2.88 booting
random: fast init done
Starting udev
udevd[732]: starting version 3.2.5
random: udevd: uninitialized urandom read (16 bytes read)
random: udevd: uninitialized urandom read (16 bytes read)
random: udevd: uninitialized urandom read (16 bytes read)
udevd[733]: starting eudev-3.2.5
FAT-fs (mmcblk0p1): Volume was not properly unmounted. Some data may be corrupt. Please run fsck.
EXT4-fs (mmcblk0p2): re-mounted. Opts: (null)
hwclock: can't open '/dev/misc/rtc': No such file or directory
Thu Jan  1 00:19:28 UTC 1970
hwclock: can't open '/dev/misc/rtc': No such file or directory
urandom_read: 2 callbacks suppressed
random: dd: uninitialized urandom read (512 bytes read)
INIT: Entering runlevel: 5
Configuring network interfaces... IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
udhcpc: started, v1.29.2
udhcpc: sending discover
udhcpc: sending discover
udhcpc: sending discover
udhcpc: no lease, forking to background
done.
Starting system message bus: random: dbus-daemon: uninitialized urandom read (12 bytes read)
random: dbus-daemon: uninitialized urandom read (12 bytes read)
dbus.
Starting haveged: haveged: listening socket at 3
haveged: haveged starting up


Starting Dropbear SSH server: random: dropbear: uninitialized urandom read (32 bytes read)
dropbear.
hwclock: can't open '/dev/misc/rtc': No such file or directory
Starting internet superserver: inetd.
Starting syslogd/klogd: done
Starting tcf-agent: OK

PetaLinux 2019.2 zybo_z7_20_min /dev/ttyPS0

zybo_z7_20_min login: random: crng init done

PetaLinux 2019.2 zybo_z7_20_min /dev/ttyPS0

zybo_z7_20_min login: root
root@zybo_z7_20_min:~# insmod /lib/modules/4.19.0-xilinx-v2019.2/extra/zocl.ko
zocl: loading out-of-tree module taints kernel.
[drm] Probing for xlnx,zocl
[drm] PR Isolation addr 0x0
[drm] Initialized zocl 2018.2.1 20180313 for 80000000.zyxclmm_drm on minor 0
root@zybo_z7_20_min:~# cd /run/media/mmcblk0p1/
root@zybo_z7_20_min:/run/media/mmcblk0p1# export XILINX_XRT=/usr
root@zybo_z7_20_min:/run/media/mmcblk0p1# ./init.sh
[drm] Pid 1152 opened device
[drm] Pid 1152 closed device
[drm] Pid 1152 opened device
Found Platform
Platform Name: Xilinx
INFO: Reading ./build_dir.hw.zybo_z7_20_min/vadd.xclbin
Loading: './build_dir.hw.zybo_z7_20_min/vadd.xclbin'
Trying to program device[0]: edge
[drm] Finding IP_LAYOUT section header
[drm] Section IP_LAYOUT details:
[drm]   offset = 0x3dbf28
[drm]   size = 0x58
[drm] Finding DEBUG_IP_LAYOUT section header
[drm] AXLF section DEBUG_IP_LAYOUT header not found
[drm] Finding CONNECTIVITY section header
[drm] Section CONNECTIVITY details:
[drm]   offset = 0x3dbf80
[drm]   size = 0x28
[drm] Finding MEM_TOPOLOGY section header
[drm] Section MEM_TOPOLOGY details:
[drm]   offset = 0x3dbe58
[drm]   size = 0xd0
[drm] No ERT scheduler on MPSoC, using KDS
[drm] Fail to install CU 0 interrupt handler: -22. Fall back to polling mode.
[drm] scheduler config ert(0)
[drm]   cus(1)
[drm]   slots(16)
[drm]   num_cu_masks(1)
[drm]   cu_shift(16)
[drm]   cu_base(0x40000000)
Device[0]: program successful!
TEST PASSED
[drm]   polling(1)
[drm] zocl_free_userptr_bo: obj 0x3c156f65
[drm] zocl_free_userptr_bo: obj 0x8b19c77d
[drm] zocl_free_userptr_bo: obj 0x8f0540b9
[drm] Pid 1152 closed device
root@zybo_z7_20_min:/run/media/mmcblk0p1# 

  1. 2019年11月26日 05:27 |
  2. Vitis
  3. | トラックバック:0
  4. | コメント:0

コメント

コメントの投稿


管理者にだけ表示を許可する

トラックバック URL
https://marsee101.blog.fc2.com/tb.php/4715-572e789d
この記事にトラックバックする(FC2ブログユーザー)