From f563844c7f35a6ed0ab1aa4609205e01a439d8ef Mon Sep 17 00:00:00 2001 From: whitequark Date: Wed, 21 Aug 2019 17:51:46 +0000 Subject: [PATCH] versa_ecp5: prepare for switchable ECP5 toolchains. --- nmigen_boards/versa_ecp5.py | 46 +++++++++++++++++++------------------ 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/nmigen_boards/versa_ecp5.py b/nmigen_boards/versa_ecp5.py index e20f8cc..fdb79c0 100644 --- a/nmigen_boards/versa_ecp5.py +++ b/nmigen_boards/versa_ecp5.py @@ -146,28 +146,30 @@ class VersaECP5Platform(LatticeECP5Platform): """), # X4 ] - file_templates = { - **LatticeECP5Platform.file_templates, - "{{name}}-openocd.cfg": r""" - interface ftdi - {# FTDI descriptors is identical between non-5G and 5G recent Versa boards #} - ftdi_device_desc "Lattice ECP5_5G VERSA Board" - ftdi_vid_pid 0x0403 0x6010 - ftdi_channel 0 - ftdi_layout_init 0xfff8 0xfffb - reset_config none - adapter_khz 25000 - - # ispCLOCK device (unusable with openocd and must be bypassed) - #jtag newtap ispclock tap -irlen 8 -expected-id 0x00191043 - # ECP5 device - {% if "5G" in platform.device -%} - jtag newtap ecp5 tap -irlen 8 -expected-id 0x81112043 ; # LFE5UM5G-45F - {% else -%} - jtag newtap ecp5 tap -irlen 8 -expected-id 0x01112043 ; # LFE5UM-45F - {% endif %} - """ - } + @property + def file_templates(self): + return { + **super().file_templates, + "{{name}}-openocd.cfg": r""" + interface ftdi + {# FTDI descriptors is identical between non-5G and 5G recent Versa boards #} + ftdi_device_desc "Lattice ECP5_5G VERSA Board" + ftdi_vid_pid 0x0403 0x6010 + ftdi_channel 0 + ftdi_layout_init 0xfff8 0xfffb + reset_config none + adapter_khz 25000 + + # ispCLOCK device (unusable with openocd and must be bypassed) + #jtag newtap ispclock tap -irlen 8 -expected-id 0x00191043 + # ECP5 device + {% if "5G" in platform.device -%} + jtag newtap ecp5 tap -irlen 8 -expected-id 0x81112043 ; # LFE5UM5G-45F + {% else -%} + jtag newtap ecp5 tap -irlen 8 -expected-id 0x01112043 ; # LFE5UM-45F + {% endif %} + """ + } def toolchain_program(self, products, name): openocd = os.environ.get("OPENOCD", "openocd") -- 2.30.2