Skip to content

Commit 8f1b97c

Browse files
authored
Merge pull request #24 from ewen-naos-nz/image-no-firmware
Makefile: make FIRMWARE=none work, Mimas v2 gateware-flash redirected to include BIOS
2 parents d11f5b8 + ca1b76d commit 8f1b97c

File tree

2 files changed

+23
-3
lines changed

2 files changed

+23
-3
lines changed

Makefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,11 +178,13 @@ third_party/%/.git: .gitmodules
178178
# --------------------------------------
179179
ifeq ($(FIRMWARE),none)
180180
OVERRIDE_FIRMWARE=--override-firmware=none
181+
FIRMWARE_FBI=
181182
else
182183
OVERRIDE_FIRMWARE=--override-firmware=$(FIRMWARE_FILEBASE).fbi
184+
FIRMWARE_FBI=$(FIRMWARE_FILEBASE).fbi
183185
endif
184186

185-
$(IMAGE_FILE): $(GATEWARE_FILEBASE).bin $(BIOS_FILE) $(FIRMWARE_FILEBASE).fbi
187+
$(IMAGE_FILE): $(GATEWARE_FILEBASE).bin $(BIOS_FILE) $(FIRMWARE_FBI)
186188
$(PYTHON) mkimage.py \
187189
$(MISOC_EXTRA_CMDLINE) $(LITEX_EXTRA_CMDLINE) $(MAKE_LITEX_EXTRA_CMDLINE) \
188190
--override-gateware=$(GATEWARE_FILEBASE).bin \

targets/mimasv2/Makefile.mk

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,26 @@ gateware-load-$(PLATFORM):
3030
@echo "make gateware-flash"
3131
@false
3232

33-
gateware-flash-$(PLATFORM):
34-
$(PYTHON) $$(which MimasV2Config.py) $(PROG_PORT) $(GATEWARE_FILEBASE).bin
33+
# On Mimas v2 both the gateware and the BIOS need to be in the same flash,
34+
# which means that they can only really usefully be updated together. As
35+
# a result we should flash "Gateware + BIOS + no application" if the user
36+
# asks us to flash the gatware. This mirrors the behaviour of embedding
37+
# the BIOS in the Gateware loaded via gateware-load, on other platforms,
38+
# eg, on the Arty.
39+
#
40+
GATEWARE_BIOS_FILE = $(TARGET_BUILD_DIR)/image-gateware+bios+none.bin
41+
42+
gateware-flash-$(PLATFORM): $(GATEWARE_BIOS_FILE)
43+
$(PYTHON) $$(which MimasV2Config.py) $(PROG_PORT) $(GATEWARE_BIOS_FILE)
44+
45+
# To avoid duplicating the mkimage.py call here, if the user has not
46+
# already built a image-gateware+bios+none.bin, we call make recursively
47+
# to build one here, with the FIRMWARE=none override.
48+
#
49+
ifneq ($(GATEWARE_BIOS_FILE),$(IMAGE_FILE))
50+
$(GATEWARE_BIOS_FILE): $(GATEWARE_FILEBASE).bin $(BIOS_FILE) mkimage.py
51+
FIRMWARE=none make image
52+
endif
3553

3654
# Firmware
3755
firmware-load-$(PLATFORM):

0 commit comments

Comments
 (0)