|
1 | | -.PHONY: clean |
2 | | - |
3 | | -PLATFORM=myplatform |
| 1 | +# Absolute path to top directory of Git repository |
| 2 | +PWD = $(shell readlink -f .) |
4 | 3 |
|
5 | | -app.exe: ./myproject_host.cpp |
6 | | - g++ -g -std=c++14 ./myproject_host.cpp -o app.exe \ |
7 | | - -I firmware/ap_types -I/opt/xilinx/xrt/include \ |
8 | | - -L${XILINX_XRT}/lib/ -lxrt_coreutil -lOpenCL -pthread -lrt -lstdc++ |
| 4 | +#Checks for XILINX_VITIS |
| 5 | +ifndef XILINX_VITIS |
| 6 | +$(error XILINX_VITIS variable is not set, please set correctly and rerun) |
| 7 | +endif |
9 | 8 |
|
10 | | -myproject_kernel.xo: myproject_kernel.cpp |
11 | | - v++ --target hw --compile -I"./" --config accelerator_card.cfg -o"build/myproject_kernel.xo" "myproject_kernel.cpp" |
| 9 | +#Checks for XILINX_XRT |
| 10 | +ifndef XILINX_XRT |
| 11 | +$(error XILINX_XRT variable is not set, please set correctly and rerun) |
| 12 | +endif |
12 | 13 |
|
13 | | -ifneq (,$(findstring vck5000,$(PLATFORM))) |
14 | | -myproject_kernel.xsa: ./build/myproject_kernel.xo |
15 | | - v++ -l -t hw --config ./accelerator_card.cfg ./build/myproject_kernel.xo -o myproject_kernel.xsa |
| 14 | +#Checks for XILINX_VIVADO |
| 15 | +ifndef XILINX_VIVADO |
| 16 | +$(error XILINX_VIVADO variable is not set, please set correctly and rerun) |
| 17 | +endif |
16 | 18 |
|
17 | | -myproject_kernel.xclbin: ./myproject_kernel.xsa |
18 | | - v++ --package -t hw --config ./accelerator_card.cfg ./myproject_kernel.xsa -o myproject_kernel.xclbin |
19 | | -else |
20 | | -myproject_kernel.xclbin: ./myproject_kernel.xo |
21 | | - v++ -l -t hw --config ./accelerator_card.cfg ./build/myproject_kernel.xo -o myproject_kernel.xclbin |
| 19 | +#Checks for g++ |
| 20 | +ifneq ($(shell expr $(shell g++ -dumpversion) \>= 5), 1) |
| 21 | +CXX := $(XILINX_VIVADO)/tps/lnx64/gcc-6.2.0/bin/g++ |
| 22 | +$(warning [WARNING]: g++ version older. Using g++ provided by the tool : $(CXX)) |
22 | 23 | endif |
23 | 24 |
|
24 | | -emconfig.json: |
25 | | - emconfigutil --platform xilinx_vck5000_gen4x8_qdma_2_202220_1 --nd 1 |
| 25 | +KERN_LIBRARIES += -I./ -I./firmware/ -I./firmware/weights -I./firmware/nnet_utils/ |
26 | 26 |
|
27 | | -clean: |
28 | | - rm -f KERAS_3layer.json KERAS_3layer_weights.h5 prj_tuto_vitis_stream.tar.gz |
29 | | - rm -rf myproject_kernel* myproject_kernel* .exe *json *csv *log *summary _x xilinx* .run .Xil .ipcache *.jou |
| 27 | +.PHONY: all |
| 28 | +all: host kernel |
30 | 29 |
|
31 | | -# Unless specified, use the current directory name as the v++ build target |
32 | | -TARGET ?= $(notdir $(CURDIR)) |
| 30 | +# Building kernel |
| 31 | +./build/myproject_kernel.xo: kernel_wrapper.cpp |
| 32 | + mkdir -p ./build |
| 33 | + v++ -c -t hw --config ./u55c.cfg kernel_wrapper.cpp firmware/myproject.cpp -o ./build/myproject_kernel.xo $(KERN_LIBRARIES) |
| 34 | + |
| 35 | +myproject_kernel.xclbin: ./build/myproject_kernel.xo |
| 36 | + v++ -l -t hw --config ./u55c.cfg ./build/myproject_kernel.xo -o kernel_wrapper.xclbin |
| 37 | + |
| 38 | +# Building Host |
| 39 | +INCLUDES += -I$(XILINX_XRT)/include/ -I$(XILINX_VIVADO)/include/ -I$(XILINX_HLS)/include/ \ |
| 40 | + -I$(PWD)/libs/ -I$(PWD)/firmware/ -I$(PWD)/firmware/nnet_utils/ |
| 41 | +CXXFLAGS += -Wall -std=c++11 -Wno-unknown-pragmas -g -O0 |
| 42 | +LDFLAGS = -L$(XILINX_XRT)/lib/ -lstdc++ -lpthread -lrt -lOpenCL |
| 43 | + |
| 44 | +host: myproject_host_cl.cpp libs/xcl2.cpp |
| 45 | + $(CXX) $(CXXFLAGS) $^ -o $@ $(INCLUDES) $(LDFLAGS) |
| 46 | + |
| 47 | +.PHONY: kernel |
| 48 | +kernel: myproject_kernel.xclbin |
| 49 | + |
| 50 | +# Cleaning stuff |
| 51 | +.PHONY: clean |
| 52 | +clean: |
| 53 | + -rm -rf host libs/*.o |
| 54 | + -rm -rf *.xclbin* |
| 55 | + -rm -rf build* |
| 56 | + -rm -rf *.log *.jou *.rpt *.csv *.mdb *.ltx |
0 commit comments