Skip to content

Commit d72425b

Browse files
Virat Agarwalheeran-xilinx
authored andcommitted
Adding sections to Examples' Makefile (#399)
1 parent 4e6d5fd commit d72425b

File tree

76 files changed

+924
-168
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+924
-168
lines changed

common/utility/makefile_gen/makegen.py

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,10 @@
99
#ini flags
1010
config_file = 0
1111

12-
def create_params(target,data):
12+
def create_params(target,data):
13+
target.write("############################## Setting up Project Variables ##############################\n")
1314
target.write("# Points to top directory of Git repository\n")
15+
1416
dirName = os.getcwd()
1517
dirNameList = list(dirName.split("/"))
1618
dirNameIndex = dirNameList.index("Vitis_Accel_Examples")
@@ -100,6 +102,9 @@ def add_includes2(target, data):
100102
return
101103

102104
def add_host_flags(target, data):
105+
target.write("############################## Setting up Host Variables ##############################\n")
106+
target.write("#Include Required Host Source Files\n")
107+
103108
target.write("HOST_SRCS += ")
104109
source_flag = 0
105110
if "sources" in data["host"]["compiler"]:
@@ -134,7 +139,9 @@ def add_host_flags(target, data):
134139
return
135140

136141
def add_kernel_flags(target, data):
142+
target.write("############################## Setting up Kernel Variables ##############################\n")
137143
target.write("# Kernel compiler global settings\n")
144+
138145
target.write("CLFLAGS += ")
139146
target.write("-t $(TARGET) --platform $(DEVICE) --save-temps \n")
140147
target.write("ifneq ($(TARGET), hw)\n")
@@ -221,6 +228,8 @@ def add_kernel_flags(target, data):
221228
return
222229

223230
def add_containers(target, data):
231+
target.write("############################## Declaring Binary Containers ##############################\n")
232+
224233
if "containers" in data:
225234
for con in data["containers"]:
226235
target.write("BINARY_CONTAINERS += $(BUILD_DIR)/")
@@ -236,8 +245,8 @@ def add_containers(target, data):
236245
target.write("\n")
237246

238247
def building_kernel(target, data):
239-
target.write("# Building kernel\n")
240248
if "containers" in data:
249+
target.write("############################## Setting Rules for Binary Containers (Building Kernels) ##############################\n")
241250
for con in data["containers"]:
242251
if "accelerators" in con:
243252
for acc in con["accelerators"]:
@@ -256,7 +265,6 @@ def building_kernel(target, data):
256265
target.write(acc["name"])
257266
target.write(" -I'$(<D)'")
258267
target.write(" -o'$@' '$<'\n")
259-
if "containers" in data:
260268
for con in data["containers"]:
261269
target.write("$(BUILD_DIR)/")
262270
target.write(con["name"])
@@ -295,7 +303,8 @@ def building_kernel_rtl(target, data):
295303
return
296304

297305
def building_host(target, data):
298-
target.write("# Building Host\n")
306+
target.write("############################## Setting Rules for Host (Building Host Executable) ##############################\n")
307+
299308
target.write("$(EXECUTABLE): check-xrt $(HOST_SRCS) $(HOST_HDRS)\n")
300309
target.write("\t$(CXX) $(CXXFLAGS) $(HOST_SRCS) $(HOST_HDRS) -o '$@' $(LDFLAGS)\n")
301310
target.write("\n")
@@ -315,6 +324,8 @@ def profile_report(target):
315324
return
316325

317326
def mk_clean(target, data):
327+
target.write("############################## Cleaning Rules ##############################\n")
328+
318329
target.write("# Cleaning stuff\n")
319330
target.write("clean:\n")
320331
target.write("\t-$(RMDIR) $(EXECUTABLE) $(XCLBIN)/{*sw_emu*,*hw_emu*} \n")
@@ -338,6 +349,7 @@ def mk_clean(target, data):
338349
return
339350

