From 5d1de9005598672a0cb16e670c5a3d23789d4325 Mon Sep 17 00:00:00 2001 From: Joshua Fife Date: Tue, 10 Aug 2021 17:00:16 -0600 Subject: [PATCH] Common Makefile v2 and changed all examples Signed-off-by: Joshua Fife --- common/Makefile | 53 ++++------------------------- xc7/counter_test/Makefile | 42 ++++++++++++++++++++--- xc7/linux_litex_demo/Makefile | 42 +++++------------------ xc7/picosoc_demo/Makefile | 63 ++++++++++------------------------- 4 files changed, 71 insertions(+), 129 deletions(-) diff --git a/common/Makefile b/common/Makefile index 0565a09..ecc459b 100644 --- a/common/Makefile +++ b/common/Makefile @@ -1,54 +1,15 @@ BUILDDIR := ${current_dir}/build - -# Set board properties based on TARGET variable -ifeq ($(TARGET),arty_35) - DEVICE := xc7a50t_test - BITSTREAM_DEVICE := artix7 - PARTNAME := xc7a35tcsg324-1 - CONSTRAINT_PATH := ${current_dir}/arty - BOARD_BUILDDIR := ${BUILDDIR}/arty_35 -else ifeq ($(TARGET),arty_100) - DEVICE := xc7a100t_test - BITSTREAM_DEVICE := artix7 - PARTNAME := xc7a100tcsg324-1 - CONSTRAINT_PATH := ${current_dir}/arty - BOARD_BUILDDIR := ${BUILDDIR}/arty_100 -else ifeq ($(TARGET),nexys4ddr) - DEVICE := xc7a100t_test - BITSTREAM_DEVICE := artix7 - PARTNAME := xc7a100tcsg324-1 - CONSTRAINT_PATH := ${current_dir}/nexys4ddr - BOARD_BUILDDIR := ${BUILDDIR}/nexys4ddr -else ifeq ($(TARGET),zybo) - DEVICE := xc7z010_test - BITSTREAM_DEVICE := zynq7 - PARTNAME := xc7z010clg400-1 - CONSTRAINT_PATH := ${current_dir}/zybo - BOARD_BUILDDIR := ${BUILDDIR}/zybo - SOURCES := ${current_dir}/counter_zynq.v -else ifeq ($(TARGET),nexys_video) - DEVICE := xc7a200t_test - BITSTREAM_DEVICE := artix7 - PARTNAME := xc7a200tsbg484-1 - CONSTRAINT_PATH := ${current_dir}/nexys_video - BOARD_BUILDDIR := ${BUILDDIR}/nexys_video -else - DEVICE := xc7a50t_test - BITSTREAM_DEVICE := artix7 - PARTNAME := xc7a35tcpg236-1 - CONSTRAINT_PATH := ${current_dir}/basys3 - BOARD_BUILDDIR := ${BUILDDIR}/basys3 -endif +BOARD_BUILDDIR := ${BUILDDIR}/${TARGET} # Determine the type of constraint being used -ifneq ($(wildcard ${CONSTRAINT_PATH}.xdc),) - XDC_CMD := -x ${CONSTRAINT_PATH}.xdc +ifneq (${XDC},) + XDC_CMD := -x ${XDC} endif -ifneq ($(wildcard ${CONSTRAINT_PATH}.sdc),) - SDC_CMD := -s ${CONSTRAINT_PATH}.sdc +ifneq (${SDC},) + SDC_CMD := -s ${SDC} endif -ifneq ($(wildcard ${CONSTRAINT_PATH}.pcf),) - PCF_CMD := -p ${CONSTRAINT_PATH}.pcf +ifneq (${PCF},) + PCF_CMD := -p ${PCF} endif .DELETE_ON_ERROR: diff --git a/xc7/counter_test/Makefile b/xc7/counter_test/Makefile index a12a7ba..f6c79aa 100644 --- a/xc7/counter_test/Makefile +++ b/xc7/counter_test/Makefile @@ -1,12 +1,44 @@ -export mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST))) -export current_dir := $(patsubst %/,%,$(dir $(mkfile_path))) +current_dir := ${CURDIR} +TOP := top +SOURCES := ${current_dir}/counter.v -export TOP := top -export SOURCES := ${current_dir}/counter.v +ifeq ($(TARGET),arty_35) + DEVICE := xc7a50t_test + BITSTREAM_DEVICE := artix7 + PARTNAME := xc7a35tcsg324-1 + XDC := ${current_dir}/arty.xdc +else ifeq ($(TARGET),arty_100) + DEVICE := xc7a100t_test + BITSTREAM_DEVICE := artix7 + PARTNAME := xc7a100tcsg324-1 + XDC := ${current_dir}/arty.xdc +else ifeq ($(TARGET),nexys4ddr) + DEVICE := xc7a100t_test + BITSTREAM_DEVICE := artix7 + PARTNAME := xc7a100tcsg324-1 + XDC := ${current_dir}/nexys4ddr.xdc +else ifeq ($(TARGET),zybo) + DEVICE := xc7z010_test + BITSTREAM_DEVICE := zynq7 + PARTNAME := xc7z010clg400-1 + XDC := ${current_dir}/zybo.xdc + SOURCES:=${current_dir}/counter_zynq.v +else ifeq ($(TARGET),nexys_video) + DEVICE := xc7a200t_test + BITSTREAM_DEVICE := artix7 + PARTNAME := xc7a200tsbg484-1 + XDC := ${current_dir}/nexys_video.xdc +else + DEVICE := xc7a50t_test + BITSTREAM_DEVICE := artix7 + PARTNAME := xc7a35tcpg236-1 + XDC := ${current_dir}/basys3.xdc +endif + +export all: cd ../../common && $(MAKE) - clean: cd ../../common && $(MAKE) clean diff --git a/xc7/linux_litex_demo/Makefile b/xc7/linux_litex_demo/Makefile index 31c50e1..7318bab 100644 --- a/xc7/linux_litex_demo/Makefile +++ b/xc7/linux_litex_demo/Makefile @@ -1,53 +1,29 @@ -mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST))) -current_dir := $(patsubst %/,%,$(dir $(mkfile_path))) +current_dir := ${CURDIR} TOP := top -VERILOG := ${current_dir}/baselitex_arty.v \ +SOURCES := ${current_dir}/baselitex_arty.v \ ${current_dir}/VexRiscv_Linux.v MEM_INIT := ${current_dir}/mem.init \ ${current_dir}/mem_1.init \ ${current_dir}/mem_2.init -BITSTREAM_DEVICE := artix7 PCF := ${current_dir}/arty.pcf SDC := ${current_dir}/arty.sdc XDC := ${current_dir}/arty.xdc -BUILDDIR := build + + +BITSTREAM_DEVICE := artix7 ifeq ($(TARGET),arty_100) PARTNAME := xc7a100tcsg324-1 DEVICE := xc7a100t_test - BOARD_BUILDDIR := ${BUILDDIR}/arty_100 else PARTNAME := xc7a35tcsg324-1 DEVICE := xc7a50t_test - BOARD_BUILDDIR := ${BUILDDIR}/arty_35 endif -.DELETE_ON_ERROR: +export - -all: ${BOARD_BUILDDIR}/${TOP}.bit - -${BOARD_BUILDDIR}: - mkdir -p ${BOARD_BUILDDIR} - ln -s ${MEM_INIT} ${BOARD_BUILDDIR} - -${BOARD_BUILDDIR}/${TOP}.eblif: | ${BOARD_BUILDDIR} - cd ${BOARD_BUILDDIR} && symbiflow_synth -t ${TOP} -v ${VERILOG} -d ${BITSTREAM_DEVICE} -p ${PARTNAME} -x ${XDC} 2>&1 > /dev/null - -${BOARD_BUILDDIR}/${TOP}.net: ${BOARD_BUILDDIR}/${TOP}.eblif - cd ${BOARD_BUILDDIR} && symbiflow_pack -e ${TOP}.eblif -d ${DEVICE} -s ${SDC} 2>&1 > /dev/null - -${BOARD_BUILDDIR}/${TOP}.place: ${BOARD_BUILDDIR}/${TOP}.net - cd ${BOARD_BUILDDIR} && symbiflow_place -e ${TOP}.eblif -d ${DEVICE} -p ${PCF} -n ${TOP}.net -P ${PARTNAME} -s ${SDC} 2>&1 > /dev/null - -${BOARD_BUILDDIR}/${TOP}.route: ${BOARD_BUILDDIR}/${TOP}.place - cd ${BOARD_BUILDDIR} && symbiflow_route -e ${TOP}.eblif -d ${DEVICE} -s ${SDC} 2>&1 > /dev/null - -${BOARD_BUILDDIR}/${TOP}.fasm: ${BOARD_BUILDDIR}/${TOP}.route - cd ${BOARD_BUILDDIR} && symbiflow_write_fasm -e ${TOP}.eblif -d ${DEVICE} - -${BOARD_BUILDDIR}/${TOP}.bit: ${BOARD_BUILDDIR}/${TOP}.fasm - cd ${BOARD_BUILDDIR} && symbiflow_write_bitstream -d ${BITSTREAM_DEVICE} -f ${TOP}.fasm -p ${PARTNAME} -b ${TOP}.bit +all: + cd ../../common && $(MAKE) clean: - rm -rf ${BUILDDIR} + cd ../../common && $(MAKE) clean \ No newline at end of file diff --git a/xc7/picosoc_demo/Makefile b/xc7/picosoc_demo/Makefile index cf01292..f6c9404 100644 --- a/xc7/picosoc_demo/Makefile +++ b/xc7/picosoc_demo/Makefile @@ -1,66 +1,39 @@ -mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST))) -current_dir := $(patsubst %/,%,$(dir $(mkfile_path))) +current_dir := ${CURDIR} TOP := top -VERILOG := ${current_dir}/picosoc_noflash.v \ +SOURCES := ${current_dir}/picosoc_noflash.v \ ${current_dir}/picorv32.v \ ${current_dir}/simpleuart.v \ ${current_dir}/progmem.v -PARTNAME := xc7a35tcpg236-1 -DEVICE := xc7a50t_test -BITSTREAM_DEVICE := artix7 -PCF := ${current_dir}/basys3.pcf + SDC := ${current_dir}/picosoc.sdc -BUILDDIR := build +BITSTREAM_DEVICE := artix7 ifeq ($(TARGET),arty_35) - VERILOG += ${current_dir}/arty.v + DEVICE := xc7a50t_test + SOURCES += ${current_dir}/arty.v PARTNAME := xc7a35tcsg324-1 PCF := ${current_dir}/arty.pcf - BOARD_BUILDDIR := ${BUILDDIR}/arty_35 else ifeq ($(TARGET),arty_100) - VERILOG += ${current_dir}/arty.v - PARTNAME := xc7a100tcsg324-1 - PCF:=${current_dir}/arty.pcf DEVICE := xc7a100t_test - BOARD_BUILDDIR := ${BUILDDIR}/arty_100 + SOURCES += ${current_dir}/arty.v + PARTNAME := xc7a100tcsg324-1 + PCF := ${current_dir}/arty.pcf else ifeq ($(TARGET),nexys4ddr) - VERILOG += ${current_dir}/nexys4ddr.v + DEVICE := xc7a100t_test + SOURCES += ${current_dir}/nexys4ddr.v PARTNAME := xc7a100tcsg324-1 - PCF:=${current_dir}/nexys4ddr.pcf - DEVICE := xc7a100t_test - BOARD_BUILDDIR := ${BUILDDIR}/nexys4ddr + PCF := ${current_dir}/nexys4ddr.pcf else - VERILOG += ${current_dir}/basys3.v + DEVICE := xc7a50t_test + SOURCES += ${current_dir}/basys3.v PARTNAME := xc7a35tcpg236-1 PCF := ${current_dir}/basys3.pcf - BOARD_BUILDDIR := ${BUILDDIR}/basys3 endif -.DELETE_ON_ERROR: +export - -all: ${BOARD_BUILDDIR}/${TOP}.bit - -${BOARD_BUILDDIR}: - mkdir -p ${BOARD_BUILDDIR} - -${BOARD_BUILDDIR}/${TOP}.eblif: | ${BOARD_BUILDDIR} - cd ${BOARD_BUILDDIR} && symbiflow_synth -t ${TOP} -v ${VERILOG} -d ${BITSTREAM_DEVICE} -p ${PARTNAME} 2>&1 > /dev/null - -${BOARD_BUILDDIR}/${TOP}.net: ${BOARD_BUILDDIR}/${TOP}.eblif - cd ${BOARD_BUILDDIR} && symbiflow_pack -e ${TOP}.eblif -d ${DEVICE} -s ${SDC} 2>&1 > /dev/null - -${BOARD_BUILDDIR}/${TOP}.place: ${BOARD_BUILDDIR}/${TOP}.net - cd ${BOARD_BUILDDIR} && symbiflow_place -e ${TOP}.eblif -d ${DEVICE} -p ${PCF} -n ${TOP}.net -P ${PARTNAME} -s ${SDC} 2>&1 > /dev/null - -${BOARD_BUILDDIR}/${TOP}.route: ${BOARD_BUILDDIR}/${TOP}.place - cd ${BOARD_BUILDDIR} && symbiflow_route -e ${TOP}.eblif -d ${DEVICE} -s ${SDC} 2>&1 > /dev/null - -${BOARD_BUILDDIR}/${TOP}.fasm: ${BOARD_BUILDDIR}/${TOP}.route - cd ${BOARD_BUILDDIR} && symbiflow_write_fasm -e ${TOP}.eblif -d ${DEVICE} - -${BOARD_BUILDDIR}/${TOP}.bit: ${BOARD_BUILDDIR}/${TOP}.fasm - cd ${BOARD_BUILDDIR} && symbiflow_write_bitstream -d ${BITSTREAM_DEVICE} -f ${TOP}.fasm -p ${PARTNAME} -b ${TOP}.bit +all: + cd ../../common && $(MAKE) clean: - rm -rf ${BUILDDIR} + cd ../../common && $(MAKE) clean \ No newline at end of file