3
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Ultra96v2 で device tree overlay を使って FPGAのimageを制御

Posted at

ここを参考にして、device tree overlay を使ってFPGAのimageを制御
https://xilinx-wiki.atlassian.net/wiki/spaces/A/pages/18841645/Solution+Zynq+PL+Programming+With+FPGA+Manager

Host側のpetalinux のimage/linux フォルダ以下にFull_Bitstream.bifというファイルを作成

$ cd ./image/linux
$ cat Full_Bitstream.bif
all:
{
                design_1_wrapper.bit /* Bitstream file name */
}

petalinux/tools の下にあるbootgen をいうツールを使って、bitstream file を .binに変換する。

$ ./../../../petalinux/tools/xsct/bin/bootgen -image Full_Bitstream.bif -arch zynqmp -p
rocess_bitstream bin


****** Xilinx Bootgen v2019.2
  **** Build date : Oct 23 2019-22:59:42
    ** Copyright 1986-2019 Xilinx, Inc. All Rights Reserved.

image/linux フォルダにできたdesign_1_wrapper.bit.binとpl.dtboをsdカードにコピー。

Ultra96V2側で上で以下を実行、すでにconfigfsが有効になっていてmountもされている。

# echo 0 > /sys/class/fpga_manager/fpga0/flags
# mkdir -p /lib/firmware
# cp /run/media/mmcblk0p1/design_1_wrapper.bit.bin /lib/firmware/
# cp /run/media/mmcblk0p1/pl.dtbo /lib/firmware/
# cd /sys/kernel/config/device-tree/overlays/
# mkdir full
# echo -n "pl.dtbo" > full/path
[   77.851677] fpga_manager fpga0: writing design_1_wrapper.bit.bin to Xilinx ZynqMP FPGA Manager

完了すると、device-tree 以下に登録される。

# ls -la /proc/device-tree/amba/example\@a0000000/
total 0
drwxr-xr-x    2 root     root             0 Jan  1 12:30 .
drwxr-xr-x   61 root     root             0 Jan  1 12:30 ..
-r--r--r--    1 root     root             7 Jan  1 12:30 clock-names
-r--r--r--    1 root     root             8 Jan  1 12:30 clocks
-r--r--r--    1 root     root            17 Jan  1 12:30 compatible
-r--r--r--    1 root     root             8 Jan  1 12:30 name
-r--r--r--    1 root     root             4 Jan  1 12:30 phandle
-r--r--r--    1 root     root            16 Jan  1 12:30 reg
-r--r--r--    1 root     root             4 Jan  1 12:30 xlnx,s-axi-axilites-addr-width
-r--r--r--    1 root     root             4 Jan  1 12:30 xlnx,s-axi-axilites-data-width

devmem を使ってレジスタのread/write ができるようになる。

# devmem 0xa0000000 32
0x00000000
3
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?