Xilinx / SDSoC-Tutorials

SDSoC™ (Software-Defined System-On-Chip) Environment Tutorials
146 stars 53 forks source link

Error building xfOpencv application using Zedboard #29

Closed microlijun closed 5 years ago

microlijun commented 5 years ago

Hi, I'm trying to migrate my opencv application to xfopencv. I already built it with zcu102 revision platform, but when I transfer to zedboard, error shown as follow.

'' ERROR: [SYNCHK 200-79] Cannot find the top function 'w0_xf_boxFilter' in the design. Possible causes are: (1) the top function name is misspelled; (2) the top function is nonexistent or declared as static. ERROR: [HLS 200-70] Synthesizability check failed.''

log file attached here: sds_guided_filter.log

My setting is as follow: image

image /usr/local/arm/opencv-install/include/opencv is a cross compilied OpenCv. image

This is my source file. Could anyone help me build it? Thanks.

microlijun commented 5 years ago

I also tried to build an colordetect example from xfopencv with same setting. Errors shown as follow:

Preliminary link application ELF arm-linux-gnueabihf-g++ /home/jun/workspace_sdx/colordetect_zed/Release/_sds/swstubs/xf_rgb2hsv_hpp.o /home/jun/workspace_sdx/colordetect_zed/Release/_sds/swstubs/xf_colorthresholding_hpp.o /home/jun/workspace_sdx/colordetect_zed/Release/_sds/swstubs/xf_dilation_hpp.o /home/jun/workspace_sdx/colordetect_zed/Release/_sds/swstubs/xf_erosion_hpp.o /home/jun/workspace_sdx/colordetect_zed/Release/src/xf_colordetect_tb.o /home/jun/workspace_sdx/colordetect_zed/Release/_sds/swstubs/xf_colordetect_accel.o /home/jun/workspace_sdx/colordetect_zed/Release/_sds/swstubs/portinfo.o -L/usr/local/arm/opencv-install/lib -lopencv_videoio -lopencv_core -lopencv_imgproc -lopencv_features2d -lopencv_flann -lopencv_video -L /home/jun/Programs/Xilinx2018.2/SDx/2018.2/target/aarch32-linux/lib -L/home/jun/workspace_sdx/colordetect_zed/Release/_sds/swstubs -Wl,--start-group -Wl,--end-group -Wl,--start-group -lpthread -lsds_lib -lxlnk_stub -Wl,--end-group -o /home/jun/workspace_sdx/colordetect_zed/Release/_sds/swstubs/colordetect_zed.elf /home/jun/Programs/Xilinx2018.2/SDK/2018.2/gnu/aarch32/lin/gcc-arm-linux-gnueabi/bin/../lib/gcc/arm-linux-gnueabihf/7.2.1/../../../../arm-linux-gnueabihf/bin/ld: cannot find -lopencv_videoio collect2: error: ld returned 1 exit status ERROR: [SdsCompiler 83-5019] Exiting sds++ : Error when calling 'arm-linux-gnueabihf-g++ /home/jun/workspace_sdx/colordetect_zed/Release/_sds/swstubs/xf_rgb2hsv_hpp.o /home/jun/workspace_sdx/colordetect_zed/Release/_sds/swstubs/xf_colorthresholding_hpp.o /home/jun/workspace_sdx/colordetect_zed/Release/_sds/swstubs/xf_dilation_hpp.o /home/jun/workspace_sdx/colordetect_zed/Release/_sds/swstubs/xf_erosion_hpp.o /home/jun/workspace_sdx/colordetect_zed/Release/src/xf_colordetect_tb.o /home/jun/workspace_sdx/colordetect_zed/Release/_sds/swstubs/xf_colordetect_accel.o /home/jun/workspace_sdx/colordetect_zed/Release/_sds/swstubs/portinfo.o -L/usr/local/arm/opencv-install/lib -lopencv_videoio -lopencv_core -lopencv_imgproc -lopencv_features2d -lopencv_flann -lopencv_video -L /home/jun/Programs/Xilinx2018.2/SDx/2018.2/target/aarch32-linux/lib -L/home/jun/workspace_sdx/colordetect_zed/Release/_sds/swstubs -Wl,--start-group -Wl,--end-group -Wl,--start-group -lpthread -lsds_lib -lxlnk_stub -Wl,--end-group -o /home/jun/workspace_sdx/colordetect_zed/Release/_sds/swstubs/colordetect_zed.elf' sds++ log file saved as /home/jun/workspace_sdx/colordetect_zed/Release/_sds/reports/sds.log ERROR: [SdsCompiler 83-5004] Build failed

sds.log

sgrace-xlnx commented 5 years ago

Hi @microlijun,

Looks like you're having an issue with Includes and Lib paths. In the tutorial, the OpenCV libraries being targeted are ones that are pre-built in the SDx install area (which is also what the Linux image uses). From your screenshots it looks like you're actually targeting local machine libraries and not the ones in the SYSROOT used by the platform. You're using 2018.2, so you will need to be targeting the 2018.2 compiled libraries to be used. I would double check that your new Zedboard platform has the appropriate SYSROOT and libraries provided. If not, you'd need to consult UG1146 again to make sure things are in order.

Also, the Zedboard is considerably smaller than the ZCU102 and will be limited on resources. A good way to check this is to look at the accelerator compilation reports and see what is predicted for utilization.

Hope this helps Steve

microlijun commented 5 years ago

Hi Steve @sgrace-xlnx

According to UG1233 --- Using the xfOpenCV Library on a non-reVISION Platform : "The OpenCV library is not provided by Xilinx for custom platforms. You are required to provide the library. "

image

image

So I included an opencv libraries cross-compiled by arm-none-linux-gnueabi-gcc. However, it seems that SDx can't find the libraries. I don't know why it doesn't work.

In your instruction, do you mean that I have to create a custom zed platform for this?

Thanks for your help.

Jun

sgrace-xlnx commented 5 years ago

You will have to create a custom platform to execute OpenCV functions. The base Linux image of the Zedboard does not come with OpenCV pre-installed. This also means the SYSROOT needed for compilation needs to contain the OpenCV libraries. You'll have to create a new image using Petalinux and map it to a DSA. This can be found in UG1146.

microlijun commented 5 years ago

Hi, @sgrace-xlnx @stsoe @amantalwar04 @lmet321 The opencv include/lib path issue is solved. New errors come, error: /home/jun/workspace_sdx/colordetect_zed/Release/_sds/swstubs/colordetect_zed.elf uses VFP register arguments, /usr/local/arm/arm-opencv3.1/lib/libopencv_world.a(matrix.cpp.obj) does not

Do I need to any instruction at Linker Flags? Thank you so much for your help.

sds.log

microlijun commented 5 years ago

solved

khalid17160 commented 3 years ago

@microlijun can u provide the step you used to run it for ZedBoard it would be a great help.