The Hardware design is simplified by a Tcl script which generates the Block Diagram, the wrapper, and the constraints file. Finally, it generates the bitfile.
}' 'ash: ./scripts/Resnet50_ultra96.tcl: line 141:
} else {john@john-virtual-machine:~/ultra96/Resnet50_Ultra96v1_2019_2$ export TRD_HOME= ( p w d ) j o h n @ j o h n − v i r t u a l − m a c h i n e : / u l t r a 96 / R e s n e t 5 0 U l t r a 96 v 1 2 01 9 2 (pwd) john@john-virtual-machine:~/ultra96/Resnet50_Ultra96v1_2019_2 (pwd)john@john−virtual−machine: /ultra96/Resnet50Ultra96v120192 export PET_PROJ=“ultra96v1”
john@john-virtual-machine:~/ultra96/Resnet50_Ultra96v1_2019_2$ cd T R D H O M E / a p u / r e s n e t 5 0 u l t r a 96 v 1 b s p / TRD_HOME/apu/resnet50_ultra96v1_bsp/ TRDHOME/apu/resnet50ultra96v1bsp/PET_PROJ/
Building the PetaLinux project requires the following sequence of operations:
The Petalinux project is simplified by the presence of the resnet50_ultra96.bsp file that has the steps from 2 to 8 already completed.
Start this process by loading the PetaLinux 2019.2 environment.
Set two useful variables
cd
export TRD_HOME=$(pwd)
export PET_PROJ=“ultra96v1”
Create the PetaLinux project
cd $TRD_HOME/apu/resnet50_ultra96v1_bsp/
petalinux-create -t project -s resnet50_ultra96.bsp -n $PET_PROJ --force
Configure the PetaLinux project with HW design
cd T R D H O M E / a p u / r e s n e t 5 0 u l t r a 96 v 1 b s p / TRD_HOME/apu/resnet50_ultra96v1_bsp/ TRDHOME/apu/resnet50ultra96v1bsp/PET_PROJ/
petalinux-config --get-hw-description=$TRD_HOME/pl/prj/ultra96/ --silentconfig
Build the PetaLinux project
petalinux-build
Create BOOT.BIN and image.ub for the SD card
cd T R D H O M E / a p u / r e s n e t 5 0 u l t r a 96 v 1 b s p / TRD_HOME/apu/resnet50_ultra96v1_bsp/ TRDHOME/apu/resnet50ultra96v1bsp/PET_PROJ/images/linux
petalinux-package --boot --fsbl zynqmp_fsbl.elf --u-boot u-boot.elf --pmufw pmufw.elf --fpga system.bit --force
cp BOOT.BIN image.ub $TRD_HOME/SDcard
Generate a new SDK
cd T R D H O M E / a p u / r e s n e t 5 0 u l t r a 96 v 1 b s p / TRD_HOME/apu/resnet50_ultra96v1_bsp/ TRDHOME/apu/resnet50ultra96v1bsp/PET_PROJ/
petalinux-build -s
john@john-virtual-machine:~/ultra96/Resnet50_Ultra96v1_2019_2/apu/resnet50_ultra96v1_bsp/ultra96v1$ cp T R D H O M E / a p u / r e s n e t 5 0 u l t r a 96 v 1 b s p / TRD_HOME/apu/resnet50_ultra96v1_bsp/ TRDHOME/apu/resnet50ultra96v1bsp/PET_PROJ/images/linux/sdk.sh $TRD_HOME/apu/apps/
Extract the SDK
cd $TRD_HOME/apu/apps
chmod 777 sdk.sh
john@john-virtual-machine:~/ultra96/Resnet50_Ultra96v1_2019_2/apu/apps$ ./sdk.sh -d ./sdk -y
Build the ResNet-50 example
The original main.cc and Makefile come from xilinx_dnndk_v3.1
However the main.cc in xilinx_dnndk_v3.1/Ultra96 does not use the DPU SoftMax.
A fixed version of main.cc and Makefile have been included in this LFAR and can be found in $TRD_HOME/apu/apps/resnet50
ResNet-50 can be compiled in a terminal configured for Vivado 2019.2.
unset LD_LIBRARY_PATH
. $TRD_HOME/apu/apps/sdk/environment-setup-aarch64-xilinx-linux
.是个真真正正的命令。它是source命令的代名词,所以你可以用它在当前 shell 中执行一个文件,而不是以某种其它的方式去运行一个脚本文件(这通常指的是 Bash 会产生一个新的 shell 去运行它)
cd $TRD_HOME/apu/apps/resnet50
make
Update the SD card content
cp -f $TRD_HOME/apu/apps/resnet50/build/resnet50 $TRD_HOME/SDcard/resnet50/
Installing the DNNDK Host Tools
After downloading and unpacking the DNNDK package, execute the sudo ./install.sh command under the host_x86 folder to install the DECENT,DNNC, DDump and DLet tools on the host.
在这里要先安装dnndk_v3.1
cp –r xilinx_dnndk_v3.1/common $TRD_HOME/SDcard/
john@john-virtual-machine:/media/john/root/sbin$ sudo tar -zxvf rootfs.tar.gz -C /media/john/root
SD卡的init.sysvinit大小多次变为零,原因不详,强行将其属性改为555
sudo chmod 555 /media/john/root/sbin/init.sysvinit
Insert the DS card in the Ultra96 and switch it on. After boot, login with ID root and password root. Change directory to the application folder.
cd /run/media/mmcblk0p1/resnet50
Run the ResNet application
./resnet50
本文参考官方指南:
XILINX INTERNAL Xilinx Answer 73118 – ResNet-50 implemented on an Ultra96 v1 board using Vivado and PetaLinux 2019.2 6
《Long Form Answer Record 73118: ResNet-50 implemented on an Ultra96 v1 board using Vivado and PetaLinux 2019.2》