versa_ecp5: prepare for switchable ECP5 toolchains.
authorwhitequark <whitequark@whitequark.org>
Wed, 21 Aug 2019 17:51:46 +0000 (17:51 +0000)
committerwhitequark <whitequark@whitequark.org>
Wed, 21 Aug 2019 18:45:19 +0000 (18:45 +0000)
nmigen_boards/versa_ecp5.py

index e20f8cc9c511639c9ed945d221c766a1894c5a16..fdb79c0de3b4b7a3a923d29177e7ac914ad7970f 100644 (file)
@@ -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")