340351
def mk_build_all(target, data):
352+
target.write("############################## Setting Targets ##############################\n")
341353
target.write("CP = cp -rf\n")
342354

343355
args = []
@@ -377,6 +389,8 @@ def mk_build_all(target, data):
377389
return
378390

379391
def mk_check(target, data):
392+
target.write("############################## Setting Essential Checks and Running Rules ##############################\n")
393+
380394
target.write("check: all\n")
381395
if "ndevice" in data:
382396
for board in data["ndevice"]:
@@ -493,6 +507,7 @@ def mk_check(target, data):
493507
target.write("\n")
494508
target.write("\n\n")
495509

510+
target.write("############################## Preparing sdcard ##############################\n")
496511
target.write("sd_card: gen_run_app\n")
497512
extra_file_list = []
498513
if "launch" in data:
@@ -531,6 +546,8 @@ def aws_build(target):
531546
target.write("\t$(COMMON_REPO)/common/utility/aws/run_aws.py $(BINARY_CONTAINERS)\n\n")
532547

533548
def mk_help(target):
549+
target.write("############################## Help Section ##############################\n")
550+
534551
target.write(".PHONY: help\n")
535552
target.write("\n")
536553
target.write("help::\n")

cpp_kernels/array_partition/Makefile

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
############################## Help Section ##############################
12
.PHONY: help
23

34
help::
@@ -28,6 +29,7 @@ help::
2829
$(ECHO) " By default, HOST_ARCH=x86. HOST_ARCH and EDGE_COMMON_SW is required for SoC shells"
2930
$(ECHO) ""
3031

32+
############################## Setting up Project Variables ##############################
3133
# Points to top directory of Git repository
3234
COMMON_REPO = ../../
3335
PWD = $(shell readlink -f .)
@@ -62,6 +64,8 @@ HOST_SRCS += $(xcl2_SRCS)
6264
CXXFLAGS += $(opencl_CXXFLAGS) -Wall -O0 -g -std=c++11
6365
LDFLAGS += $(opencl_LDFLAGS)
6466

67+
############################## Setting up Host Variables ##############################
68+
#Include Required Host Source Files
6569
HOST_SRCS += src/host.cpp
6670

6771
# Host compiler global settings
@@ -72,6 +76,7 @@ ifneq ($(HOST_ARCH), x86)
7276
LDFLAGS += --sysroot=$(SYSROOT)
7377
endif
7478

79+
############################## Setting up Kernel Variables ##############################
7580
# Kernel compiler global settings
7681
CLFLAGS += -t $(TARGET) --platform $(DEVICE) --save-temps
7782
ifneq ($(TARGET), hw)
@@ -85,10 +90,12 @@ CMD_ARGS = $(BUILD_DIR)/matmul.xclbin
8590
EMCONFIG_DIR = $(TEMP_DIR)
8691
EMU_DIR = $(SDCARD)/data/emulation
8792

93+
############################## Declaring Binary Containers ##############################
8894
BINARY_CONTAINERS += $(BUILD_DIR)/matmul.xclbin
8995
BINARY_CONTAINER_matmul_OBJS += $(TEMP_DIR)/matmul.xo
9096
BINARY_CONTAINER_matmul_OBJS += $(TEMP_DIR)/matmul_partition.xo
9197

98+
############################## Setting Targets ##############################
9299
CP = cp -rf
93100

94101
.PHONY: all clean cleanall docs emconfig
@@ -100,7 +107,7 @@ exe: $(EXECUTABLE)
100107
.PHONY: build
101108
build: check-vitis $(BINARY_CONTAINERS)
102109

