Skip to content

Commit 491b910

Browse files
Virat Agarwalheeran-xilinx
authored andcommitted
Makefile updates (#536)
1 parent c21f6c8 commit 491b910

File tree

96 files changed

+266
-532
lines changed

Some content is hidden

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

96 files changed

+266
-532
lines changed

common/utility/makefile_gen/makegen.py

Lines changed: 71 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,9 @@ def create_params(target,data):
4242
target.write("\n")
4343

4444
target.write("VPP := v++\n")
45-
target.write("SDCARD := ")
46-
target.write("sd_card\n")
45+
if not ("platform_type" in data and data["platform_type"] == "pcie"):
46+
target.write("SDCARD := ")
47+
target.write("sd_card\n")
4748
target.write("\n")
4849
target.write("include $(ABS_COMMON_REPO)/common/includes/opencl/opencl.mk\n")
4950
if "config_make" in data:
@@ -191,7 +192,8 @@ def add_kernel_flags(target, data):
191192
target.write("\n")
192193

193194
target.write("EMCONFIG_DIR = $(TEMP_DIR)\n")
194-
target.write("EMU_DIR = $(SDCARD)/data/emulation\n")
195+
if not ("platform_type" in data and data["platform_type"] == "pcie"):
196+
target.write("EMU_DIR = $(SDCARD)/data/emulation\n")
195197
target.write("\n")
196198

197199
if "v++" in data:
@@ -335,8 +337,8 @@ def building_kernel_rtl(target, data):
335337
def building_host(target, data):
336338
target.write("############################## Setting Rules for Host (Building Host Executable) ##############################\n")
337339

338-
target.write("$(EXECUTABLE): check-xrt $(HOST_SRCS) $(HOST_HDRS)\n")
339-
target.write("\t$(CXX) $(CXXFLAGS) $(HOST_SRCS) $(HOST_HDRS) -o '$@' $(LDFLAGS)\n")
340+
target.write("$(EXECUTABLE): $(HOST_SRCS) | check-xrt\n")
341+
target.write("\t $(CXX) -o $@ $^ $(CXXFLAGS) $(LDFLAGS)\n")
340342
target.write("\n")
341343
target.write("emconfig:$(EMCONFIG_DIR)/emconfig.json\n")
342344
target.write("$(EMCONFIG_DIR)/emconfig.json:\n")
@@ -364,7 +366,10 @@ def mk_clean(target, data):
364366
target.write("\n")
365367

366368
target.write("cleanall: clean\n")
367-
target.write("\t-$(RMDIR) build_dir* sd_card*\n")
369+
target.write("\t-$(RMDIR) build_dir*")
370+
if not ("platform_type" in data and data["platform_type"] == "pcie"):
371+
target.write(" sd_card*")
372+
target.write("\n")
368373
target.write("\t-$(RMDIR) package.*\n")
369374
target.write("\t-$(RMDIR) _x* *xclbin.run_summary qemu-memory-_* emulation _vimage pl* start_simulation.sh *.xclbin\n")
370375
if "output_files" in data:
@@ -392,8 +397,10 @@ def mk_build_all(target, data):
392397
target.write("\n")
393398

394399
target.write(".PHONY: all clean cleanall docs emconfig\n")
395-
target.write("all: check-devices $(EXECUTABLE) $(BINARY_CONTAINERS) emconfig sd_card\n")
396-
target.write("\n")
400+
target.write("all: check-devices $(EXECUTABLE) $(BINARY_CONTAINERS) emconfig")
401+
if not ("platform_type" in data and data["platform_type"] == "pcie"):
402+
target.write(" sd_card")
403+
target.write("\n\n")
397404

398405
target.write(".PHONY: host\n")
399406
target.write("host: $(EXECUTABLE)\n")
@@ -450,7 +457,8 @@ def mk_run(target, data):
450457
target.write("endif\n")
451458
target.write("\n")
452459
target.write("ifeq ($(TARGET),$(filter $(TARGET),sw_emu hw_emu))\n")
453-
target.write("ifeq ($(HOST_ARCH), x86)\n")
460+
if not ("platform_type" in data and data["platform_type"] == "pcie"):
461+
target.write("ifeq ($(HOST_ARCH), x86)\n")
454462
target.write("\t$(CP) $(EMCONFIG_DIR)/emconfig.json .\n")
455463
target.write("\tXCL_EMULATION_MODE=$(TARGET) $(EXECUTABLE)")
456464

@@ -462,15 +470,18 @@ def mk_run(target, data):
462470
arg = arg.replace('BUILD', '$(BUILD_DIR)')
463471
arg = arg.replace('PROJECT', '.')
464472
target.write(arg)
465-
target.write("\nelse\n")
466-
target.write("\t$(ABS_COMMON_REPO)/common/utility/run_emulation.pl \"${LAUNCH_EMULATOR} | tee run_app.log\" \"${RUN_APP_SCRIPT} $(TARGET)\" \"${RESULT_STRING}\" \"7\"")
473+
if not ("platform_type" in data and data["platform_type"] == "pcie"):
474+
target.write("\nelse\n")
475+
target.write("\t$(ABS_COMMON_REPO)/common/utility/run_emulation.pl \"${LAUNCH_EMULATOR} | tee run_app.log\" \"${RUN_APP_SCRIPT} $(TARGET)\" \"${RESULT_STRING}\" \"7\"")
467476
if "containers" in data:
468477
target.write("\n")
469478
else:
470479
target.write(" -ps-only\n")
471-
target.write("endif\n")
480+
if not ("platform_type" in data and data["platform_type"] == "pcie"):
481+
target.write("endif\n")
472482
target.write("else\n")
473-
target.write("ifeq ($(HOST_ARCH), x86)\n")
483+
if not ("platform_type" in data and data["platform_type"] == "pcie"):
484+
target.write("ifeq ($(HOST_ARCH), x86)\n")
474485
target.write("\t$(EXECUTABLE)")
475486

476487
if "launch" in data:
@@ -490,8 +501,9 @@ def mk_run(target, data):
490501
args = args.replace("REPO_DIR","$(ABS_COMMON_REPO)")
491502
args = args.replace('HOST_EXE', '$(EXE_FILE)')
492503
target.write("\t" + args)
504+
if not ("platform_type" in data and data["platform_type"] == "pcie"):
505+
target.write("\nendif")
493506
target.write("\nendif\n")
494-
target.write("endif\n")
495507
if "targets" in data:
496508
target.write("ifneq ($(TARGET),$(findstring $(TARGET),")
497509
args = data["targets"]
@@ -511,7 +523,8 @@ def mk_run(target, data):
511523
target.write(".PHONY: test\n")
512524
target.write("test: $(EXECUTABLE)\n")
513525
target.write("ifeq ($(TARGET),$(filter $(TARGET),sw_emu hw_emu))\n")
514-
target.write("ifeq ($(HOST_ARCH), x86)\n")
526+
if not ("platform_type" in data and data["platform_type"] == "pcie"):
527+
target.write("ifeq ($(HOST_ARCH), x86)\n")
515528
target.write("\tXCL_EMULATION_MODE=$(TARGET) $(EXECUTABLE)")
516529

517530
if "launch" in data:
@@ -522,15 +535,18 @@ def mk_run(target, data):
522535
arg = arg.replace('BUILD', '$(BUILD_DIR)')
523536
arg = arg.replace('PROJECT', '.')
524537
target.write(arg)
525-
target.write("\nelse\n")
526-
target.write("\t$(ABS_COMMON_REPO)/common/utility/run_emulation.pl \"${LAUNCH_EMULATOR} | tee embedded_run.log\" \"${RUN_APP_SCRIPT} $(TARGET)\" \"${RESULT_STRING}\" \"7\"")
538+
if not ("platform_type" in data and data["platform_type"] == "pcie"):
539+
target.write("\nelse\n")
540+
target.write("\t$(ABS_COMMON_REPO)/common/utility/run_emulation.pl \"${LAUNCH_EMULATOR} | tee embedded_run.log\" \"${RUN_APP_SCRIPT} $(TARGET)\" \"${RESULT_STRING}\" \"7\"")
527541
if "containers" in data:
528542
target.write("\n")
529543
else:
530544
target.write(" -ps-only\n")
531-
target.write("endif\n")
545+
if not ("platform_type" in data and data["platform_type"] == "pcie"):
546+
target.write("endif\n")
532547
target.write("else\n")
533-
target.write("ifeq ($(HOST_ARCH), x86)\n")
548+
if not ("platform_type" in data and data["platform_type"] == "pcie"):
549+
target.write("ifeq ($(HOST_ARCH), x86)\n")
534550
target.write("\t$(EXECUTABLE)")
535551

536552
if "launch" in data:
@@ -550,10 +566,11 @@ def mk_run(target, data):
550566
args = args.replace("REPO_DIR","$(ABS_COMMON_REPO)")
551567
args = args.replace('HOST_EXE', '$(EXE_FILE)')
552568
target.write("\t" + args)
553-
target.write("\nelse\n")
554-
target.write("\t$(ECHO) \"Please copy the content of sd_card folder and data to an SD Card and run on the board\"")
569+
if not ("platform_type" in data and data["platform_type"] == "pcie"):
570+
target.write("\nelse\n")
571+
target.write("\t$(ECHO) \"Please copy the content of sd_card folder and data to an SD Card and run on the board\"")
572+
target.write("\nendif")
555573
target.write("\nendif\n")
556-
target.write("endif\n")
557574
if "targets" in data:
558575
target.write("ifneq ($(TARGET),$(findstring $(TARGET),")
559576
args = data["targets"]
@@ -632,11 +649,11 @@ def mk_help(target):
632649
target.write("\t$(ECHO) \" Command to run the application. This is same as 'run' target but does not have any makefile dependency.\"\n")
633650
target.write("\t$(ECHO) \"\"\n")
634651

635-
636-
target.write("\t$(ECHO) \" make sd_card TARGET=<sw_emu/hw_emu/hw> DEVICE=<FPGA platform> HOST_ARCH=<aarch32/aarch64/x86> EDGE_COMMON_SW=<rootfs and kernel image path>\"\n");
637-
target.write("\t$(ECHO) \" Command to prepare sd_card files.\"\n")
638-
target.write("\t$(ECHO) \" By default, HOST_ARCH=x86. HOST_ARCH and EDGE_COMMON_SW is required for SoC shells\"\n")
639-
target.write("\t$(ECHO) \"\"\n")
652+
if not ("platform_type" in data and data["platform_type"] == "pcie"):
653+
target.write("\t$(ECHO) \" make sd_card TARGET=<sw_emu/hw_emu/hw> DEVICE=<FPGA platform> HOST_ARCH=<aarch32/aarch64/x86> EDGE_COMMON_SW=<rootfs and kernel image path>\"\n");
654+
target.write("\t$(ECHO) \" Command to prepare sd_card files.\"\n")
655+
target.write("\t$(ECHO) \" By default, HOST_ARCH=x86. HOST_ARCH and EDGE_COMMON_SW is required for SoC shells\"\n")
656+
target.write("\t$(ECHO) \"\"\n")
640657
target.write("\t$(ECHO) \" make run TARGET=<sw_emu/hw_emu/hw> DEVICE=<FPGA platform> HOST_ARCH=<aarch32/aarch64/x86> EDGE_COMMON_SW=<rootfs and kernel image path>\"\n");
641658
target.write("\t$(ECHO) \" Command to run application in emulation.\"\n")
642659
target.write("\t$(ECHO) \" By default, HOST_ARCH=x86. HOST_ARCH and EDGE_COMMON_SW is required for SoC shells\"\n")
@@ -749,30 +766,31 @@ def util_checks(target):
749766
target.write("endif\n")
750767
target.write("endif\n\n")
751768

752-
target.write("gen_run_app:\n")
753-
target.write("ifneq ($(HOST_ARCH), x86)\n")
754-
target.write("\trm -rf run_app.sh\n")
755-
target.write("\t$(ECHO) 'export LD_LIBRARY_PATH=/mnt:/tmp:$(LD_LIBRARY_PATH)' >> run_app.sh\n")
756-
target.write("\t$(ECHO) 'export XILINX_XRT=/usr' >> run_app.sh\n")
757-
target.write("ifeq ($(TARGET),$(filter $(TARGET),sw_emu hw_emu))\n")
758-
target.write("\t$(ECHO) 'export XILINX_VITIS=/mnt' >> run_app.sh\n")
759-
target.write("\t$(ECHO) 'export XCL_EMULATION_MODE=$(TARGET)' >> run_app.sh\n")
760-
target.write("endif\n")
761-
target.write("\t$(ECHO) '$(EXECUTABLE)")
762-
if "launch" in data:
763-
if "cmd_args" in data["launch"][0]:
764-
args = data["launch"][0]["cmd_args"].split(" ")
765-
for arg in args:
766-
arg_name = arg.split("/")
767-
target.write(" ")
768-
target.write(arg_name[-1])
769-
target.write("' >> run_app.sh\n")
770-
target.write("\t$(ECHO) 'return_code=$$?' >> run_app.sh\n")
771-
target.write("\t$(ECHO) 'if [ $$return_code -ne 0 ]; then' >> run_app.sh\n")
772-
target.write("\t$(ECHO) 'echo \"ERROR: host run failed, RC=$$return_code\"' >> run_app.sh\n")
773-
target.write("\t$(ECHO) 'fi' >> run_app.sh\n")
774-
target.write("\t$(ECHO) 'echo \"INFO: host run completed.\"' >> run_app.sh\n")
775-
target.write("endif\n")
769+
if not ("platform_type" in data and data["platform_type"] == "pcie"):
770+
target.write("gen_run_app:\n")
771+
target.write("ifneq ($(HOST_ARCH), x86)\n")
772+
target.write("\trm -rf run_app.sh\n")
773+
target.write("\t$(ECHO) 'export LD_LIBRARY_PATH=/mnt:/tmp:$(LD_LIBRARY_PATH)' >> run_app.sh\n")
774+
target.write("\t$(ECHO) 'export XILINX_XRT=/usr' >> run_app.sh\n")
775+
target.write("ifeq ($(TARGET),$(filter $(TARGET),sw_emu hw_emu))\n")
776+
target.write("\t$(ECHO) 'export XILINX_VITIS=/mnt' >> run_app.sh\n")
777+
target.write("\t$(ECHO) 'export XCL_EMULATION_MODE=$(TARGET)' >> run_app.sh\n")
778+
target.write("endif\n")
779+
target.write("\t$(ECHO) '$(EXECUTABLE)")
780+
if "launch" in data:
781+
if "cmd_args" in data["launch"][0]:
782+
args = data["launch"][0]["cmd_args"].split(" ")
783+
for arg in args:
784+
arg_name = arg.split("/")
785+
target.write(" ")
786+
target.write(arg_name[-1])
787+
target.write("' >> run_app.sh\n")
788+
target.write("\t$(ECHO) 'return_code=$$?' >> run_app.sh\n")
789+
target.write("\t$(ECHO) 'if [ $$return_code -ne 0 ]; then' >> run_app.sh\n")
790+
target.write("\t$(ECHO) 'echo \"ERROR: host run failed, RC=$$return_code\"' >> run_app.sh\n")
791+
target.write("\t$(ECHO) 'fi' >> run_app.sh\n")
792+
target.write("\t$(ECHO) 'echo \"INFO: host run completed.\"' >> run_app.sh\n")
793+
target.write("endif\n")
776794

777795
target.write("check-devices:\n")
778796
target.write("ifndef DEVICE\n")
@@ -804,7 +822,8 @@ def create_mk(target, data):
804822
add_containers(target, data)
805823
mk_build_all(target, data)
806824
mk_run(target, data)
807-
mk_sdcard(target, data)
825+
if not ("platform_type" in data and data["platform_type"] == "pcie"):
826+
mk_sdcard(target, data)
808827
mk_clean(target,data)
809828
return
810829

cpp_kernels/array_partition/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,8 @@ else
127127
endif
128128

129129
############################## Setting Rules for Host (Building Host Executable) ##############################
130-
$(EXECUTABLE): check-xrt $(HOST_SRCS) $(HOST_HDRS)
131-
$(CXX) $(CXXFLAGS) $(HOST_SRCS) $(HOST_HDRS) -o '$@' $(LDFLAGS)
130+
$(EXECUTABLE): $(HOST_SRCS) | check-xrt
131+
$(CXX) -o $@ $^ $(CXXFLAGS) $(LDFLAGS)
132132

133133
emconfig:$(EMCONFIG_DIR)/emconfig.json
134134
$(EMCONFIG_DIR)/emconfig.json:

cpp_kernels/bind_op_storage/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,8 @@ else
123123
endif
124124

125125
############################## Setting Rules for Host (Building Host Executable) ##############################
126-
$(EXECUTABLE): check-xrt $(HOST_SRCS) $(HOST_HDRS)
127-
$(CXX) $(CXXFLAGS) $(HOST_SRCS) $(HOST_HDRS) -o '$@' $(LDFLAGS)
126+
$(EXECUTABLE): $(HOST_SRCS) | check-xrt
127+
$(CXX) -o $@ $^ $(CXXFLAGS) $(LDFLAGS)
128128

129129
emconfig:$(EMCONFIG_DIR)/emconfig.json
130130
$(EMCONFIG_DIR)/emconfig.json:

cpp_kernels/burst_rw/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,8 @@ else
124124
endif
125125

126126
############################## Setting Rules for Host (Building Host Executable) ##############################
127-
$(EXECUTABLE): check-xrt $(HOST_SRCS) $(HOST_HDRS)
128-
$(CXX) $(CXXFLAGS) $(HOST_SRCS) $(HOST_HDRS) -o '$@' $(LDFLAGS)
127+
$(EXECUTABLE): $(HOST_SRCS) | check-xrt
128+
$(CXX) -o $@ $^ $(CXXFLAGS) $(LDFLAGS)
129129

130130
emconfig:$(EMCONFIG_DIR)/emconfig.json
131131
$(EMCONFIG_DIR)/emconfig.json:

cpp_kernels/critical_path/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,8 @@ else
128128
endif
129129

130130
############################## Setting Rules for Host (Building Host Executable) ##############################
131-
$(EXECUTABLE): check-xrt $(HOST_SRCS) $(HOST_HDRS)
132-
$(CXX) $(CXXFLAGS) $(HOST_SRCS) $(HOST_HDRS) -o '$@' $(LDFLAGS)
131+
$(EXECUTABLE): $(HOST_SRCS) | check-xrt
132+
$(CXX) -o $@ $^ $(CXXFLAGS) $(LDFLAGS)
133133

134134
emconfig:$(EMCONFIG_DIR)/emconfig.json
135135
$(EMCONFIG_DIR)/emconfig.json:

cpp_kernels/custom_datatype/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,8 @@ else
127127
endif
128128

129129
############################## Setting Rules for Host (Building Host Executable) ##############################
130-
$(EXECUTABLE): check-xrt $(HOST_SRCS) $(HOST_HDRS)
131-
$(CXX) $(CXXFLAGS) $(HOST_SRCS) $(HOST_HDRS) -o '$@' $(LDFLAGS)
130+
$(EXECUTABLE): $(HOST_SRCS) | check-xrt
131+
$(CXX) -o $@ $^ $(CXXFLAGS) $(LDFLAGS)
132132

133133
emconfig:$(EMCONFIG_DIR)/emconfig.json
134134
$(EMCONFIG_DIR)/emconfig.json:

cpp_kernels/dataflow_stream/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,8 @@ else
123123
endif
124124

125125
############################## Setting Rules for Host (Building Host Executable) ##############################
126-
$(EXECUTABLE): check-xrt $(HOST_SRCS) $(HOST_HDRS)
127-
$(CXX) $(CXXFLAGS) $(HOST_SRCS) $(HOST_HDRS) -o '$@' $(LDFLAGS)
126+
$(EXECUTABLE): $(HOST_SRCS) | check-xrt
127+
$(CXX) -o $@ $^ $(CXXFLAGS) $(LDFLAGS)
128128

129129
emconfig:$(EMCONFIG_DIR)/emconfig.json
130130
$(EMCONFIG_DIR)/emconfig.json:

cpp_kernels/dataflow_stream_array/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,8 @@ else
124124
endif
125125

126126
############################## Setting Rules for Host (Building Host Executable) ##############################
127-
$(EXECUTABLE): check-xrt $(HOST_SRCS) $(HOST_HDRS)
128-
$(CXX) $(CXXFLAGS) $(HOST_SRCS) $(HOST_HDRS) -o '$@' $(LDFLAGS)
127+
$(EXECUTABLE): $(HOST_SRCS) | check-xrt
128+
$(CXX) -o $@ $^ $(CXXFLAGS) $(LDFLAGS)
129129

130130
emconfig:$(EMCONFIG_DIR)/emconfig.json
131131
$(EMCONFIG_DIR)/emconfig.json:

cpp_kernels/dependence_inter/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,8 @@ else
123123
endif
124124

125125
############################## Setting Rules for Host (Building Host Executable) ##############################
126-
$(EXECUTABLE): check-xrt $(HOST_SRCS) $(HOST_HDRS)
127-
$(CXX) $(CXXFLAGS) $(HOST_SRCS) $(HOST_HDRS) -o '$@' $(LDFLAGS)
126+
$(EXECUTABLE): $(HOST_SRCS) | check-xrt
127+
$(CXX) -o $@ $^ $(CXXFLAGS) $(LDFLAGS)
128128

129129
emconfig:$(EMCONFIG_DIR)/emconfig.json
130130
$(EMCONFIG_DIR)/emconfig.json:

cpp_kernels/gmem_2banks/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,8 @@ else
131131
endif
132132

133133
############################## Setting Rules for Host (Building Host Executable) ##############################
134-
$(EXECUTABLE): check-xrt $(HOST_SRCS) $(HOST_HDRS)
135-
$(CXX) $(CXXFLAGS) $(HOST_SRCS) $(HOST_HDRS) -o '$@' $(LDFLAGS)
134+
$(EXECUTABLE): $(HOST_SRCS) | check-xrt
135+
$(CXX) -o $@ $^ $(CXXFLAGS) $(LDFLAGS)
136136

137137
emconfig:$(EMCONFIG_DIR)/emconfig.json
138138
$(EMCONFIG_DIR)/emconfig.json:

0 commit comments

Comments
 (0)