Skip to content

Commit a9501be

Browse files
committed
Makefile: Use modeswitch tool in Makefile.
Fixes #263.
1 parent 0fc00d4 commit a9501be

File tree

4 files changed

+15
-22
lines changed

4 files changed

+15
-22
lines changed

Makefile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,14 @@ FLASHEXTRA_CMD = \
6767
$(PROGRAMMER_OPTION) \
6868
$(BOARD)
6969

70+
MODESWITCH_CMD = \
71+
hdmi2usb-mode-switch \
72+
--by-type=$(BOARD) \
73+
--verbose
74+
75+
MODEINFO_CMD = \
76+
hdmi2usb-find-board \
77+
--by-type=$(BOARD)
7078

7179
ifeq ($(OS),Windows_NT)
7280
FLTERM = $(PYTHON) $(MSCDIR)/tools/flterm.py
@@ -146,13 +154,15 @@ download-prebuilt:
146154

147155
# Load
148156
load-gateware:
157+
$(MODESWITCH_CMD) --mode=jtag
149158
$(MAKEPY_CMD) load-bitstream
150159

151160
load: load-gateware $(addprefix load-,$(TARGETS))
152161
@true
153162

154163
# Flash
155164
flash-gateware: gateware-submodules
165+
$(MODESWITCH_CMD) --mode=jtag
156166
$(MAKEPY_CMD) flash-bitstream
157167
@echo ""
158168
@echo ""

Makefile.fx2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ embed-fx2: firmware/lm32/fx2_fw_hdmi2usb.c
3434
@true
3535

3636
load-fx2: firmware/fx2/hdmi2usb.hex
37-
firmware/fx2/download.sh firmware/fx2/hdmi2usb.hex
37+
$(MODESWITCH_CMD) --load-fx2-firmware firmware/fx2/hdmi2usb.hex
3838

3939
flash-fx2:
4040
@true

Makefile.lm32

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,15 @@ TARGETS += lm32
1616

1717
RAM_ADDR ?= 0x20000000
1818

19-
ifeq ($(BOARD),atlys)
20-
SERIAL ?= /dev/ttyVIZ0
21-
else
2219
ifeq ($(BOARD),minispartan6)
2320
SERIAL ?= /dev/ttyUSB1
2421
RAM_ADDR = 0x40000000
2522
else
2623
ifeq ($(BOARD),pipistrello)
2724
SERIAL ?= /dev/ttyUSB1
2825
else
29-
# Opsis fall through
30-
SERIAL ?= /dev/ttyACM0
31-
endif
26+
# Atlys/Opsis use modeswitch to find the serial port
27+
SERIAL ?= $$($(MODEINFO_CMD) --get-serial)
3228
endif
3329
endif
3430

@@ -70,11 +66,13 @@ flash-lm32: image-lm32
7066
@echo " see https://github.com/timvideos/HDMI2USB-misoc-firmware/issues/274)"
7167
@echo "Booting will use lm32 firmware embedded in the gateware."
7268
@echo
69+
# $(MODESWITCH_CMD) --mode=jtag
7370
# export FIRMWARE_ADDRESS=$$($(PYTHON) -c "import platforms.$(BOARD) as b; print(b.Platform.gateware_size)"); \
7471
# echo "Flashing to $$($(PYTHON) -c "print(hex($$FIRMWARE_ADDRESS))") ($$FIRMWARE_ADDRESS)"; \
7572
# $(FLASHEXTRA_CMD) $(HDMI2USBDIR)/firmware/lm32/firmware.fbi $$FIRMWARE_ADDRESS
7673

7774
clear-flash-lm32:
75+
$(MODESWITCH_CMD) --mode=jtag
7876
export FIRMWARE_ADDRESS=$$($(PYTHON) -c "import platforms.$(BOARD) as b; print(b.Platform.gateware_size)"); \
7977
echo "Zeroing $$($(PYTHON) -c "print(hex($$FIRMWARE_ADDRESS))") ($$FIRMWARE_ADDRESS)"; \
8078
$(FLASHEXTRA_CMD) $(HDMI2USBDIR)/firmware/zero.bin $$FIRMWARE_ADDRESS

firmware/fx2/download.sh

Lines changed: 0 additions & 15 deletions
This file was deleted.

0 commit comments

Comments
 (0)