103-
# Building kernel
110+
############################## Setting Rules for Binary Containers (Building Kernels) ##############################
104111
$(TEMP_DIR)/matmul.xo: src/matmul.cpp
105112
mkdir -p $(TEMP_DIR)
106113
$(VPP) $(CLFLAGS) --temp_dir $(TEMP_DIR) -c -k matmul -I'$(<D)' -o'$@' '$<'
@@ -111,14 +118,15 @@ $(BUILD_DIR)/matmul.xclbin: $(BINARY_CONTAINER_matmul_OBJS)
111118
mkdir -p $(BUILD_DIR)
112119
$(VPP) $(CLFLAGS) --temp_dir $(BUILD_DIR) -l $(LDCLFLAGS) -o'$@' $(+)
113120

114-
# Building Host
121+
############################## Setting Rules for Host (Building Host Executable) ##############################
115122
$(EXECUTABLE): check-xrt $(HOST_SRCS) $(HOST_HDRS)
116123
$(CXX) $(CXXFLAGS) $(HOST_SRCS) $(HOST_HDRS) -o '$@' $(LDFLAGS)
117124

118125
emconfig:$(EMCONFIG_DIR)/emconfig.json
119126
$(EMCONFIG_DIR)/emconfig.json:
120127
emconfigutil --platform $(DEVICE) --od $(EMCONFIG_DIR)
121128

129+
############################## Setting Essential Checks and Running Rules ##############################
122130
check: all
123131
ifeq ($(TARGET),$(filter $(TARGET),sw_emu hw_emu))
124132
ifeq ($(HOST_ARCH), x86)
@@ -150,11 +158,13 @@ endif
150158
endif
151159

152160

161+
############################## Preparing sdcard ##############################
153162
sd_card: gen_run_app
154163
ifneq ($(HOST_ARCH), x86)
155164
$(VPP) -t $(TARGET) --platform $(DEVICE) -p $(BUILD_DIR)/matmul.xclbin --package.out_dir $(PACKAGE_OUT) --package.rootfs $(EDGE_COMMON_SW)/rootfs.ext4 --package.sd_file $(SD_IMAGE_FILE) --package.sd_file xrt.ini --package.sd_file $(RUN_APP_SCRIPT) --package.sd_file $(EXECUTABLE) -o matmul.xclbin
156165
endif
157166

167+
############################## Cleaning Rules ##############################
158168
# Cleaning stuff
159169
clean:
160170
-$(RMDIR) $(EXECUTABLE) $(XCLBIN)/{*sw_emu*,*hw_emu*}

cpp_kernels/bind_op_storage/Makefile

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
############################## Help Section ##############################
12
.PHONY: help
23

34
help::
@@ -28,6 +29,7 @@ help::
2829
$(ECHO) " By default, HOST_ARCH=x86. HOST_ARCH and EDGE_COMMON_SW is required for SoC shells"
2930
$(ECHO) ""
3031

32+
############################## Setting up Project Variables ##############################
3133
# Points to top directory of Git repository
3234
COMMON_REPO = ../../
3335
PWD = $(shell readlink -f .)
@@ -62,6 +64,8 @@ HOST_SRCS += $(xcl2_SRCS)
6264
CXXFLAGS += $(opencl_CXXFLAGS) -Wall -O0 -g -std=c++11
6365
LDFLAGS += $(opencl_LDFLAGS)
6466

67+
############################## Setting up Host Variables ##############################
68+
#Include Required Host Source Files
6569
HOST_SRCS += src/host.cpp
6670

6771
# Host compiler global settings
@@ -72,6 +76,7 @@ ifneq ($(HOST_ARCH), x86)
7276
LDFLAGS += --sysroot=$(SYSROOT)
7377
endif
7478

79+
############################## Setting up Kernel Variables ##############################
7580
# Kernel compiler global settings
7681
CLFLAGS += -t $(TARGET) --platform $(DEVICE) --save-temps
7782
ifneq ($(TARGET), hw)
@@ -85,9 +90,11 @@ CMD_ARGS = $(BUILD_DIR)/vadd.xclbin
8590
EMCONFIG_DIR = $(TEMP_DIR)
8691
EMU_DIR = $(SDCARD)/data/emulation
8792

