Skip to content

Commit 4214b07

Browse files
committed
[setups/osflow] rework: remove board Makefiles; create subdirs 'boards' and 'constraints'
1 parent c5c1c26 commit 4214b07

20 files changed

+132
-160
lines changed

setups/examples/Makefile

+13-9
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
OSFLOW := ../osflow
2-
EXAMPLES := ../../examples
3-
TEMPLATES := ../../../rtl/templates
2+
EXAMPLES := ../examples
3+
TEMPLATES := ../../rtl/templates
44
MV := mv
55

66
TASK := clean $(BITSTREAM)
@@ -13,22 +13,24 @@ endif
1313

1414
run:
1515
$(eval TASK ?= clean $(BITSTREAM))
16-
$(MAKE) -C $(OSFLOW)/$(BOARD)/ \
16+
$(MAKE) -C $(OSFLOW) -f common.mk \
1717
BOARD_SRC=$(EXAMPLES)/neorv32_$(BOARD)_BoardTop_$(DESIGN).vhd \
1818
TOP=neorv32_$(BOARD)_BoardTop_$(DESIGN) \
1919
ID=$(DESIGN) \
20-
$(TASK)
21-
$(MV) $(OSFLOW)/$(BOARD)/$(BITSTREAM) ./
20+
$(TASK) \
21+
&& $(MV) $(OSFLOW)/$(BITSTREAM) ./
22+
23+
# Boards
2224

2325
Fomu:
2426
ifeq ($(DESIGN),Minimal)
25-
$(eval IMEM_SRC := ../../../rtl/core/neorv32_imem.vhd)
27+
$(eval IMEM_SRC := ../../rtl/core/neorv32_imem.vhd)
2628
else
27-
$(eval IMEM_SRC := ../devices/ice40/neorv32_imem.ice40up_spram.vhd)
29+
$(eval IMEM_SRC := devices/ice40/neorv32_imem.ice40up_spram.vhd)
2830
endif
2931
$(MAKE) \
3032
BITSTREAM=neorv32_$(BOARD)_$(FOMU_REV)_$(DESIGN).bit \
31-
NEORV32_MEM_SRC="${IMEM_SRC} ../devices/ice40/neorv32_dmem.ice40up_spram.vhd" \
33+
NEORV32_MEM_SRC="${IMEM_SRC} devices/ice40/neorv32_dmem.ice40up_spram.vhd" \
3234
run
3335

3436
iCESugar:
@@ -41,6 +43,8 @@ UPduino_v3:
4143
BITSTREAM=neorv32_$(BOARD)_$(DESIGN).bit \
4244
run
4345

46+
# Designs
47+
4448
Minimal:
4549
$(MAKE) \
4650
DESIGN=$@ \
@@ -63,5 +67,5 @@ MixedLanguage:
6367
$(MAKE) \
6468
DESIGN=$@ \
6569
DESIGN_SRC=$(TEMPLATES)/processor/neorv32_ProcessorTop_Minimal*.vhd \
66-
NEORV32_VERILOG_SRC='../devices/ice40/sb_ice40_components.v ../../examples/neorv32_Fomu_MixedLanguage_ClkGen.v' \
70+
NEORV32_VERILOG_SRC='devices/ice40/sb_ice40_components.v ../examples/neorv32_Fomu_MixedLanguage_ClkGen.v' \
6771
$(BOARD)

setups/osflow/.gitignore

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
*.asc
2+
*.bit
3+
*.dfu
4+
*.history
5+
*.json
6+
*-report.txt

setups/osflow/Fomu/.gitignore

-5
This file was deleted.

setups/osflow/Fomu/Makefile

-51
This file was deleted.

setups/osflow/UPduino_v3/.gitignore

-8
This file was deleted.

setups/osflow/UPduino_v3/Makefile

-37
This file was deleted.

setups/osflow/boards/Fomu.mk

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
.PHONY: all
2+
3+
# Default target: run all required targets to build the DFU image.
4+
all: $(IMPL).dfu
5+
echo "! Built $(IMPL) for $(BOARD) $(FOMU_REV)"
6+
7+
# Use dfu-suffix to generate the DFU image from the FPGA bitstream.
8+
${IMPL}.dfu: $(IMPL).bit
9+
$(COPY) $< $@
10+
dfu-suffix -v 1209 -p 70b1 -a $@
11+
12+
# Use df-util to load the DFU image onto the Fomu.
13+
load: $(IMPL).dfu
14+
dfu-util -D $<
15+
16+
.PHONY: load

setups/osflow/boards/UPduino_v3.mk

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.PHONY: all
2+
3+
all: bit
4+
echo "! Built $(IMPL) for $(BOARD)"

setups/osflow/boards/iCESugar.mk

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.PHONY: all
2+
3+
all: bit
4+
echo "! Built $(IMPL) for $(BOARD)"

setups/osflow/Fomu/board.mk renamed to setups/osflow/boards/index.mk

+43-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
1+
PCF_PATH ?= constraints
2+
3+
4+
ifeq ($(BOARD),Fomu)
5+
6+
$(info Setting constraints and implementation args for BOARD Fomu)
7+
18
# Different Fomu hardware revisions are wired differently and thus
29
# require different configurations for yosys and nextpnr.
310
# Configuration is performed by setting the environment variable FOMU_REV accordingly.
411

5-
PCF_PATH ?= pcf
612
FOMU_REV ?= pvt
713

