forked from WeikangQiao/TopSort
-
Notifications
You must be signed in to change notification settings - Fork 0
/
utils.mk
executable file
·130 lines (110 loc) · 3.85 KB
/
utils.mk
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
119
120
121
122
123
124
125
126
127
128
129
130
#+-------------------------------------------------------------------------------
# The following parameters are assigned with default values. These parameters can
# be overridden through the make command line
#+-------------------------------------------------------------------------------
PROFILE := no
#Generates profile summary report
ifeq ($(PROFILE), yes)
VPP_LDFLAGS += --profile_kernel data:all:all:all
endif
DEBUG := no
B_TEMP = `$(XF_PROJ_ROOT)/common/utility/parse_platform_list.py $(DEVICE)`
PERL :=
QEMU_IMODE := no
LAUNCH_EMULATOR_CMD :=
ifneq ($(PERL), /tools/xgs/perl/5.8.5/bin/perl)
QEMU_IMODE = yes
endif
ifeq ($(QEMU_IMODE), yes)
LAUNCH_EMULATOR_CMD = $(LAUNCH_EMULATOR)
else
LAUNCH_EMULATOR_CMD = $(PERL) $(XF_PROJ_ROOT)/common/utility/run_emulation.pl "${LAUNCH_EMULATOR} | tee run_app.log" "${RUN_APP_SCRIPT} $(TARGET)" "${RESULT_STRING}" "7"
endif
#Generates debug summary report
ifeq ($(DEBUG), yes)
VPP_LDFLAGS += --dk list_ports
endif
#Setting Platform Path
ifeq ($(findstring xpfm, $(DEVICE)), xpfm)
B_NAME = $(shell dirname $(DEVICE))
else
B_NAME = $(B_TEMP)/$(DEVICE)
endif
#Checks for XILINX_VITIS
check-vitis:
ifndef XILINX_VITIS
$(error XILINX_VITIS variable is not set, please set correctly and rerun)
endif
#Checks for Device Family
ifeq ($(HOST_ARCH), aarch32)
DEV_FAM = 7Series
else ifeq ($(HOST_ARCH), aarch64)
DEV_FAM = Ultrascale
endif
#Checks for XILINX_XRT
check-xrt:
ifeq ($(HOST_ARCH), x86)
ifndef XILINX_XRT
$(error XILINX_XRT variable is not set, please set correctly and rerun)
endif
else
ifndef XILINX_VITIS
$(error XILINX_VITIS variable is not set, please set correctly and rerun)
endif
endif
#Checks for Correct architecture
ifneq ($(HOST_ARCH), $(filter $(HOST_ARCH),aarch64 aarch32 x86))
$(error HOST_ARCH variable not set, please set correctly and rerun)
endif
#Checks for EDGE_COMMON_SW
ifneq ($(HOST_ARCH), x86)
ifndef EDGE_COMMON_SW
$(error EDGE_COMMON_SW variable is not set, please set correctly and rerun)
endif
ifeq ($(HOST_ARCH), aarch64)
SYSROOT := $(EDGE_COMMON_SW)/sysroots/aarch64-xilinx-linux
SD_IMAGE_FILE := $(EDGE_COMMON_SW)/Image
CXX := $(XILINX_VITIS)/gnu/aarch64/lin/aarch64-linux/bin/aarch64-linux-gnu-g++
else ifeq ($(HOST_ARCH), aarch32)
SYSROOT := $(EDGE_COMMON_SW)/sysroots/cortexa9t2hf-neon-xilinx-linux-gnueabi/
SD_IMAGE_FILE := $(EDGE_COMMON_SW)/uImage
CXX := $(XILINX_VITIS)/gnu/aarch32/lin/gcc-arm-linux-gnueabi/bin/arm-linux-gnueabihf-g++
endif
endif
gen_run_app:
ifneq ($(HOST_ARCH), x86)
rm -rf run_app.sh
$(ECHO) 'export LD_LIBRARY_PATH=/mnt:/tmp:$$LD_LIBRARY_PATH' >> run_app.sh
$(ECHO) 'export XILINX_XRT=/usr' >> run_app.sh
ifeq ($(TARGET),$(filter $(TARGET),sw_emu hw_emu))
$(ECHO) 'export XILINX_VITIS=$$PWD' >> run_app.sh
$(ECHO) 'export XCL_EMULATION_MODE=$(TARGET)' >> run_app.sh
endif
$(ECHO) '$(EXECUTABLE) merge_sort_complete.xclbin' >> run_app.sh
$(ECHO) 'return_code=$$?' >> run_app.sh
$(ECHO) 'if [ $$return_code -ne 0 ]; then' >> run_app.sh
$(ECHO) 'echo "ERROR: host run failed, RC=$$return_code"' >> run_app.sh
$(ECHO) 'fi' >> run_app.sh
$(ECHO) 'echo "INFO: host run completed."' >> run_app.sh
endif
check-devices:
ifndef DEVICE
$(error DEVICE not set. Please set the DEVICE properly and rerun. Run "make help" for more details.)
endif
# device2xsa - create a filesystem friendly name from device name
# $(1) - full name of device
device2xsa = $(strip $(patsubst %.xpfm, % , $(shell basename $(DEVICE))))
############################## Deprecated Checks and Running Rules ##############################
check:
$(ECHO) "WARNING: \"make check\" is a deprecated command. Please use \"make run\" instead"
make run
exe:
$(ECHO) "WARNING: \"make exe\" is a deprecated command. Please use \"make host\" instead"
make host
# Cleaning stuff
RM = rm -f
RMDIR = rm -rf
ECHO:= @echo
docs: README.rst
README.rst: description.json
$(XF_PROJ_ROOT)/common/utility/readme_gen/readme_gen.py description.json