93+
############################## Declaring Binary Containers ##############################
8894
BINARY_CONTAINERS += $(BUILD_DIR)/vadd.xclbin
8995
BINARY_CONTAINER_vadd_OBJS += $(TEMP_DIR)/vadd.xo
9096

97+
############################## Setting Targets ##############################
9198
CP = cp -rf
9299

93100
.PHONY: all clean cleanall docs emconfig
@@ -99,22 +106,23 @@ exe: $(EXECUTABLE)
99106
.PHONY: build
100107
build: check-vitis $(BINARY_CONTAINERS)
101108

102-
# Building kernel
109+
############################## Setting Rules for Binary Containers (Building Kernels) ##############################
103110
$(TEMP_DIR)/vadd.xo: src/vadd.cpp
104111
mkdir -p $(TEMP_DIR)
105112
$(VPP) $(CLFLAGS) --temp_dir $(TEMP_DIR) -c -k vadd -I'$(<D)' -o'$@' '$<'
106113
$(BUILD_DIR)/vadd.xclbin: $(BINARY_CONTAINER_vadd_OBJS)
107114
mkdir -p $(BUILD_DIR)
108115
$(VPP) $(CLFLAGS) --temp_dir $(BUILD_DIR) -l $(LDCLFLAGS) -o'$@' $(+)
109116

110-
# Building Host
117+
############################## Setting Rules for Host (Building Host Executable) ##############################
111118
$(EXECUTABLE): check-xrt $(HOST_SRCS) $(HOST_HDRS)
112119
$(CXX) $(CXXFLAGS) $(HOST_SRCS) $(HOST_HDRS) -o '$@' $(LDFLAGS)
113120

114121
emconfig:$(EMCONFIG_DIR)/emconfig.json
115122
$(EMCONFIG_DIR)/emconfig.json:
116123
emconfigutil --platform $(DEVICE) --od $(EMCONFIG_DIR)
117124

125+
############################## Setting Essential Checks and Running Rules ##############################
118126
check: all
119127
ifeq ($(TARGET),$(filter $(TARGET),sw_emu hw_emu))
120128
ifeq ($(HOST_ARCH), x86)
@@ -146,11 +154,13 @@ endif
146154
endif
147155

148156

157+
############################## Preparing sdcard ##############################
149158
sd_card: gen_run_app
150159
ifneq ($(HOST_ARCH), x86)
151160
$(VPP) -t $(TARGET) --platform $(DEVICE) -p $(BUILD_DIR)/vadd.xclbin --package.out_dir $(PACKAGE_OUT) --package.rootfs $(EDGE_COMMON_SW)/rootfs.ext4 --package.sd_file $(SD_IMAGE_FILE) --package.sd_file xrt.ini --package.sd_file $(RUN_APP_SCRIPT) --package.sd_file $(EXECUTABLE) -o vadd.xclbin
152161
endif
153162

163+
############################## Cleaning Rules ##############################
154164
# Cleaning stuff
155165
clean:
156166
-$(RMDIR) $(EXECUTABLE) $(XCLBIN)/{*sw_emu*,*hw_emu*}

cpp_kernels/burst_rw/Makefile

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
############################## Help Section ##############################
12
.PHONY: help
23

34
help::
@@ -28,6 +29,7 @@ help::
2829
$(ECHO) " By default, HOST_ARCH=x86. HOST_ARCH and EDGE_COMMON_SW is required for SoC shells"
2930
$(ECHO) ""
3031

32+
############################## Setting up Project Variables ##############################
3133
# Points to top directory of Git repository
3234
COMMON_REPO = ../../
3335
PWD = $(shell readlink -f .)
@@ -63,6 +65,8 @@ HOST_SRCS += $(xcl2_SRCS) $(bitmap_SRCS)
6365
CXXFLAGS += $(opencl_CXXFLAGS) -Wall -O0 -g -std=c++11
6466
LDFLAGS += $(opencl_LDFLAGS)
6567

