作者:Nathan Xu,AMD工程師;來源:AMD開發(fā)者社區(qū)
Petalinux工程:
1. 設置好2022.2 Petalinux環(huán)境. 使用2022.2 ZCU106 BSP, 創(chuàng)建Petalinux工程:
petalinux-create $BSP_DIR/xilinx-zcu106-v2022.2-final.bsp
這個例子的BSP_DIR= /proj/petalinux/released/Petalinux v2022.2/finalrelease/release/petalinux-v2022.2_10141622/bsp/release
2. CD到新建的petalinux工程下:
cd xilinx-zcu106-2022.2/
3. 在上面Vivado生成的.xsa文件導入到petalinux工程:
petalinux-config --get-hw-description=
XSA文件在
System Configuration:
4. 在system configuration配置頁面, 選擇DTG settings

5. 在DTG settings頁面, 按”n”把“Remove PL from device tree”勾掉, 確保這個選項不要選上

6. 在DTG Settings→kernel Bootargs→Add extra boot args, 可以加上?cma=1700M.
7. 在system configuration配置頁面, 選擇FPGA manager, 按“n”把FPGA manager選項勾掉.


Kernel configuration:
8. 運行下面命令
Petalinux-config -c kernel
9. 在kernel配置頁面, 確保CONFIG_VIDEO_XILINX, CONFIG_VIDEO_DEV, CONFIG_VIDEO_V4L2, CONFIG_VIDEO_XILINX_MULTISCALER這些選項都已經(jīng)配置好.

10. 可以在kernel配置頁面, 用‘/’來搜索這些配置是否已經(jīng)設置.


Rootfs配置:
11. 運行下面命令, 配置rootfs.
petalinux-config -c rootfs
在Filesystem Packages→misc→v4l-utils?, 配置好v4l-utils, libv4l, media-ctl.
在Filesystem Packages→misc→gstreamer1.0-plugins-good, 按”y”把下面選項都勾上.

編譯Petalinux工程:
14. petalinux-build
創(chuàng)建boot image:
15. cd images/linux
16. petalinux-package --boot --fsbl zynqmp_fsbl.elf --u-boot u-boot.elf --pmufw pmufw.elf --fpga system.bit
拷貝image到SD card:
17. 把生成的BOOT.BIN, system.dtb, Image, rootfs.cpio.gz.u-boot, boot.scr 拷貝搭配SD card.
ZCU106板卡設置與連接:
18. Connect the Micro USB cable into the ZCU106 Board Micro USB port J83, and the other end into an open USB port on the host PC. This cable is used for UART over USB communication.
19. Insert the SD card with the images copied into the SD card slot J100.
20. Set the SW6 switches as shown in the below Figure. This configures the boot settings to boot from SD.

21. Connect 12V Power to the ZCU106 6-Pin Molex connector.
22. Set up a terminal session between a PC COM port and the serial port on the evaluation board
Run the image on ZCU106:
23. 在linux booting完成后, 運行下面的gst-launch命令:
gst-launch-1.0 videotestsrc num-buffers=50 ! video/x-raw, width=3840, height=2160, format=RGB ! queue min-threshold-buffers=2 max-size-bytes=0 ! v4l2convert capture-io-mode=4 output-io-mode=4 ! video/x-raw, width=1920, height=1080, format=RGB ! filesink location=./out_chan0.rgb
24. 把SD card mount到/mnt/
mount /dev/mmcblk0p1 /mnt/
25. 把剛才生成的out_chan0.rgb拷貝到/mnt
cp out_chan0.rgb /mnt/
在YUV player打開out_chan0.rgb
26. 設置YUV player的size為1080p, color為RGB24, zoom設置為1:2或者1:4. 打開out_chan0.rgb, 就能看到下面圖片:

Multi-scaler在linux的debug:
27. 比較常見的問題, 是在運行上面的gst-launch命令, 找不到“v4l2convert” element, 遇到這個錯誤,需要看multi-scaler在boot log有沒有probe到. 一個經(jīng)??吹降脑? 是multi-scaler的device tree里reset-gpios這個property是必須的, 但DTG有的時候沒有產(chǎn)生這個property, 或者是gpio沒有連接到multi-scaler的reset管腳, 所以確保reset-gpios這個property在device tree, 否則就會看到錯誤. 下面是video multi-scaler device tree的參考例子, 如果不確定device tree是否正確, 對比下面的例子, 檢查device tree是否有缺少的property.

28. multi-scaler的第一個node, 它的gstreamer element是"v4l2convert" 而不是 "v4l2video0convert", 之前第一個node是v4l2video0convert, 第二個node是v4l2video1convert, 現(xiàn)在 1st node是 "v4l2convert", 2nd 是“v4l2video1convert ”.
【推薦閱讀】
全新 Spartan UltraScale+ FPGA 系列 - 以小型封裝實現(xiàn)高 I/O 和低功耗
Multi-Scaler IP的linux示例以及debug(上)
OpenCV在Windows上的安裝和設置
2023.2 Vitis Unified IDE獨立應用移植詳細信息
【預約直播】
