diff --git a/board.mk b/board.mk new file mode 100644 index 00000000..7d6e96ef --- /dev/null +++ b/board.mk @@ -0,0 +1,21 @@ +# Different Fomu hardware revisions are wired differently and thus +# require different configurations for yosys and nextpnr. +# Configuration is performed by setting the environment variable FOMU_REV accordingly. +ifeq ($(FOMU_REV),evt1) +YOSYSFLAGS?= -D EVT=1 +PNRFLAGS ?= --up5k --package sg48 --pcf ../../pcf/fomu-evt2.pcf +else ifeq ($(FOMU_REV),evt2) +YOSYSFLAGS?= -D EVT=1 +PNRFLAGS ?= --up5k --package sg48 --pcf ../../pcf/fomu-evt2.pcf +else ifeq ($(FOMU_REV),evt3) +YOSYSFLAGS?= -D EVT=1 +PNRFLAGS ?= --up5k --package sg48 --pcf ../../pcf/fomu-evt3.pcf +else ifeq ($(FOMU_REV),hacker) +YOSYSFLAGS?= -D HACKER=1 +PNRFLAGS ?= --up5k --package uwg30 --pcf ../../pcf/fomu-hacker.pcf +else ifeq ($(FOMU_REV),pvt) +YOSYSFLAGS?= -D PVT=1 +PNRFLAGS ?= --up5k --package uwg30 --pcf ../../pcf/fomu-pvt.pcf +else +$(error Unrecognized FOMU_REV value. must be "evt1", "evt2", "evt3", "pvt", or "hacker") +endif diff --git a/mixed-hdl/blink/Makefile b/mixed-hdl/blink/Makefile index 316e79cf..51a4a163 100644 --- a/mixed-hdl/blink/Makefile +++ b/mixed-hdl/blink/Makefile @@ -1,24 +1,4 @@ -# Different Fomu hardware revisions are wired differently and thus -# require different configurations for yosys and nextpnr. -# Configuration is performed by setting the environment variable FOMU_REV accordingly. -ifeq ($(FOMU_REV),evt1) -YOSYSFLAGS?= -D EVT=1 -PNRFLAGS ?= --up5k --package sg48 --pcf ../../pcf/fomu-evt2.pcf -else ifeq ($(FOMU_REV),evt2) -YOSYSFLAGS?= -D EVT=1 -PNRFLAGS ?= --up5k --package sg48 --pcf ../../pcf/fomu-evt2.pcf -else ifeq ($(FOMU_REV),evt3) -YOSYSFLAGS?= -D EVT=1 -PNRFLAGS ?= --up5k --package sg48 --pcf ../../pcf/fomu-evt3.pcf -else ifeq ($(FOMU_REV),hacker) -YOSYSFLAGS?= -D HACKER=1 -PNRFLAGS ?= --up5k --package uwg30 --pcf ../../pcf/fomu-hacker.pcf -else ifeq ($(FOMU_REV),pvt) -YOSYSFLAGS?= -D PVT=1 -PNRFLAGS ?= --up5k --package uwg30 --pcf ../../pcf/fomu-pvt.pcf -else -$(error Unrecognized FOMU_REV value. must be "evt1", "evt2", "evt3", "pvt", or "hacker") -endif +include ../../board.mk # VHDL top with instantiated Verilog VHDL_SYN_FILES = ../../vhdl/sb_ice40_components.vhd blink.vhd diff --git a/verilog/blink/Makefile b/verilog/blink/Makefile index 4e0ed205..6fce5cf4 100644 --- a/verilog/blink/Makefile +++ b/verilog/blink/Makefile @@ -3,27 +3,7 @@ # This Makefile shows the steps to generate a DFU loadable image onto # Fomu hacker board. -# Different Fomu hardware revisions are wired differently and thus -# require different configurations for yosys and nextpnr. -# Configuration is performed by setting the environment variable FOMU_REV accordingly. -ifeq ($(FOMU_REV),evt1) -YOSYSFLAGS?= -D EVT=1 -PNRFLAGS ?= --up5k --package sg48 --pcf ../../pcf/fomu-evt2.pcf -else ifeq ($(FOMU_REV),evt2) -YOSYSFLAGS?= -D EVT=1 -PNRFLAGS ?= --up5k --package sg48 --pcf ../../pcf/fomu-evt2.pcf -else ifeq ($(FOMU_REV),evt3) -YOSYSFLAGS?= -D EVT=1 -PNRFLAGS ?= --up5k --package sg48 --pcf ../../pcf/fomu-evt3.pcf -else ifeq ($(FOMU_REV),hacker) -YOSYSFLAGS?= -D HACKER=1 -PNRFLAGS ?= --up5k --package uwg30 --pcf ../../pcf/fomu-hacker.pcf -else ifeq ($(FOMU_REV),pvt) -YOSYSFLAGS?= -D PVT=1 -PNRFLAGS ?= --up5k --package uwg30 --pcf ../../pcf/fomu-pvt.pcf -else -$(error Unrecognized FOMU_REV value. must be "evt1", "evt2", "evt3", "pvt", or "hacker") -endif +include ../../board.mk # Default target: run all required targets to build the DFU image. all: blink.dfu diff --git a/vhdl/blink/Makefile b/vhdl/blink/Makefile index ab0b5a73..154facd5 100644 --- a/vhdl/blink/Makefile +++ b/vhdl/blink/Makefile @@ -1,24 +1,4 @@ -# Different Fomu hardware revisions are wired differently and thus -# require different configurations for yosys and nextpnr. -# Configuration is performed by setting the environment variable FOMU_REV accordingly. -ifeq ($(FOMU_REV),evt1) -YOSYSFLAGS?= -D EVT=1 -PNRFLAGS ?= --up5k --package sg48 --pcf ../../pcf/fomu-evt2.pcf -else ifeq ($(FOMU_REV),evt2) -YOSYSFLAGS?= -D EVT=1 -PNRFLAGS ?= --up5k --package sg48 --pcf ../../pcf/fomu-evt2.pcf -else ifeq ($(FOMU_REV),evt3) -YOSYSFLAGS?= -D EVT=1 -PNRFLAGS ?= --up5k --package sg48 --pcf ../../pcf/fomu-evt3.pcf -else ifeq ($(FOMU_REV),hacker) -YOSYSFLAGS?= -D HACKER=1 -PNRFLAGS ?= --up5k --package uwg30 --pcf ../../pcf/fomu-hacker.pcf -else ifeq ($(FOMU_REV),pvt) -YOSYSFLAGS?= -D PVT=1 -PNRFLAGS ?= --up5k --package uwg30 --pcf ../../pcf/fomu-pvt.pcf -else -$(error Unrecognized FOMU_REV value. must be "evt1", "evt2", "evt3", "pvt", or "hacker") -endif +include ../../board.mk VHDL_SYN_FILES = ../sb_ice40_components.vhd blink.vhd