Skip to content

Commit

Permalink
Merge pull request #334 from mithro/opsis-flash-fix
Browse files Browse the repository at this point in the history
Fixing flashing targets for Opsis
  • Loading branch information
mithro committed Aug 3, 2017
2 parents ccfa97c + d0f42da commit 1090bf3
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 41 deletions.
12 changes: 9 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,13 @@ export CPU
CLANG = 0
export CLANG

TARGET_BUILD_DIR = build/$(PLATFORM)_$(TARGET)_$(CPU)/
ifeq ($(TOFE_BOARD),)
FULL_PLATFORM = $(PLATFORM)
else
FULL_PLATFORM = $(PLATFORM).$(TOFE_BOARD)
LITEX_EXTRA_CMDLINE += -Ot tofe_board $(TOFE_BOARD)
endif
TARGET_BUILD_DIR = build/$(FULL_PLATFORM)_$(TARGET)_$(CPU)/

IPRANGE ?= 192.168.100
export IPRANGE
Expand Down Expand Up @@ -67,7 +73,7 @@ third_party/%/.git: .gitmodules
# Image - a combination of multiple parts (gateware+bios+firmware+more?)
# --------------------------------------
image:
$(PYTHON) mkimage.py
$(PYTHON) mkimage.py $(MISOC_EXTRA_CMDLINE) $(LITEX_EXTRA_CMDLINE)

image-load: image image-load-$(PLATFORM)
@true
Expand Down Expand Up @@ -148,7 +154,7 @@ tftpd_start:

# Extra targets
# --------------------------------------
flash: flash-$(PLATFORM)
flash: image-flash
@true

help:
Expand Down
6 changes: 5 additions & 1 deletion make.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@ def make_args(parser, platform='opsis', target='hdmi2usb'):


def make_builddir(args):
return "build/{}_{}_{}/".format(args.platform, args.target.lower(), args.cpu_type)
full_platform = args.platform
for name, value in args.target_option:
if name == 'tofe_board':
full_platform = "{}.{}".format(full_platform, value)
return "build/{}_{}_{}/".format(full_platform.lower(), args.target.lower(), args.cpu_type)


def make_testdir(args):
Expand Down
64 changes: 32 additions & 32 deletions platforms/opsis.py
Original file line number Diff line number Diff line change
Expand Up @@ -401,38 +401,38 @@ def tofe_pin(tofe_netname):
Subsignal("b_io_n", Pins(" ".join(p for n, p in sorted(_tofe_io.items()) if n.endswith('n') and 'io_b' in n))),
),

## # serial
## ("tofe_lsio_serial", 0,
## Subsignal("tx", Pins(tofe_pin(tofe_low_speed_io("rx")))),
## Subsignal("rx", Pins(tofe_pin(tofe_low_speed_io("tx"))), Misc("PULLUP")),
## IOStandard("LVCMOS33")
## ),
##
## # user leds
## ("tofe_lsio_user_led", 0, Pins(tofe_pin(tofe_low_speed_io("led1"))), IOStandard("LVCMOS33"), Misc("DRIVE=12")),
## ("tofe_lsio_user_led", 1, Pins(tofe_pin(tofe_low_speed_io("led2"))), IOStandard("LVCMOS33"), Misc("DRIVE=12")),
## ("tofe_lsio_user_led", 2, Pins(tofe_pin(tofe_low_speed_io("led3"))), IOStandard("LVCMOS33"), Misc("DRIVE=12")),
## ("tofe_lsio_user_led", 3, Pins(tofe_pin(tofe_low_speed_io("led4"))), IOStandard("LVCMOS33"), Misc("DRIVE=12")),
##
## # push buttons
## ("tofe_lsio_user_sw", 0, Pins(tofe_pin(tofe_low_speed_io("sw1"))), IOStandard("LVCMOS33"), Misc("PULLUP")),
## ("tofe_lsio_user_sw", 1, Pins(tofe_pin(tofe_low_speed_io("sw2"))), IOStandard("LVCMOS33"), Misc("PULLUP")),
## ("tofe_lsio_user_sw", 2, Pins(tofe_pin(tofe_low_speed_io("sw3"))), IOStandard("LVCMOS33"), Misc("PULLUP")),
## ("tofe_lsio_user_sw", 3, Pins(tofe_pin(tofe_low_speed_io("sw4"))), IOStandard("LVCMOS33"), Misc("PULLUP")),
##
## # PmodUSBUART or similar device connected to the "p3" Pmod connector.
## ("tofe_lsio_pmod_serial", 0,
## # PmodUSBUART - Pmod Type4 - UART
## # Pin 1 - CTS - In - Peripheral can transmit
## # Pin 2 - TXD - Out - Data - Host to peripheral
## # Pin 3 - RXD - In - Data - Peripheral to host
## # Pin 4 - RTS - Out - Peripheral ready for data
## # Pin 5 - GND
## # Pin 6 - VCC
## Subsignal("tx", Pins(tofe_pin(tofe_low_speed_pmod_io('p3', 2)))),
## Subsignal("rx", Pins(tofe_pin(tofe_low_speed_pmod_io('p3', 3))), Misc("PULLUP")),
## IOStandard("LVCMOS33")
## ),
# serial
("tofe_lsio_serial", 0,
Subsignal("tx", Pins(tofe_pin(tofe_low_speed_io("rx")))),
Subsignal("rx", Pins(tofe_pin(tofe_low_speed_io("tx"))), Misc("PULLUP")),
IOStandard("LVCMOS33")
),

