From a74f616bbfa6869757291943e35104b8117ec37c Mon Sep 17 00:00:00 2001 From: Joshua Fife Date: Sat, 2 Oct 2021 11:05:25 -0600 Subject: [PATCH] Put projf in third_party and fixed makefiles Signed-off-by: Joshua Fife --- .gitmodules | 4 +- common/Makefile | 13 ++++ docs/project-f.rst | 9 ++- projf-explore | 1 - projf-makefiles/common.mk | 59 ------------------- projf-makefiles/hello/hello-arty/A/Makefile | 6 +- projf-makefiles/hello/hello-arty/A/README.rst | 8 ++- third_party/projf-explore | 1 + 8 files changed, 28 insertions(+), 73 deletions(-) delete mode 160000 projf-explore delete mode 100644 projf-makefiles/common.mk create mode 160000 third_party/projf-explore diff --git a/.gitmodules b/.gitmodules index e706ac5..e494f52 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ -[submodule "projf-explore"] - path = projf-explore +[submodule "third_party/projf-explore"] + path = third_party/projf-explore url = https://github.com/projf/projf-explore.git diff --git a/common/Makefile b/common/Makefile index 9f519ec..182fadc 100644 --- a/common/Makefile +++ b/common/Makefile @@ -67,5 +67,18 @@ ${BOARD_BUILDDIR}/${TOP}.fasm: ${BOARD_BUILDDIR}/${TOP}.route ${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 +download: ${BOARD_BUILDDIR}/${TOP}.bit + if [ $(TARGET)='arty_35' ]; then \ + openocd -f ~/opt/symbiflow/xc7/conda/envs/xc7/share/openocd/scripts/board/digilent_arty.cfg -c "init; pld load 0 ${BOARD_BUILDDIR}/${TOP}.bit; exit"; \ + elif [ $(TARGET)='arty_100' ]; then \ + openocd -f ~/opt/symbiflow/xc7/conda/envs/xc7/share/openocd/scripts/board/digilent_arty.cfg -c "init; pld load 0 ${BOARD_BUILDDIR}/${TOP}.bit; exit"; \ + elif [ $(TARGET)='basys3' ]; then \ + openocd -f ~/opt/symbiflow/xc7/conda/envs/xc7/share/openocd/scripts/board/digilent_arty.cfg -c "init; pld load 0 ${BOARD_BUILDDIR}/${TOP}.bit; exit"; \ + else \ + echo "The commands needed to download the bitstreams to the board type specified are not currently supported by the symbiflow makefiles. \ + Please see documentation for more information."; \ + fi + + clean: rm -rf ${BUILDDIR} \ No newline at end of file diff --git a/docs/project-f.rst b/docs/project-f.rst index 08c46a4..a68cce7 100644 --- a/docs/project-f.rst +++ b/docs/project-f.rst @@ -37,11 +37,10 @@ For example, to build the first design in project F's hello ary designs: .. code-block:: bash TARGET="arty_35" make -C projf-makefiles/hello/hello-arty/A - -To download the bitstream to the board navigate to the generated bitstream and run openocd. -For example to download the first design from hello arty: + +To download the bitstream to the board run ``make download``. For example to download the first design from +hello arty, run the following in symbiflows root directory: .. code-block:: bash - cd hello-build/A - openocd -f ${INSTALL_DIR}/${FPGA_FAM}/conda/envs/${FPGA_FAM}/share/openocd/scripts/board/digilent_arty.cfg -c "init; pld load 0 top.bit; exit" + TARGET="arty_35" make download -C projf-makefiles/hello/hello-arty/A diff --git a/projf-explore b/projf-explore deleted file mode 160000 index 4c4c1b1..0000000 --- a/projf-explore +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 4c4c1b1cc0933b35c4f595344f3e2b9f93f31dab diff --git a/projf-makefiles/common.mk b/projf-makefiles/common.mk deleted file mode 100644 index d861dfc..0000000 --- a/projf-makefiles/common.mk +++ /dev/null @@ -1,59 +0,0 @@ -BOARD_BUILDDIR := ${BUILDDIR}/${SUBPROJECT} - -# Set board properties based on TARGET variable -ifeq ($(TARGET),arty_35) - DEVICE := xc7a50t_test - BITSTREAM_DEVICE := artix7 - PARTNAME := xc7a35tcsg324-1 -else ifeq ($(TARGET),arty_100) - DEVICE := xc7a100t_test - BITSTREAM_DEVICE := artix7 - PARTNAME := xc7a100tcsg324-1 -else ifeq ($(TARGET),nexys4ddr) - DEVICE := xc7a100t_test - BITSTREAM_DEVICE := artix7 - PARTNAME := xc7a100tcsg324-1 -else ifeq ($(TARGET),nexys_video) - DEVICE := xc7a200t_test - BITSTREAM_DEVICE := artix7 - PARTNAME := xc7a200tsbg484-1 -else ifeq ($(TARGET),basys3) - DEVICE := xc7a50t_test - BITSTREAM_DEVICE := artix7 - PARTNAME := xc7a35tcpg236-1 -else - $(error Unsupported board type) -endif - - -XDC_CMD := -x ${XDC} - - -.DELETE_ON_ERROR: - -# Build design -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 ${SOURCES} -d ${BITSTREAM_DEVICE} -p ${PARTNAME} ${XDC_CMD} 2>&1 > /dev/null - -${BOARD_BUILDDIR}/${TOP}.net: ${BOARD_BUILDDIR}/${TOP}.eblif - cd ${BOARD_BUILDDIR} && symbiflow_pack -e ${TOP}.eblif -d ${DEVICE} 2>&1 > /dev/null - -${BOARD_BUILDDIR}/${TOP}.place: ${BOARD_BUILDDIR}/${TOP}.net - cd ${BOARD_BUILDDIR} && symbiflow_place -e ${TOP}.eblif -d ${DEVICE} -n ${TOP}.net -P ${PARTNAME} 2>&1 > /dev/null - -${BOARD_BUILDDIR}/${TOP}.route: ${BOARD_BUILDDIR}/${TOP}.place - cd ${BOARD_BUILDDIR} && symbiflow_route -e ${TOP}.eblif -d ${DEVICE} 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 - -clean: - rm -rf ${BUILDDIR} \ No newline at end of file diff --git a/projf-makefiles/hello/hello-arty/A/Makefile b/projf-makefiles/hello/hello-arty/A/Makefile index 60f803d..4743e16 100644 --- a/projf-makefiles/hello/hello-arty/A/Makefile +++ b/projf-makefiles/hello/hello-arty/A/Makefile @@ -1,10 +1,8 @@ current_dir := ${CURDIR} -proj_f_dir := ${current_dir}/../../../../projf-explore/hello/hello-arty/A -SUBPROJECT := A -BUILDDIR := ${current_dir}/../../../../hello-build +proj_f_dir := ${current_dir}/../../../../third_party/projf-explore/hello/hello-arty/A TOP := top SOURCES := ${proj_f_dir}/top.sv XDC := ${proj_f_dir}/arty.xdc -include ${current_dir}/../../../common.mk +include ${current_dir}/../../../../common/Makefile diff --git a/projf-makefiles/hello/hello-arty/A/README.rst b/projf-makefiles/hello/hello-arty/A/README.rst index 98b92db..5cd32e1 100644 --- a/projf-makefiles/hello/hello-arty/A/README.rst +++ b/projf-makefiles/hello/hello-arty/A/README.rst @@ -2,11 +2,15 @@ Part 1 Design A =============== This design allows you to turn the first led on the arty board on and off by toggling switch 0. -To build this design run the following command in main symbiflow directory: +To build this design run the following command in the main symbiflow directory: .. code:: bash :name: hello-arty-A TARGET="arty_35" make -C projf-makefiles/hello/hello-arty/A" -You can then find the bitstream under ``symbiflow-examples/hello-build/A``. +You can then download the bitstream by running: + +.. code:: bash + + TARGET="arty_35" make download -C projf-makefiles/hello/hello-arty/A" diff --git a/third_party/projf-explore b/third_party/projf-explore new file mode 160000 index 0000000..cbbb1b4 --- /dev/null +++ b/third_party/projf-explore @@ -0,0 +1 @@ +Subproject commit cbbb1b42970720c2b5c17d05dbc119a7e1e54ea4