1
1
#
2
- # Copyright 2019-2020 Xilinx, Inc.
2
+ # Copyright 2019-2022 Xilinx, Inc.
3
3
#
4
4
# Licensed under the Apache License, Version 2.0 (the "License");
5
5
# you may not use this file except in compliance with the License.
12
12
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
13
# See the License for the specific language governing permissions and
14
14
# limitations under the License.
15
+ # vitis makefile-generator v2.0.8
15
16
#
16
17
# +-------------------------------------------------------------------------------
17
18
# The following parameters are assigned with default values. These parameters can
@@ -25,29 +26,109 @@ DEBUG := no
25
26
# 'estimate' for estimate report generation
26
27
# 'system' for system report generation
27
28
ifneq ($(REPORT ) , no)
28
- LDCLFLAGS += --report estimate
29
- LDCLFLAGS += --report system
29
+ VPP_LDFLAGS += --report estimate
30
+ VPP_LDFLAGS += --report system
30
31
endif
31
32
32
33
# Generates profile summary report
33
34
ifeq ($(PROFILE ) , yes)
34
- LDCLFLAGS += --profile_kernel data:all:all:all
35
+ VPP_LDFLAGS += --profile_kernel data:all:all:all
35
36
endif
36
37
37
38
# Generates debug summary report
38
39
ifeq ($(DEBUG ) , yes)
39
- LDCLFLAGS += --dk protocol:all:all:all
40
+ VPP_LDFLAGS += --dk protocol:all:all:all
40
41
endif
41
42
42
- # Check environment setup
43
+ # Check vitis setup
43
44
ifndef XILINX_VITIS
44
45
XILINX_VITIS = /opt/xilinx/Vitis/$(TOOL_VERSION )
45
46
export XILINX_VITIS
46
47
endif
48
+
49
+ .PHONY : check_device
50
+ check_device :
51
+ @set -eu; \
52
+ inallowlist=False; \
53
+ inblocklist=False; \
54
+ for dev in $( PLATFORM_ALLOWLIST) ; \
55
+ do if [[ $$ (echo $( PLATFORM_NAME) | grep $$ dev) != " " ]]; \
56
+ then inallowlist=True; fi ; \
57
+ done ; \
58
+ for dev in $( PLATFORM_BLOCKLIST) ; \
59
+ do if [[ $$ (echo $( PLATFORM_NAME) | grep $$ dev) != " " ]]; \
60
+ then inblocklist=True; fi ; \
61
+ done ; \
62
+ if [[ $$ inallowlist == False ]]; \
63
+ then echo " [Warning]: The device $( PLATFORM_NAME) not in allowlist." ; \
64
+ fi ; \
65
+ if [[ $$ inblocklist == True ]]; \
66
+ then echo " [ERROR]: The device $( PLATFORM_NAME) in blocklist." ; exit 1; \
67
+ fi ;
68
+
69
+ # get HOST_ARCH by PLATFORM
70
+ ifneq (,$(PLATFORM ) )
71
+ HOST_ARCH_temp = $(shell platforminfo -p $(PLATFORM ) | grep 'CPU Type' | sed 's/.* ://' | sed '/ai_engine/d' | sed 's/^[[:space:]]* //')
72
+ ifeq ($(HOST_ARCH_temp ) , x86)
73
+ HOST_ARCH := x86
74
+ else ifeq ($(HOST_ARCH_temp), cortex-a9)
75
+ HOST_ARCH := aarch32
76
+ else ifneq (,$(findstring cortex-a, $(HOST_ARCH_temp)))
77
+ HOST_ARCH := aarch64
78
+ endif
79
+ endif
80
+
81
+
82
+
83
+ # Special processing for tool version/platform type
84
+ VITIS_VER = $(shell v++ --version | grep 'v++' | sed 's/^[[:space:]]* //' | sed -e 's/^[* ]* v++ v//g' | cut -d " " -f1)
85
+ # 1) for versal flow from 2022.1
86
+ DEVICE_TYPE = $(shell platforminfo -p $(PLATFORM ) | grep 'FPGA Family' | sed 's/.* ://' | sed '/ai_engine/d' | sed 's/^[[:space:]]* //')
87
+ ifeq ($(DEVICE_TYPE ) , versal)
88
+ ifeq ($(shell expr $(VITIS_VER ) \>= 2022.1) , 1)
89
+ LINK_TARGET_FMT := xsa
90
+ else
91
+ LINK_TARGET_FMT := xclbin
92
+ endif
93
+ else
94
+ LINK_TARGET_FMT := xclbin
95
+ endif
96
+ # 2) dfx flow
97
+ dfx_hw := off
98
+ ifeq ($(findstring _dfx_, $(PLATFORM_NAME ) ) ,_dfx_)
99
+ ifeq ($(TARGET ) ,hw)
100
+ dfx_hw := on
101
+ endif
102
+ endif
103
+ # 3) for embeded sw_emu flow from 2022.2
104
+ ps_on_x86 := off
105
+ ifneq ($(HOST_ARCH ) , x86)
106
+ ifeq ($(shell expr $(VITIS_VER ) \>= 2022.2) , 1)
107
+ ifeq ($(TARGET ) , sw_emu)
108
+ ps_on_x86 := on
109
+ HOST_ARCH := x86
110
+ endif
111
+ endif
112
+ endif
113
+
114
+ # when x86 arch, check XRT setup
115
+ ifeq ($(HOST_ARCH ) , x86)
47
116
ifndef XILINX_XRT
48
117
XILINX_XRT = /opt/xilinx/xrt
49
118
export XILINX_XRT
50
119
endif
120
+ endif
121
+
122
+ # check if need sd_card
123
+ ifeq ($(HOST_ARCH ) , aarch32)
124
+ SD_CARD_NEEDED := on
125
+ endif
126
+ ifeq ($(HOST_ARCH ) , aarch64)
127
+ SD_CARD_NEEDED := on
128
+ endif
129
+ ifeq ($(ps_on_x86 ) , on)
130
+ SD_CARD_NEEDED := on
131
+ endif
51
132
52
133
# Checks for Device Family
53
134
ifeq ($(HOST_ARCH ) , aarch32)
@@ -56,24 +137,49 @@ else ifeq ($(HOST_ARCH), aarch64)
56
137
DEV_FAM = Ultrascale
57
138
endif
58
139
59
- B_NAME = $(shell dirname $(XPLATFORM ) )
60
-
61
140
# Checks for Correct architecture
62
141
ifneq ($(HOST_ARCH ) , $(filter $(HOST_ARCH ) ,aarch64 aarch32 x86) )
63
142
$(error HOST_ARCH variable not set, please set correctly and rerun)
64
143
endif
65
144
66
- # Checks for SYSROOT
145
+ .PHONY : check_version check_sysroot check_kimage check_rootfs
146
+ check_version :
147
+ ifneq (, $(shell which git) )
148
+ ifneq (,$(wildcard $(XFLIB_DIR ) /.git) )
149
+ @cd $(XFLIB_DIR) && git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit -n 1 && cd -
150
+ endif
151
+ endif
152
+
153
+ # Set/Check SYSROOT/K_IMAGE/ROOTFS
154
+ ifneq ($(HOST_ARCH ) , x86)
155
+ ifneq (,$(findstring zc706, $(PLATFORM_NAME ) ) )
156
+ K_IMAGE ?= $(SYSROOT ) /../../uImage
157
+ else
158
+ K_IMAGE ?= $(SYSROOT ) /../../Image
159
+ endif
160
+ ROOTFS ?= $(SYSROOT ) /../../rootfs.ext4
161
+ endif
162
+
67
163
check_sysroot :
68
164
ifneq ($(HOST_ARCH ) , x86)
69
- ifndef SYSROOT
165
+ ifeq (, $( wildcard $( SYSROOT ) ) )
70
166
$(error SYSROOT ENV variable is not set, please set ENV variable correctly and rerun)
71
167
endif
72
168
endif
169
+ check_kimage :
170
+ ifneq ($(HOST_ARCH ) , x86)
171
+ ifeq (,$(wildcard $(K_IMAGE ) ) )
172
+ $(error K_IMAGE ENV variable is not set, please set ENV variable correctly and rerun)
173
+ endif
174
+ endif
175
+ check_rootfs :
176
+ ifneq ($(HOST_ARCH ) , x86)
177
+ ifeq (,$(wildcard $(ROOTFS ) ) )
178
+ $(error ROOTFS ENV variable is not set, please set ENV variable correctly and rerun)
179
+ endif
180
+ endif
73
181
74
- # Checks for g++
75
182
CXX := g++
76
- VITIS_VER = $(shell v++ --version | grep 'v++' | sed 's/^[[:space:]]* //' | sed -e 's/^[* ]* v++ v//g' | cut -d " " -f1)
77
183
ifeq ($(HOST_ARCH ) , x86)
78
184
ifeq ($(shell expr $(VITIS_VER ) \>= 2022.1) , 1)
79
185
CXX_VER := 8.3.0
@@ -94,16 +200,40 @@ endif
94
200
$(warning [WARNING] : g++ version too old. Using g++ provided by the tool: $(CXX ) )
95
201
endif
96
202
endif
97
- else ifeq ($(HOST_ARCH), aarch64)
203
+ else
204
+ ifeq ($(HOST_ARCH ) , aarch64)
98
205
CXX := $(XILINX_VITIS ) /gnu/aarch64/lin/aarch64-linux/bin/aarch64-linux-gnu-g++
99
206
else ifeq ($(HOST_ARCH), aarch32)
100
207
CXX := $(XILINX_VITIS ) /gnu/aarch32/lin/gcc-arm-linux-gnueabi/bin/arm-linux-gnueabihf-g++
101
208
endif
209
+ endif
210
+
211
+ # Check OS and setting env for xrt c++ api
212
+ OSDIST = $(shell lsb_release -i |awk -F: '{print tolower($$2) }' | tr -d ' \t' )
213
+ OSREL = $(shell lsb_release -r |awk -F: '{print tolower($$2) }' |tr -d ' \t')
214
+
215
+ # for centos and redhat
216
+ ifneq ($(findstring centos,$(OSDIST ) ) ,)
217
+ ifeq (7,$(shell echo $(OSREL ) | awk -F. '{print tolower($$1) }' ))
218
+ ifeq ($(HOST_ARCH ) , x86)
219
+ XRT_CXXFLAGS += -D_GLIBCXX_USE_CXX11_ABI=0
220
+ endif
221
+ endif
222
+ else ifneq ($(findstring redhat,$(OSDIST)),)
223
+ ifeq (7,$(shell echo $(OSREL ) | awk -F. '{print tolower($$1) }' ))
224
+ ifeq ($(HOST_ARCH ) , x86)
225
+ XRT_CXXFLAGS += -D_GLIBCXX_USE_CXX11_ABI=0
226
+ endif
227
+ endif
228
+ endif
102
229
103
230
# Setting VPP
104
231
VPP := v++
105
232
106
233
# Cheks for aiecompiler
234
+ AIECXX := aiecompiler
235
+ AIESIMULATOR := aiesimulator
236
+ X86SIMULATOR := x86simulator
107
237
108
238
.PHONY : check_vivado
109
239
check_vivado :
@@ -124,80 +254,70 @@ ifeq (,$(wildcard $(XILINX_XRT)/lib/libxilinxopencl.so))
124
254
endif
125
255
126
256
export PATH := $(XILINX_VITIS ) /bin:$(XILINX_XRT ) /bin:$(PATH )
257
+ ifeq ($(HOST_ARCH ) , x86)
127
258
ifeq (,$(LD_LIBRARY_PATH ) )
128
259
LD_LIBRARY_PATH := $(XILINX_XRT ) /lib
129
260
else
130
261
LD_LIBRARY_PATH := $(XILINX_XRT ) /lib:$(LD_LIBRARY_PATH )
131
262
endif
132
-
133
- # check target
134
- ifeq ($(filter $(TARGET ) ,sw_emu hw_emu hw) ,)
135
- $(error TARGET is not sw_emu, hw_emu or hw)
136
263
endif
137
264
138
- ifneq (,$(wildcard $(DEVICE ) ) )
139
- # Use DEVICE as a file path
140
- XPLATFORM := $(DEVICE )
265
+ ifneq (,$(wildcard $(PLATFORM ) ) )
266
+ # Use PLATFORM as a file path
267
+ XPLATFORM := $(PLATFORM )
141
268
else
142
- # Use DEVICE as a file name pattern
269
+ # Use PLATFORM as a file name pattern
143
270
# 1. search paths specified by variable
144
271
ifneq (,$(PLATFORM_REPO_PATHS ) )
145
272
# 1.1 as exact name
146
- XPLATFORM := $(strip $(foreach p, $(subst :, ,$(PLATFORM_REPO_PATHS ) ) , $(wildcard $(p ) /$(DEVICE ) /$(DEVICE ) .xpfm) ) )
273
+ XPLATFORM := $(strip $(foreach p, $(subst :, ,$(PLATFORM_REPO_PATHS ) ) , $(wildcard $(p ) /$(PLATFORM ) /$(PLATFORM ) .xpfm) ) )
147
274
# 1.2 as a pattern
148
275
ifeq (,$(XPLATFORM ) )
149
276
XPLATFORMS := $(foreach p, $(subst :, ,$(PLATFORM_REPO_PATHS ) ) , $(wildcard $(p ) /* /* .xpfm) )
150
- XPLATFORM := $(strip $(foreach p, $(XPLATFORMS ) , $(shell echo $(p ) | awk '$$1 ~ /$(DEVICE ) /') ) )
277
+ XPLATFORM := $(strip $(foreach p, $(XPLATFORMS ) , $(shell echo $(p ) | awk '$$1 ~ /$(PLATFORM ) /') ) )
151
278
endif # 1.2
152
279
endif # 1
153
280
# 2. search Vitis installation
154
281
ifeq (,$(XPLATFORM ) )
155
282
# 2.1 as exact name
156
- XPLATFORM := $(strip $(wildcard $(XILINX_VITIS ) /platforms/$(DEVICE ) /$(DEVICE ) .xpfm) )
283
+ XPLATFORM := $(strip $(wildcard $(XILINX_VITIS ) /platforms/$(PLATFORM ) /$(PLATFORM ) .xpfm) )
157
284
# 2.2 as a pattern
158
285
ifeq (,$(XPLATFORM ) )
159
286
XPLATFORMS := $(wildcard $(XILINX_VITIS ) /platforms/* /* .xpfm)
160
- XPLATFORM := $(strip $(foreach p, $(XPLATFORMS ) , $(shell echo $(p ) | awk '$$1 ~ /$(DEVICE ) /') ) )
287
+ XPLATFORM := $(strip $(foreach p, $(XPLATFORMS ) , $(shell echo $(p ) | awk '$$1 ~ /$(PLATFORM ) /') ) )
161
288
endif # 2.2
162
289
endif # 2
163
290
# 3. search default locations
164
291
ifeq (,$(XPLATFORM ) )
165
292
# 3.1 as exact name
166
- XPLATFORM := $(strip $(wildcard /opt/xilinx/platforms/$(DEVICE ) /$(DEVICE ) .xpfm) )
293
+ XPLATFORM := $(strip $(wildcard /opt/xilinx/platforms/$(PLATFORM ) /$(PLATFORM ) .xpfm) )
167
294
# 3.2 as a pattern
168
295
ifeq (,$(XPLATFORM ) )
169
296
XPLATFORMS := $(wildcard /opt/xilinx/platforms/* /* .xpfm)
170
- XPLATFORM := $(strip $(foreach p, $(XPLATFORMS ) , $(shell echo $(p ) | awk '$$1 ~ /$(DEVICE ) /') ) )
297
+ XPLATFORM := $(strip $(foreach p, $(XPLATFORMS ) , $(shell echo $(p ) | awk '$$1 ~ /$(PLATFORM ) /') ) )
171
298
endif # 3.2
172
299
endif # 3
173
300
endif
174
301
175
302
define MSG_PLATFORM
176
- No platform matched pattern '$(DEVICE ) '.
303
+ No platform matched pattern '$(PLATFORM ) '.
177
304
Available platforms are: $(XPLATFORMS )
178
- To add more platform directories, set the PLATFORM_REPO_PATHS variable or point DEVICE variable to the full path of platform .xpfm file.
305
+ To add more platform directories, set the PLATFORM_REPO_PATHS variable or point PLATFORM variable to the full path of platform .xpfm file.
179
306
endef
180
307
export MSG_PLATFORM
181
308
182
- define MSG_DEVICE
183
- More than one platform matched: $(XPLATFORM )
184
- Please set DEVICE variable more accurately to select only one platform file, or set DEVICE variable to the full path of the platform .xpfm file.
185
- endef
186
- export MSG_DEVICE
187
309
188
310
.PHONY : check_platform
189
311
check_platform :
190
312
ifeq (,$(XPLATFORM ) )
191
313
@echo "$${MSG_PLATFORM}" && false
192
314
endif
193
- ifneq (,$(word 2,$(XPLATFORM ) ) )
194
- @echo "$${MSG_DEVICE}" && false
195
- endif
196
315
# Check ends
197
316
198
317
# device2xsa - create a filesystem friendly name from device name
199
318
# $(1) - full name of device
200
- device2xsa = $(strip $(patsubst % .xpfm, % , $(shell basename $(DEVICE ) ) ) )
319
+ PLATFORM_NAME = $(strip $(patsubst % .xpfm, % , $(shell basename $(PLATFORM ) ) ) )
320
+
201
321
202
322
# Cleaning stuff
203
323
RM = rm -f
@@ -206,9 +326,3 @@ RMDIR = rm -rf
206
326
MV = mv -f
207
327
CP = cp -rf
208
328
ECHO: = @echo
209
- ifneq (,$(shell echo $(XPLATFORM ) | awk '/xilinx_u280_xdma_201920_3/') )
210
- VPP_FLAGS += --advanced.param compiler.ignorePlatformCompatibilityCheck=true
211
- ifeq ($(TARGET ) , hw)
212
- VPP_LDFLAGS += --advanced.param compiler.userPreSysLinkOverlayTcl=preSysLink.tcl
213
- endif
214
- endif
0 commit comments