forked from Xilinx/Vitis-Tutorials
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.emu
118 lines (94 loc) · 3.89 KB
/
Makefile.emu
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# /*
# Copyright (C) 2023, Advanced Micro Devices, Inc. All rights reserved.
# SPDX-License-Identifier: X11
# */
TARGET = hw_emu
PLATFORM ?= ${PLATFORM_REPO_PATHS}/xilinx_vck190_base_202220_1/xilinx_vck190_base_202220_1.xpfm
XSA = bf_${TARGET}.xsa
HOST_EXE = host.exe
ROOTFS = ${PLATFORM_REPO_PATHS}/sw/versal/xilinx-versal-common-v2022.2/rootfs.ext4
IMAGE = ${PLATFORM_REPO_PATHS}/sw/versal/xilinx-versal-common-v2022.2/Image
GRAPH = aie/graph.cpp
LIBADF = libadf.a
AIE_CMPL_CMD = aiecompiler -log-level=5 -v -platform=${PLATFORM} --pl-freq=500 -genArchive -include="./aie" -include="./aie/inc" -include="./aie/kernels" -include="./data" -include="./" --xlopt=0 -workdir=./Work ${GRAPH}
AIE_SIM_CMD = aiesimulator --pkg-dir=./Work
EMU_CMD = ./launch_hw_emu.sh -timeout 18000
##########################################################################################################################################################
### DO NOT MODIFY BELOW THIS LINE UNLESS NECESSARY
################################################################################################################################################
XOS = $(subst .cpp,.xo,$(wildcard pl_kernels/*.cpp))
VCC = v++
VPP_SPEC = system.cfg
VPP_FLAGS=--save-temps --verbose --config ${VPP_SPEC}
.PHONY: clean
all: xsa host package data
run: all run_hw_emu
sd_card: all
aie: ${LIBADF}
${LIBADF}: ${GRAPH}
${AIE_CMPL_CMD}
aiesim: ${LIBADF}
${AIE_SIM_CMD}
xsa: guard-PLATFORM_REPO_PATHS ${XSA}
${XSA}: ${LIBADF} ${VPP_SPEC} ${XOS}
${VCC} -g -l --platform ${PLATFORM} ${XOS} ${LIBADF} \
-t ${TARGET} ${VPP_FLAGS} -o $@
kernels: guard-PLATFORM_REPO_PATHS ${XOS}
${XOS}:
make -C pl_kernels/
host: guard-CXX guard-SDKTARGETSYSROOT ${HOST_EXE}
${HOST_EXE}: sw/*.cpp
make -C sw/
###
# Guarding Checks. Do not modify.
###
check_defined = \
$(strip $(foreach 1,$1, \
$(call __check_defined,$1,$(strip $(value 2)))))
__check_defined = \
$(if $(value $1),, \
$(error Undefined $1$(if $2, ($2))))
guard-PLATFORM_REPO_PATHS:
$(call check_defined, PLATFORM_REPO_PATHS, Set to location of xilinx_vck190_base_202210_1 platform)
guard-ROOTFS:
$(call check_defined, ROOTFS, Set to location of xilinx-versal-common-v2022.2/rootfs.ext4)
guard-IMAGE:
$(call check_defined, IMAGE, Set to location of xilinx-versal-common-v2022.2/Image)
guard-CXX:
$(call check_defined, CXX, Ensure xilinx-versal-common-v2022.2/environment-setup-aarch64-xilinx-linux script was run)
guard-SDKTARGETSYSROOT:
$(call check_defined, SDKTARGETSYSROOT, Ensure xilinx-versal-common-v2022.2/environment-setup-aarch64-xilinx-linux script was run)
###
data:
wget https://www.xilinx.com/bin/public/openDownload?filename=beamformer_data.zip -O beamformer_data.zip && unzip beamformer_data.zip
package: guard-ROOTFS guard-IMAGE guard-PLATFORM_REPO_PATHS package_${TARGET}
package_${TARGET}: ${LIBADF} ${XSA} ${HOST_EXE} data
${VCC} -p -t ${TARGET} -f ${PLATFORM} ${XSA} ${LIBADF} \
--package.rootfs ${ROOTFS} \
--package.kernel_image ${IMAGE} \
--package.boot_mode=sd \
--package.image_format=ext4 \
--package.defer_aie_run \
--package.sd_dir data \
--package.sd_file embedded_exec.sh \
--package.sd_file ${HOST_EXE}
package_dbg: guard-ROOTFS guard-IMAGE guard-PLATFORM_REPO_PATHS package_dbg_${TARGET}
package_dbg_${TARGET}: ${LIBADF} ${XSA} ${HOST_EXE} data
${VCC} -p -t ${TARGET} -f ${PLATFORM} ${XSA} ${LIBADF} \
--package.rootfs ${ROOTFS} \
--package.kernel_image ${IMAGE} \
--package.boot_mode=sd \
--package.image_format=ext4 \
--package.defer_aie_run \
--package.enable_aie_debug \
--package.sd_dir data \
--package.sd_file ${HOST_EXE}
run_hw_emu: launch_hw_emu.sh
launch_hw_emu.sh: package_hw_emu
$(EMU_CMD)
clean:
rm -rf _x v++_* ${XOS} ${OS} ${LIBADF} *.o.* *.o *.xpe *.xo.* \
vck190_aie_base*.xclbin* *.xsa *.log *.jou xnwOut Work Map_Report.csv \
ilpProblem* sol.db drivers .Xil
make -C pl_kernels clean
make -C sw clean