Setup the xfOpenCV environment - SundanceMultiprocessorTechnology/VCS-1 GitHub Wiki
TBC
It is assumed that the user has successfully completed the following steps:
- Build Firmware Page
- Linux Software Platform for ZU4CG module in SDX 2018.3
- Creating the Platform Hardware Component or DSA File
- [xfopencv](https://github.com/Xilinx/xfopencv TBC
- VCS-1 board
-> ZU4CG MPSoC
-> EMC2-DP
-> FM191
- Xilinx Vivado 2018.3
- Xilinx SDK 2018.3
- Xilinx SDX 2018.3
- Petalinux 2018.3
- XfopenCV master folder from xfopencv. Extract or clone this folder.
- Open a terminal and clone the xfOpenCV repository
$ cd <repositiores folder>
$ git clone https://github.com/Xilinx/xfopencv.git
-
Export the bit file and hardware to the SDK and launch the SDK from Vivado. TBC
-
In Xilinx SDK create a zynqMP_Fsbl project and produce a zynqMP_fsbl.elf file. This file will be used to create the boot image with petalinux.
-
Now go back to the Build Firmware Page and follow the steps to create a petalinux project but the one difference would be using your DSA file rather than the HDF file to create the petalinux project.
-
Besides all the steps provided in the above mentioned BUILD FIRMWARE page a few more steps are needed before running the petalinux-build command they are detailed as follows:
- Enable staging drivers:
- Device Drivers → Staging drivers (ON)
- Enable APF management driver:
- Device Drivers → Staging drivers → Xilinx APF Accelerator driver(ON)
- Enable APF DMA driver:
- Device Drivers → Staging drivers → Xilinx APF Accelerator driver → Xilinx APF DMAengines support (ON)
* Add stdc++ libs:• Filesystem Packages → misc → gcc-runtime → libstdc++ (ON)-
At the bottom of <>/project-spec/meta-user/recipes-bsp/device-tree/files/system-user.dtsi, add the following entry: /{ xlnk { compatible = "xlnx,xlnk-1.0"; };};
note: The above info is available on Page 85 of Xilinx UG1146 v 2018.3
Configure petalinux rootfs:petalinux-config -p <petalinux_project> \-c rootfs * Add opencv lib:• Filesystem Packages → libs → opencv → opencv (ON) opencv-dbg(on) opencv-dev(on) opencv- apps(on) opencv-samples(on) - Enable staging drivers:
-
Build the PetaLinux image with petalinux-build
-
Build the Boot.Bin file with the following command you have to cd to the /image/linux folder in the petalinux project
- petalinux-package --boot --format BIN --fsbl ./images/linux/fsbl.elf --fpga ./images/linux/system.bit --u-boot --pmufw ./images/linux/pmufw.elf
-
Once the petalinux project is build create a new folder this folder will be your linux SDSoC platform folder. Copy the files from the petalinux project in the images/linux folder onto the new folder copy the all the files into a subfolder of the new folder name this folder boot. So for example if the name of the new SDSoC platform project is zu4cg_sdsoc --- Boot folder holding files from petalinux images/linux folder. --- Image folder holding only image.ub file from petalinux images/linux folder.
-
In the boot folder please replace the zynqMP_fsbl.elf file with the one created in step 4.
-
Make a new file in boot folder called linux.bif open it and copy and save the following to this file the_ROM_image:
{
[fsbl_config] a53_x64
[bootloader] <sysconfig1/boot/zynqmp_fsbl.elf>
[pmufw_image] <sysconfig1/boot/pmufw.elf>
[destination_device=pl] <bitstream>
[destination_cpu=a53-0, exception_level=el-3, trustzone] <sysconfig1/boot/bl31.elf>
[destination_cpu=a53-0, exception_level=el-2] <sysconfig1/boot/u-boot.elf>
}
close the file.
-
Copy the DSA file created in step 3 to the top zu4cg_SDSoC folder.
-
Now follow the steps listed in Linux Software Platform for ZU4CG module in SDX 2018.3 to create the software platform for SDSoC.
-
The created platform is in the subfolder output/export and platform_1 or whatever one has named the platform should be here.
-
Under zu4cg_SDSoC/boot there will be a rootfs.tar.gz file extract the file.
-
Open Xilinx SDx to create an application project on the linux SDSoc platform just created.
-
In the SDX environment select new - application project and when the GUI window asks for which platform please click the add new platform or + button on to and add the custom platform in the zu4cg_SDSoC/output/export folder, point to the folder containing the platform so in the case of this example the platform_1 folder.
-
Click next THIS IS AN IMPORTANT STEP in this window SDx ask if one needs to point to a default rootfs folder and we need to specify this for the xfopencv example to run. Please point to the folder extracted in step 15.
-
Click next and choose an empty application project click finish.
-
If one has not yet downloaded the xfopencv library please do by clicking on Xilinx toolbar menu and choosing SDx libraries and then downloading the xfopencv library.
-
If the library is already present please go ahead and add it to the project by clicking on Xilinx menu and selecting SDx libraries option and adding xfopencv to the present project.
-
Before building the example one needs to set up the build environment. In the project Navigation folder left click on the project name and select c/c++ build settings. In the window select the Directories category under the SDSCC compiler setting and click the green + button and select workspace in the opened window. Now please select the libs/xfopencv/include under the project name. Add it.
-
Do the same for SDS++ Compiler Directories settings and the SDS++ Linker Libraries search path.