68+
############################## Setting up Host Variables ##############################
69+
#Include Required Host Source Files
6670
HOST_SRCS += src/host.cpp
6771

6872
# Host compiler global settings
@@ -73,6 +77,7 @@ ifneq ($(HOST_ARCH), x86)
7377
LDFLAGS += --sysroot=$(SYSROOT)
7478
endif
7579

80+
############################## Setting up Kernel Variables ##############################
7681
# Kernel compiler global settings
7782
CLFLAGS += -t $(TARGET) --platform $(DEVICE) --save-temps
7883
ifneq ($(TARGET), hw)
@@ -86,9 +91,11 @@ CMD_ARGS = $(BUILD_DIR)/vadd.xclbin
8691
EMCONFIG_DIR = $(TEMP_DIR)
8792
EMU_DIR = $(SDCARD)/data/emulation
8893

94+
############################## Declaring Binary Containers ##############################
8995
BINARY_CONTAINERS += $(BUILD_DIR)/vadd.xclbin
9096
BINARY_CONTAINER_vadd_OBJS += $(TEMP_DIR)/vadd.xo
9197

98+
############################## Setting Targets ##############################
9299
CP = cp -rf
93100

94101
.PHONY: all clean cleanall docs emconfig
@@ -100,22 +107,23 @@ exe: $(EXECUTABLE)
100107
.PHONY: build
101108
build: check-vitis $(BINARY_CONTAINERS)
102109

103-
# Building kernel
110+
############################## Setting Rules for Binary Containers (Building Kernels) ##############################
104111
$(TEMP_DIR)/vadd.xo: src/vadd.cpp
105112
mkdir -p $(TEMP_DIR)
106113
$(VPP) $(CLFLAGS) --temp_dir $(TEMP_DIR) -c -k vadd -I'$(<D)' -o'$@' '$<'
107114
$(BUILD_DIR)/vadd.xclbin: $(BINARY_CONTAINER_vadd_OBJS)
108115
mkdir -p $(BUILD_DIR)
109116
$(VPP) $(CLFLAGS) --temp_dir $(BUILD_DIR) -l $(LDCLFLAGS) -o'$@' $(+)
110117

111-
# Building Host
118+
############################## Setting Rules for Host (Building Host Executable) ##############################
112119
$(EXECUTABLE): check-xrt $(HOST_SRCS) $(HOST_HDRS)
113120
$(CXX) $(CXXFLAGS) $(HOST_SRCS) $(HOST_HDRS) -o '$@' $(LDFLAGS)
114121

115122
emconfig:$(EMCONFIG_DIR)/emconfig.json
116123
$(EMCONFIG_DIR)/emconfig.json:
117124
emconfigutil --platform $(DEVICE) --od $(EMCONFIG_DIR)
118125

126+
############################## Setting Essential Checks and Running Rules ##############################
119127
check: all
120128
ifeq ($(TARGET),$(filter $(TARGET),sw_emu hw_emu))
121129
ifeq ($(HOST_ARCH), x86)
@@ -147,11 +155,13 @@ endif
147155
endif
148156

149157

158+
############################## Preparing sdcard ##############################
150159
sd_card: gen_run_app
151160
ifneq ($(HOST_ARCH), x86)
152161
$(VPP) -t $(TARGET) --platform $(DEVICE) -p $(BUILD_DIR)/vadd.xclbin --package.out_dir $(PACKAGE_OUT) --package.rootfs $(EDGE_COMMON_SW)/rootfs.ext4 --package.sd_file $(SD_IMAGE_FILE) --package.sd_file xrt.ini --package.sd_file $(RUN_APP_SCRIPT) --package.sd_file $(EXECUTABLE) -o vadd.xclbin
153162
endif
154163

164+
############################## Cleaning Rules ##############################
155165
# Cleaning stuff
156166
clean:
157167
-$(RMDIR) $(EXECUTABLE) $(XCLBIN)/{*sw_emu*,*hw_emu*}

0 commit comments

Comments
 (0)