# user leds
("tofe_lsio_user_led", 0, Pins(tofe_pin(tofe_low_speed_io("led1"))), IOStandard("LVCMOS33"), Misc("DRIVE=12")),
("tofe_lsio_user_led", 1, Pins(tofe_pin(tofe_low_speed_io("led2"))), IOStandard("LVCMOS33"), Misc("DRIVE=12")),
("tofe_lsio_user_led", 2, Pins(tofe_pin(tofe_low_speed_io("led3"))), IOStandard("LVCMOS33"), Misc("DRIVE=12")),
("tofe_lsio_user_led", 3, Pins(tofe_pin(tofe_low_speed_io("led4"))), IOStandard("LVCMOS33"), Misc("DRIVE=12")),

# push buttons
("tofe_lsio_user_sw", 0, Pins(tofe_pin(tofe_low_speed_io("sw1"))), IOStandard("LVCMOS33"), Misc("PULLUP")),
("tofe_lsio_user_sw", 1, Pins(tofe_pin(tofe_low_speed_io("sw2"))), IOStandard("LVCMOS33"), Misc("PULLUP")),
("tofe_lsio_user_sw", 2, Pins(tofe_pin(tofe_low_speed_io("sw3"))), IOStandard("LVCMOS33"), Misc("PULLUP")),
("tofe_lsio_user_sw", 3, Pins(tofe_pin(tofe_low_speed_io("sw4"))), IOStandard("LVCMOS33"), Misc("PULLUP")),

# PmodUSBUART or similar device connected to the "p3" Pmod connector.
("tofe_lsio_pmod_serial", 0,
# PmodUSBUART - Pmod Type4 - UART
# Pin 1 - CTS - In - Peripheral can transmit
# Pin 2 - TXD - Out - Data - Host to peripheral
# Pin 3 - RXD - In - Data - Peripheral to host
# Pin 4 - RTS - Out - Peripheral ready for data
# Pin 5 - GND
# Pin 6 - VCC
Subsignal("tx", Pins(tofe_pin(tofe_low_speed_pmod_io('p3', 2)))),
Subsignal("rx", Pins(tofe_pin(tofe_low_speed_pmod_io('p3', 3))), Misc("PULLUP")),
IOStandard("LVCMOS33")
),
]

pt = None
Expand Down
23 changes: 18 additions & 5 deletions targets/opsis/Makefile.mk
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,33 @@

TARGET ?= video

gateware-load-opsis: tftp
gateware-load-opsis:
opsis-mode-switch --verbose --load-gateware $(TARGET_BUILD_DIR)/gateware/top.bit
opsis-mode-switch --verbose --reset-gateware

gateware-flash-opsis:
opsis-mode-switch --verbose --flash-gateware=$(TARGET_BUILD_DIR)/gateware/top.bin
opsis-mode-switch --verbose --reset-gateware

firmware-load-opsis:
opsis-mode-switch --verbose --mode=serial
flterm --port=$$(opsis-mode-switch --get-serial-dev) --kernel=$(TARGET_BUILD_DIR)/software/firmware/firmware.bin

firmware-flash-opsis:
opsis-mode-switch --verbose --flash-lm32-firmware=$(TARGET_BUILD_DIR)/software/firmware/firmware.fbi
opsis-mode-switch --verbose --reset-gateware

firmware-connect-opsis:
opsis-mode-switch --verbose --mode=serial
flterm --port=$$(opsis-mode-switch --get-serial-dev)

image-flash-opsis:
opsis-mode-switch --verbose --flash-gateware=$(TARGET_BUILD_DIR)/flash.bin
opsis-mode-switch --verbose --reset-gateware

reset-opsis:
opsis-mode-switch --verbose --mode=serial
opsis-mode-switch --verbose --mode=jtag
opsis-mode-switch --verbose --mode=serial

flash-opsis:
opsis-mode-switch --verbose --flash-gateware=$(TARGET_BUILD_DIR)/gateware/top.bin
opsis-mode-switch --verbose --flash-lm32-firmware=$(TARGET_BUILD_DIR)/software/firmware/firmware.fbi

.PHONY: gateware-load-opsis firmware-load-opsis reset-opsis flash-opsis

0 comments on commit 1090bf3

Please sign in to comment.