Download the DPU IP v4.0 for the VITIS-AI 2.5 from this link: https://www.xilinx.com/bin/public/openDownload?filename=DPUCZDX8G.tar.gz
1. Extract the files.
2. Edit trd_prj.tcl located at D:\SampleProjects\Vivado\DPU_TRD\DPUCZDX8G\prj\Vivado\scripts\trd_prj.tcl
dict set dict_prj dict_sys prj_name {KV260}
dict set dict_prj dict_sys prj_part {xck26-sfvc784-2LV-c}
dict set dict_prj dict_sys prj_board {KV260}
dict set dict_prj dict_param DPU_CLK_MHz {275}
dict set dict_prj dict_param DPU_NUM {1}
dict set dict_prj dict_param DPU_SFM_NUM {0}
dict set dict_prj dict_param DPU_URAM_PER_DPU {50}
3. Edit trd_bd.tcllocated at D:\SampleProjects\Vivado\DPU_TRD\DPUCZDX8G\prj\Vivado\scripts\base\trd_bd.tcl
dict set dict_prj dict_param HP_CLK_MHz {274}
4. Execute the trd_prj.tcl file using the Vivado command line tool (if you're working on windows).
5. After the project is successfully created,
- Open the project from D:\SampleProjects\Vivado\DPU_TRD\DPUCZDX8G\prj\Vivado\prj\KV260.xpr.
- In the project summary page, Change the Project part to Kria KV260 Vision AI starter kit, and add the CC connection.
- From the Flow Navigator window open Settings -> bitstream -> Select the -bin file checkbox.
- Click on Generate Bitstream.
- After successful bitstream generation export the hardware, File -> Export -> Hardware, give any meaningful name -> Finish.
- The output bit file is available in the below path, D:\SampleProjects\Vivado\DPU_TRD\DPUCZDX8G\prj\Vivado\prj\KV260.runs\impl_1_01\top_wrapper.bit
1. Download xilinx-kv260-starterkit-v2022.1-05140151.bsp
2. Create the petalinux project
petalinux-create -t project -s ../inputs/xilinx-kv260-starterkit-v2022.1-05140151.bsp --name dpuOS
3. Import the hardware platform to the petalinux project
petalinux-config --get-hw-description=/home/ramesh/projects/inputs/DPUCZDX8G/prj/Vivado/prj/
4. In the configuration screen make the following settings,
- Enable FPGA MANAGER
- Disable TFTPboot copy
- Image package type INITRD, name as petalinux-initramfs-image
5. Run the Kernel Configuration.
petalinux-config -c kernel
Device Drivers -->
Misc devices -->
<*> Xilinux Deep learning Processing Unit (DPU) Driver
6. Copy the necessary recipes to our petalinux project directory
cp -r /home/ramesh/projects/inputs/DPUCZDX8G/prj/Vivado/xilinx_zcu102_bsp/project-spec/meta-user/recipes-kernel/ ./project-spec/meta-user/
cp -r /home/ramesh/projects/inputs/DPUCZDX8G/prj/Vivado/xilinx_zcu102_bsp/project-spec/meta-user/recipes-tools/ ./project-spec/meta-user/
cp -r /home/ramesh/projects/inputs/DPUCZDX8G/prj/Vivado/xilinx_zcu102_bsp/project-spec/meta-user/recipes-vitis-ai/ ./project-spec/meta-user/
cp -r /home/ramesh/projects/inputs/DPUCZDX8G/prj/Vivado/xilinx_zcu102_bsp/project-spec/meta-user/recipes-apps/ ./project-spec/meta-user/
7. Append the CONFIG_x lines below to <your_petalinux_project_dir>/project-spec/meta-user/conf/user-rootfsconfig file.
CONFIG_vitis-ai-library
CONFIG_vitis-ai-library-dev
CONFIG_vitis-ai-library-dbg
8. Update petalinuxbsp.conf with the following lines.
IMAGE_INSTALL:append = " vitis-ai-library "
IMAGE_INSTALL:append = " vitis-ai-library-dev "
IMAGE_INSTALL:append = " dpu-sw-optimize "
IMAGE_INSTALL:append = " resnet50 "
9. Run the rootfs configuration
petalinux-config -c rootfs
Select the required packages, Don't select vitis-ai-library-dbg.
10. Build the project.
petalinux-build
meanwhile, you can jump to STEP 3 and come back later.
11. Create the WIC petalinux package.
petalinux-package --wic --images-dir images/linux/ --bootfiles "ramdisk.cpio.gz.u-boot,boot.scr,Image,system.dtb,system-zynqmp-sck-kv-g-revB.dtb" --disk-name "mmcblk1" --wic-extra-args "-c gzip"
STEP 3: Generating the Device Tree Overlay1. Source the Petalinux environment in another terminal tab.
2. Source XSCT.
$cd /home/ramesh/PetaLinuxTool/tools/xsct/bin
$./xsct
3. creating a device tree domain and generating the device tree.
xsct% createdts -hw /home/ramesh/projects/inputs/DPUCZDX8G/prj/Vivado/prj/oneCoreDPU_TRD.xsa -zocl -platform-name KV260 -git-branch xlnx_rel_v2022.1 -overlay -compile -out /home/ramesh/projects/oneCore/KV260_dt
xsct% exit
4. Compile the device tree
dtc -@ -O dtb -o ./kv260.dtbo ./kv260_dt/kv260/psu_cortexa53_0/device_tree_domain/bsp/pl.dtsi
5. Create shell.json.
echo '{ "shell_type" : "XRT_FLAT", "num_slots": "1" }' > shell.json
6. Make a copy of top_wrapper.bin in a different directory and rename it to kv260.bit.bin
7. At this time you should have the below files ready
1. petalinux-sdimage.wic.gz
2. kv260.bit.bin
3. kv260.dtbo
4. shell.json
STEP 4: Boot the KV260 with petalinux1. Using Balena Etcher flash the petalinux-sdimage.wic.gz onto a 16 GB SD Card.
2. login with username petalinux
and set a new password.
3. Set up the ethernet connection and have an IP address for SFTP.
STEP 5: Creating an Accelerated application.1. Make a directory in your user space i.e., /home/petalinux
xilinx-kv260-starterkit-20221:~$ mkdir myApp
2. Copy kv260.bit.bin, kv260.dtbo, shell.json to myApp directory.
3. List the apps and you should see the below output.
xilinx-kv260-starterkit-20221:~$ sudo xmutil listapps
Accelerator Accel_type Base Base_type #slots(PL+AIE) Active_slot
k26-starter-kits XRT_FLAT k26-starter-kits XRT_FLAT (0+0) 0,
4. Move the myApp directory.
xilinx-kv260-starterkit-20221:~$ sudo mv myApp/ /lib/firmware/xilinx/
5. List the apps and you should see the below output.
xilinx-kv260-starterkit-20221:~$ sudo xmutil listapps
Accelerator Accel_type Base Base_type #slots(PL+AIE) Active_slot
k26-starter-kits XRT_FLAT k26-starter-kits XRT_FLAT (0+0) 0,
myApp XRT_FLAT myApp XRT_FLAT (0+0) -1
6. Unload the current application.
xilinx-kv260-starterkit-20221:~$ sudo xmutil unloadapp
Accelerator successfully removed.
7. Load the myApp application
xilinx-kv260-starterkit-20221:~$ sudo xmutil loadapp myApp
Accelerator loaded to slot 0
8. Execute show_dpu
or xdputil query
command
xilinx-kv260-starterkit-20221:~$ sudo show_dpu
device_core_id=0 device= 0 core = 0 fingerprint = 0x101000016010407 batch = 1 full_cu_name=unknown:dpu0
xilinx-kv260-starterkit-20221:~$ sudo xdputil query
{
"DPU IP Spec":{
"DPU Core Count":1,
"IP version":"v4.0.0",
"enable softmax":"False"
},
"VAI Version":{
"libvart-runner.so":"Xilinx vart-runner Version: 2.5.0-c26eae36f034d5a2f9b2a7bfe816b8c43311a4f8 2023-01-22-01:10:05 ",
"libvitis_ai_library-dpu_task.so":"Xilinx vitis_ai_library dpu_task Version: 2.5.0-c26eae36f034d5a2f9b2a7bfe816b8c43311a4f8 2022-06-15 07:33:00 [UTC] ",
"libxir.so":"Xilinx xir Version: xir-c26eae36f034d5a2f9b2a7bfe816b8c43311a4f8 2023-01-22-01:08:11",
"target_factory":"target-factory.2.5.0 c26eae36f034d5a2f9b2a7bfe816b8c43311a4f8"
},
"kernels":[
{
"DPU Arch":"DPUCZDX8G_ISA1_B4096",
"DPU Frequency (MHz)":275,
"cu_idx":0,
"fingerprint":"0x101000016010407",
"is_vivado_flow":true,
"name":"DPU Core 0"
}
]
}
10. Congratulations! You did it.
Thanks to all the Xilinx Support people.
Comments
Please log in or sign up to comment.