本文作者:賽靈思產(chǎn)工程師 付漢杰 1 概述 所有工具和參考設(shè)計使用2021.2。X86編譯主機(jī)的操作系統(tǒng)是Ubuntu 18.04.6 LTS。編譯記錄里的井號,由于和Markdown語法有沖突,把超過3個以上的連續(xù)井號全部替換成了星號。有些軟件打印的記錄非常長,于是把其中部分內(nèi)容替換成了“……”。 硬件移植和axi interrupt controller的設(shè)備樹工作由賽靈思工程師季茂林完成。 2 PETALINUX工程 2.1. VMK180 TRD的PetaLinux工程 直接編譯vmk180-trd/petalinux/xilinx-vmk180-trd中的VMK180 TRD的PetaLinux工程,能成功編譯。 2.2. VMK180 TRD XSA的PetaLinux工程 從VMK180 TRD帶的XSA文件: (vmk180-trd/platforms/vivado/vmk180_trd/project/vmk180_trd.xsa) 創(chuàng)建PetaLinux工程,直接編譯,會出錯,部分錯誤信息如下: ERROR: Error executing a python function in exec_python_func() autogenerated: The stack trace of python calls that resulted in this exception/failure was: File: 'exec_python_func() autogenerated', lineno: 2, function: 0001: *** 0002:devicetree_do_compile(d) 0003: File: '/proj/hankf/v212/vmk180-trd/vmk180-trd-xsa-peta/components/yocto/layers/core/meta/classes/devicetree.bbclass', lineno: 131, function: devicetree_do_compile 0127: if not(os.path.isfile(dtspath)) or not(dts.endswith('.dts') or devicetree_source_is_overlay(dtspath)): 0128: continue # skip non-.dts files and non-overlay files 0129: except: 0130: continue # skip if can't determine if overlay *** 0131: devicetree_compile(dtspath, includes, d) 0132:} 0133: 0134:devicetree_do_install() { 0135: for DTB_FILE in `ls *.dtb *.dtbo`; do ..................... '/proj/hankf/v212/vmk180-trd/vmk180-trd-xsa-peta/build/tmp/work/versal_generic-xilinx-linux/device-tree/xilinx-v2021.2+gitAUTOINC+c0acd8f064-r0', '-o', 'system-top.dtb', '-I', 'dts', '-O', 'dtb', 'system-top.dts.pp']' returned non-zero exit status 2. Subprocess output: /proj/hankf/v212/vmk180-trd/vmk180-trd-xsa-peta/project-spec/configs/../../components/plnx_workspace/device-tree/device-tree/pl.dtsi:364.86-366.8: ERROR (phandle_references): /amba_pl@0/mipi_csi2_rx_subsystem@a4060000/ports/port@1/endpoint: Reference to non-existent node or label 'mipi_capture_pipe_cap_pipe_ISPPipeline_accel_0mipi_capture_pipe_mipi_csi_rx_ss_mipi_csi2_rx_subsyst_0' ERROR: Input tree has errors, aborting (use -f to force output) DEBUG: Python function devicetree_do_compile finished 把文件system-user.dtsi做下列更改后,才能編譯通過。 /include/ 'system-conf.dtsi' /// { //}; /delete-node/ &axi_intc_0; /delete-node/ &mipi_csirx_outmipi_capture_pipe_mipi_csi_rx_ss_mipi_csi2_rx_subsyst_0; / { amba_pl: amba_pl@0 { axi_intc_0: interrupt-controller@a42e0000 { interrupt-names = 'irq'; interrupt-parent = <&gic>; interrupts = <0 99 4>; }; }; }; 2.3. VCK190 XSA的PetaLinux工程 把VMK180 TRD的工程,移植到VCK190,再根據(jù)導(dǎo)出的XSA創(chuàng)建PetaLinux工程,也需要做上述更改,才能成功編譯PetaLinux工程。 2.4. 移植VMK180 TRD的PetaLinux工程 直接在VMK180 TRD的PetaLinux工程,導(dǎo)入上述VCK190的XSA(移植到VCK190的VMK180 TRD的XSA),能成功編譯PetaLinux工程。 2.5. 基于VMK180 TRD的BSP的PetaLinux工程 把VMK180 TRD的PetaLinux工程打包成BSP,再創(chuàng)建PetaLinux工程,并導(dǎo)入上述VCK190的XSA(移植到VCK190的VMK180 TRD的XSA),能成功編譯。 3 X86-HOST軟件編譯 3.1. libaio.h 編譯 vmk180-trd/pcie_host_package/qdma/apps/dma-util 時,得到錯誤“l(fā)ibaio.h: No such file or directory”。 cc -g -I. -I../include -I../dma-utils -c -std=c99 -o ../dma-utils/dmaxfer.o ../dma-utils/dmaxfer.c -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -D_LARGE_FILE_SOURCE -D_AIO_AIX_SOURCE ../dma-utils/dmaxfer.c:34:10: fatal error: libaio.h: No such file or directory #include ^~~~~~~~~~ compilation terminated. Makefile:23: recipe for target '../dma-utils/dmaxfer.o' failed 安裝libaio1和libaio-dev,再編譯就能能成功。 /proj/hankf/vck190/v212/vck190-from-vmk180-trd-bsp-peta/project-spec/qdma-x86-host-app$ sudo apt install libaio1 libaio-dev Reading package lists... Done Building dependency tree Reading state information... Done The following packages were automatically installed and are no longer required: linux-hwe-5.4-headers-5.4.0-90 linux-hwe-5.4-headers-5.4.0-91 linux-hwe-5.4-headers-5.4.0-92 linux-hwe-5.4-headers-5.4.0-94 Use 'sudo apt autoremove' to remove them. The following NEW packages will be installed: libaio-dev libaio1 0 upgraded, 2 newly installed, 0 to remove and 18 not upgraded. Need to get 19.3 kB of archives. After this operation, 87.0 kB of additional disk space will be used. Get:1 http://mirrors.aliyun.com/ubuntu bionic-updates/main amd64 libaio1 amd64 0.3.110-5ubuntu0.1 [6,476 B] Get:2 http://mirrors.aliyun.com/ubuntu bionic-updates/main amd64 libaio-dev amd64 0.3.110-5ubuntu0.1 [12.8 kB] Fetched 19.3 kB in 1s (13.1 kB/s) Selecting previously unselected package libaio1:amd64. (Reading database ... 383659 files and directories currently installed.) Preparing to unpack .../libaio1_0.3.110-5ubuntu0.1_amd64.deb ... Unpacking libaio1:amd64 (0.3.110-5ubuntu0.1) ... Selecting previously unselected package libaio-dev:amd64. Preparing to unpack .../libaio-dev_0.3.110-5ubuntu0.1_amd64.deb ... Unpacking libaio-dev:amd64 (0.3.110-5ubuntu0.1) ... Setting up libaio1:amd64 (0.3.110-5ubuntu0.1) ... Setting up libaio-dev:amd64 (0.3.110-5ubuntu0.1) ... Processing triggers for man-db (2.8.3-2ubuntu0.1) ... Processing triggers for libc-bin (2.27-3ubuntu1.4) ... 3.2. PF src '.tmp_30090’: Permission denied 編譯QDMA驅(qū)動時,得到錯誤“mkdir: cannot create directory '.tmp_30090’: Permission denied”。 make -C driver make[1]: Entering directory '/proj/hankf/vck190/v212/vck190-from-vmk180-trd-bsp-peta/project-spec/qdma-x86-host-app/driver' 'distro=, dmajor= dminor= ' 5.4.1575.4.0-96-generic: GIT,,, -DGITSP -DGIT CROSS_COMPILE_FLAG = aarch64-linux-gnu-. ARCH = x86_64. rm: cannot remove '/proj/hankf/vck190/v212/vck190-from-vmk180-trd-bsp-peta/project-spec/qdma-x86-host-app/driver/src/libqdma': Is a directory ln: /proj/hankf/vck190/v212/vck190-from-vmk180-trd-bsp-peta/project-spec/qdma-x86-host-app/driver/src/libqdma: cannot overwrite directory *********************** **** PF src **** *********************** make[2]: Entering directory '/proj/hankf/vck190/v212/vck190-from-vmk180-trd-bsp-peta/project-spec/qdma-x86-host-app/driver/src' srcdir = /proj/hankf/vck190/v212/vck190-from-vmk180-trd-bsp-peta/project-spec/qdma-x86-host-app/driver/src. KSRC = /lib/modules/5.4.0-96-generic/build. VF = 0. CROSS_COMPILE_FLAG = aarch64-linux-gnu-. ARCH = x86_64. EXTRA_FLAGS = . ccflags-y = -D__READ_ONCE_DEFINED__. make[3]: Entering directory '/usr/src/linux-headers-5.4.0-96-generic' mkdir: cannot create directory '.tmp_30090’: Permission denied mkdir: cannot create directory '.tmp_30092’: Permission denied ............ 把所有文件的所有者改為當(dāng)前用戶,編譯也有錯誤。 /proj/hankf/vck190/v212/vck190-from-vmk180-trd-bsp-peta/project-spec/qdma-x86-host-app$ whoami hankf /proj/hankf/vck190/v212/vck190-from-vmk180-trd-bsp-peta/project-spec/qdma-x86-host-app$ sudo chown -R hankf * /proj/hankf/vck190/v212/vck190-from-vmk180-trd-bsp-peta/project-spec/qdma-x86-host-app$ make clean *********************** **** apps **** *********************** make -C apps clean; ............ /proj/hankf/vck190/v212/vck190-from-vmk180-trd-bsp-peta/project-spec/qdma-x86-host-app$ make *********************** **** apps **** *********************** make -C apps make[1]: Entering directory '/proj/hankf/vck190/v212/vck190-from-vmk180-trd-bsp-peta/project-spec/qdma-x86-host-app/apps' ***************************** **** dma-from-device **** ***************************** make -C dma-from-device clean; make[2]: Entering directory '/proj/hankf/vck190/v212/vck190-from-vmk180-trd-bsp-peta/project-spec/qdma-x86-host-app/apps/dma-from-device' rm -rf *.o *.bin dma-from-device make[2]: Leaving directory '/proj/hankf/vck190/v212/vck190-from-vmk180-trd-bsp-peta/project-spec/qdma-x86-host-app/apps/dma-from-device' ............ make[3]: Entering directory '/usr/src/linux-headers-5.4.0-96-generic' mkdir: cannot create directory '.tmp_34383’: Permission denied mkdir: cannot create directory '.tmp_34385’: Permission denied .......... 使用sudo命令,以root權(quán)限編譯,能編譯成功。 /proj/hankf/vck190/v212/vck190-from-vmk180-trd-bsp-peta/project-spec/qdma-x86-host-app$ sudo make *********************** **** apps **** *********************** make -C apps make[1]: Entering directory '/proj/hankf/vck190/v212/vck190-from-vmk180-trd-bsp-peta/project-spec/qdma-x86-host-app/apps' ***************************** **** dma-from-device **** ***************************** make -C dma-from-device clean; make[2]: Entering directory '/proj/hankf/vck190/v212/vck190-from-vmk180-trd-bsp-peta/project-spec/qdma-x86-host-app/apps/dma-from-device' rm -rf *.o *.bin dma-from-device make[2]: Leaving directory '/proj/hankf/vck190/v212/vck190-from-vmk180-trd-bsp-peta/project-spec/qdma-x86-host-app/apps/dma-from-device' ................... srcdir = /proj/hankf/vck190/v212/vck190-from-vmk180-trd-bsp-peta/project-spec/qdma-x86-host-app/driver/src. KSRC = /lib/modules/5.4.0-96-generic/build. VF = 1. CROSS_COMPILE_FLAG = . ARCH = x86_64. EXTRA_FLAGS = -D__QDMA_VF__. ccflags-y = -D__READ_ONCE_DEFINED__. Building modules, stage 2. MODPOST 1 modules CC [M] /proj/hankf/vck190/v212/vck190-from-vmk180-trd-bsp-peta/project-spec/qdma-x86-host-app/driver/src/qdma-vf.mod.o LD [M] /proj/hankf/vck190/v212/vck190-from-vmk180-trd-bsp-peta/project-spec/qdma-x86-host-app/driver/src/qdma-vf.ko make[3]: Leaving directory '/usr/src/linux-headers-5.4.0-96-generic' make[2]: Leaving directory '/proj/hankf/vck190/v212/vck190-from-vmk180-trd-bsp-peta/project-spec/qdma-x86-host-app/driver/src' make[1]: Leaving directory '/proj/hankf/vck190/v212/vck190-from-vmk180-trd-bsp-peta/project-spec/qdma-x86-host-app/driver' 3.3. Build host application pcie_app 編譯應(yīng)用程序pcie_app,得到錯誤“undefined reference to cv::namedWindow”。 /proj/hankf/vck190/v212/vck190-from-vmk180-trd-bsp-peta/project-spec/qdma-x86-host-app/pcie_app$ ./do_compile.sh g++ -Wl,-O1 -o app1 main.o mainwindow.o videofrm.o pcie_host.o moc_mainwindow.o moc_videofrm.o -L/usr/lib -L/usr/lib/x86_64-linux-gnu/glib-2.0 -lopencv_core -lopencv_imgproc -lopencv_highgui -lopencv_ml -lopencv_video -lopencv_features2d -lopencv_calib3d -lopencv_objdetect -lopencv_imgcodecs -lrt -lglib-2.0 -lQt5Widgets -lQt5Gui -lQt5Concurrent -lQt5Core -lGL -lpthread videofrm.o: In function `videofrm::config_frame()': videofrm.cpp:(.text+0x43a): undefined reference to `cv::namedWindow(std::__cxx11::basic_stringconst&, int)' videofrm.o: In function `videofrm::convert_yuv_to_rgb_buffer(unsigned char*, unsigned char*, unsigned int, unsigned int)': videofrm.cpp:(.text+0x776): undefined reference to `cv::imshow(std::__cxx11::basic_stringconst&,cv::_InputArray const&)' collect2: error: ld returned 1 exit status Makefile:167: recipe for target 'app1' failed make: *** [app1] Error 1 mv: cannot stat 'app1': No such file or directory 使用命令pkg-config opencv –cflags –libs,查看opencv相關(guān)庫的編譯選項,并加入Makefile,能編譯成功。 /proj/hankf/vmk180/v212/vmk180-trd$ pkg-config opencv --cflags --libs | grep -i gui -I/usr/local/include/opencv -I/usr/local/include -L/usr/local/lib -lopencv_dnn -lopencv_highgui -lopencv_ml -lopencv_objdetect -1 賽靈思中文技術(shù)支持社區(qū) 歡迎在賽靈思中文技術(shù)支持社區(qū)中留言討論開發(fā)過程中遇到的問題與啟發(fā)! 本社區(qū)致力于為Xilinx 用戶及生態(tài)合作伙伴提供一個分享、討論和相互協(xié)作解決問題的交流社區(qū),注冊即可瀏覽論壇內(nèi)容或者參與討論。 https://support./s/?language=zh_CN |
|