814
ifeq ($(FOMU_REV),evt1)
@@ -28,3 +34,39 @@ CONSTRAINTS ?= $(PCF_PATH)/fomu-pvt.pcf
2834
else
2935
$(error Unrecognized FOMU_REV value. must be "evt1", "evt2", "evt3", "pvt", or "hacker")
3036
endif
37+
38+
IMPL := neorv32_Fomu_$(FOMU_REV)_$(ID)
39+
40+
endif
41+
42+
43+
ifeq ($(BOARD),iCESugar)
44+
$(info Setting constraints and implementation args for BOARD iCESugar)
45+
46+
CONSTRAINTS ?= $(PCF_PATH)/iCESugar.pcf
47+
PNRFLAGS ?= --up5k --package sg48 --ignore-loops --timing-allow-fail
48+
IMPL ?= neorv32_iCESugar_$(ID)
49+
50+
endif
51+
52+
53+
ifeq ($(BOARD),UPduino_v3)
54+
$(info Setting constraints and implementation args for BOARD UPduino)
55+
56+
CONSTRAINTS ?= $(PCF_PATH)/UPduino_v3.pcf
57+
PNRFLAGS ?= --up5k --package sg48 --ignore-loops --timing-allow-fail
58+
IMPL ?= neorv32_UPduino_v3_$(ID)
59+
60+
endif
61+
62+
63+
ifeq ($(BOARD),OrangeCrab)
64+
$(info Setting constraints and implementation args for BOARD OrangeCrab)
65+
66+
DEVICE_SERIES = ecp5
67+
68+
CONSTRAINTS ?= $(PCF_PATH)/OrangeCrab.lpf
69+
PNRFLAGS ?= --um5g-85k --package CSFBGA285 --ignore-loops --timing-allow-fail
70+
IMPL ?= neorv32_OrangeCrab_r02-85F_$(ID)
71+
72+
endif

setups/osflow/common.mk

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
ID ?= impl_1
2+
3+
include boards/index.mk
4+
5+
ifndef TOP
6+
$(error TOP needs to be specified!)
7+
endif
8+
9+
include filesets.mk
10+
11+
ifndef DESIGN_SRC
12+
ifndef BOARD_SRC
13+
$(error Neither DESIGN_SRC nor BOARD_SRC were set!)
14+
endif
15+
endif
16+
17+
include tools.mk
18+
19+
ifdef GHDL_PLUGIN_MODULE
20+
YOSYSFLAGS += -m $(GHDL_PLUGIN_MODULE)
21+
endif
22+
23+
include synthesis.mk
24+
include PnR_Bit.mk
25+
26+
.PHONY: syn impl bit clean
27+
28+
syn: ${IMPL}.json
29+
impl: ${IMPL}.${PNR2BIT_EXT}
30+
bit: ${IMPL}.bit
31+
32+
clean:
33+
rm -rf *.{${PNR2BIT_EXT},bit,cf,dfu,history,json,o} *-report.txt
34+
35+
include boards/$(BOARD).mk

setups/osflow/filesets.mk

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
RTL_CORE_SRC := ../../../rtl/core
1+
RTL_CORE_SRC := ../../rtl/core
22

33
NEORV32_PKG := $(RTL_CORE_SRC)/neorv32_package.vhd
44

55
NEORV32_APP_SRC := \
66
$(RTL_CORE_SRC)/neorv32_application_image.vhd \
77

88
NEORV32_MEM_SRC := \
9-
../devices/ice40/neorv32_imem.ice40up_spram.vhd \
10-
../devices/ice40/neorv32_dmem.ice40up_spram.vhd
9+
devices/ice40/neorv32_imem.ice40up_spram.vhd \
10+
devices/ice40/neorv32_dmem.ice40up_spram.vhd
1111

1212
NEORV32_CORE_SRC := \
1313
$(RTL_CORE_SRC)/neorv32_bootloader_image.vhd \
@@ -46,7 +46,7 @@ NEORV32_CORE_SRC := \
4646
NEORV32_SRC := ${NEORV32_PKG} ${NEORV32_APP_SRC} ${NEORV32_MEM_SRC} ${NEORV32_CORE_SRC}
4747

4848
ICE40_SRC := \
49-
../devices/ice40/sb_ice40_components.vhd
49+
devices/ice40/sb_ice40_components.vhd
5050

5151
DEVICE_SRC := ${ICE40_SRC}
5252

setups/osflow/iCESugar/Makefile

-37
This file was deleted.

setups/osflow/tools.mk

+7-8
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,14 @@ YOSYSSYNTH ?= $(DEVICE_SERIES)
1313
NEXTPNR ?= nextpnr-$(DEVICE_SERIES)
1414

1515
ifeq ($(DEVICE_SERIES),ice40)
16-
YOSYSPIPE ?= -dsp
16+
YOSYSPIPE ?= -dsp
1717
CONSTRAINTS_FORMAT ?= pcf
18-
NEXTPNR_OUT ?= asc
19-
PNR2BIT_EXT ?= asc
20-
PACKTOOL ?= $(ICEPACK)
21-
18+
NEXTPNR_OUT ?= asc
19+
PNR2BIT_EXT ?= asc
20+
PACKTOOL ?= $(ICEPACK)
2221
else
2322
CONSTRAINTS_FORMAT ?= lpf
24-
NEXTPNR_OUT ?= textcfg
25-
PNR2BIT_EXT ?= cfg
26-
PACKTOOL ?= $(ECPPACK)
23+
NEXTPNR_OUT ?= textcfg
24+
PNR2BIT_EXT ?= cfg
25+
PACKTOOL ?= $(ECPPACK)
2726
endif

0 commit comments

Comments
 (0)