platforms/ice40/ecp5: add toolchain parameter with default to trellis (ECP5) or icestorm (iCE40).

Required to simplify simple.py target and use trellis/icestorm as default toolchain.
This commit is contained in:
Florent Kermarrec 2020-11-12 13:33:30 +01:00
parent 5cf7731f37
commit a4d05522d4
15 changed files with 30 additions and 30 deletions

View File

@ -65,8 +65,8 @@ class Platform(LatticePlatform):
default_clk_name = "clk27" default_clk_name = "clk27"
default_clk_period = 1e9/27e6 default_clk_period = 1e9/27e6
def __init__(self, **kwargs): def __init__(self, toolchain="trellis", **kwargs):
LatticePlatform.__init__(self, "LFE5U-25F-8BG381C", _io, **kwargs) LatticePlatform.__init__(self, "LFE5U-25F-8BG381C", _io, toolchain=toolchain, **kwargs)
def do_finalize(self, fragment): def do_finalize(self, fragment):
LatticePlatform.do_finalize(self, fragment) LatticePlatform.do_finalize(self, fragment)

View File

@ -215,13 +215,13 @@ class Platform(LatticePlatform):
default_clk_name = "clk25" default_clk_name = "clk25"
default_clk_period = 1e9/25e6 default_clk_period = 1e9/25e6
def __init__(self, revision="7.0"): def __init__(self, revision="7.0", toolchain="trellis"):
assert revision in ["6.1", "7.0"] assert revision in ["6.1", "7.0"]
self.revision = revision self.revision = revision
device = {"6.1": "LFE5U-25F-6BG381C", "7.0": "LFE5U-25F-6BG256C"}[revision] device = {"6.1": "LFE5U-25F-6BG381C", "7.0": "LFE5U-25F-6BG256C"}[revision]
io = {"6.1": _io_v6_1, "7.0": _io_v7_0}[revision] io = {"6.1": _io_v6_1, "7.0": _io_v7_0}[revision]
connectors = {"6.1": _connectors_v6_1, "7.0": _connectors_v7_0}[revision] connectors = {"6.1": _connectors_v6_1, "7.0": _connectors_v7_0}[revision]
LatticePlatform.__init__(self, device, io, connectors=connectors, toolchain="trellis") LatticePlatform.__init__(self, device, io, connectors=connectors, toolchain=toolchain)
def create_programmer(self): def create_programmer(self):
return OpenOCDJTAGProgrammer("openocd_colorlight_5a_75b.cfg") return OpenOCDJTAGProgrammer("openocd_colorlight_5a_75b.cfg")

View File

@ -222,13 +222,13 @@ class Platform(LatticePlatform):
default_clk_name = "clk25" default_clk_name = "clk25"
default_clk_period = 1e9/25e6 default_clk_period = 1e9/25e6
def __init__(self, revision="7.1"): def __init__(self, revision="7.1", toolchain="trellis"):
assert revision in ["6.0", "7.1"] assert revision in ["6.0", "7.1"]
self.revision = revision self.revision = revision
device = {"6.0": "LFE5U-25F-6BG256C", "7.1": "LFE5U-25F-6BG256C"}[revision] device = {"6.0": "LFE5U-25F-6BG256C", "7.1": "LFE5U-25F-6BG256C"}[revision]
io = {"6.0": _io_v6_0, "7.1": _io_v7_1}[revision] io = {"6.0": _io_v6_0, "7.1": _io_v7_1}[revision]
connectors = {"6.0": _connectors_v6_0, "7.1": _connectors_v7_1}[revision] connectors = {"6.0": _connectors_v6_0, "7.1": _connectors_v7_1}[revision]
LatticePlatform.__init__(self, device, io, connectors=connectors, toolchain="trellis") LatticePlatform.__init__(self, device, io, connectors=connectors, toolchain=toolchain)
def create_programmer(self): def create_programmer(self):
return OpenOCDJTAGProgrammer("openocd_colorlight_5a_75b.cfg") return OpenOCDJTAGProgrammer("openocd_colorlight_5a_75b.cfg")

View File

@ -136,8 +136,8 @@ class Platform(LatticePlatform):
default_clk_name = "clk12" default_clk_name = "clk12"
default_clk_period = 1e9/12e6 default_clk_period = 1e9/12e6
def __init__(self, **kwargs): def __init__(self, toolchain="trellis", **kwargs):
LatticePlatform.__init__(self, "LFE5UM5G-85F-8BG381", _io, _connectors, **kwargs) LatticePlatform.__init__(self, "LFE5UM5G-85F-8BG381", _io, _connectors, toolchain=toolchain, **kwargs)
def request(self, *args, **kwargs): def request(self, *args, **kwargs):
import time import time

View File

@ -111,8 +111,8 @@ class Platform(LatticePlatform):
default_clk_name = "clk100" default_clk_name = "clk100"
default_clk_period = 1e9/100e6 default_clk_period = 1e9/100e6
def __init__(self, **kwargs): def __init__(self, toolchain="trellis", **kwargs):
LatticePlatform.__init__(self, "LFE5UM5G-85F-8BG554I", _io, _connectors, **kwargs) LatticePlatform.__init__(self, "LFE5UM5G-85F-8BG554I", _io, _connectors, toolchain=toolchain, **kwargs)
def create_programmer(self): def create_programmer(self):
return OpenOCDJTAGProgrammer("openocd_ecpix5.cfg") return OpenOCDJTAGProgrammer("openocd_ecpix5.cfg")

View File

@ -86,8 +86,8 @@ class Platform(LatticePlatform):
default_clk_name = "clk48" default_clk_name = "clk48"
default_clk_period = 1e9/48e6 default_clk_period = 1e9/48e6
def __init__(self): def __init__(self, toolchain="icestorm"):
LatticePlatform.__init__(self, "ice40-up5k-sg48", _io, _connectors, toolchain="icestorm") LatticePlatform.__init__(self, "ice40-up5k-sg48", _io, _connectors, toolchain=toolchain)
def create_programmer(self): def create_programmer(self):
return IceStormProgrammer() return IceStormProgrammer()

View File

@ -66,8 +66,8 @@ class Platform(LatticePlatform):
default_clk_name = "clk48" default_clk_name = "clk48"
default_clk_period = 1e9/48e6 default_clk_period = 1e9/48e6
def __init__(self): def __init__(self, toolchain="icestorm"):
LatticePlatform.__init__(self, "ice40-up5k-uwg30", _io, _connectors, toolchain="icestorm") LatticePlatform.__init__(self, "ice40-up5k-uwg30", _io, _connectors, toolchain=toolchain)
def create_programmer(self): def create_programmer(self):
return IceStormProgrammer() return IceStormProgrammer()

View File

@ -69,8 +69,8 @@ class Platform(LatticePlatform):
default_clk_name = "clk48" default_clk_name = "clk48"
default_clk_period = 1e9/48e6 default_clk_period = 1e9/48e6
def __init__(self): def __init__(self, toolchain="icestorm"):
LatticePlatform.__init__(self, "ice40-up5k-uwg30", _io, _connectors, toolchain="icestorm") LatticePlatform.__init__(self, "ice40-up5k-uwg30", _io, _connectors, toolchain=toolchain)
def create_programmer(self): def create_programmer(self):
return IceStormProgrammer() return IceStormProgrammer()

View File

@ -89,8 +89,8 @@ class Platform(LatticePlatform):
default_clk_name = "clk12" default_clk_name = "clk12"
default_clk_period = 1e9/12e6 default_clk_period = 1e9/12e6
def __init__(self): def __init__(self, toolchain="icestorm"):
LatticePlatform.__init__(self, "ice40-up5k-sg48", _io, _connectors, toolchain="icestorm") LatticePlatform.__init__(self, "ice40-up5k-sg48", _io, _connectors, toolchain=toolchain)
def create_programmer(self): def create_programmer(self):
return IceStormProgrammer() return IceStormProgrammer()

View File

@ -192,12 +192,12 @@ class Platform(LatticePlatform):
default_clk_name = "clk25" default_clk_name = "clk25"
default_clk_period = 1e9/25e6 default_clk_period = 1e9/25e6
def __init__(self, revision="rev0", device="45F", **kwargs): def __init__(self, revision="rev0", device="45F", toolchain="trellis", **kwargs):
assert revision in ["rev0"] assert revision in ["rev0"]
self.revision = revision self.revision = revision
io = {"rev0": _io_rev0 }[revision] io = {"rev0": _io_rev0 }[revision]
connectors = {"rev0": _connectors_rev0 }[revision] connectors = {"rev0": _connectors_rev0 }[revision]
LatticePlatform.__init__(self, f"LFE5UM5G-{device}-8BG381C", io, connectors, **kwargs) LatticePlatform.__init__(self, f"LFE5UM5G-{device}-8BG381C", io, connectors, toolchain="trellis", **kwargs)
def create_programmer(self): def create_programmer(self):
return DFUProg(vid="1d50", pid="6130") return DFUProg(vid="1d50", pid="6130")

View File

@ -220,12 +220,12 @@ class Platform(LatticePlatform):
default_clk_name = "clk48" default_clk_name = "clk48"
default_clk_period = 1e9/48e6 default_clk_period = 1e9/48e6
def __init__(self, revision="0.2", device="25F", **kwargs): def __init__(self, revision="0.2", device="25F", toolchain="trellis", **kwargs):
assert revision in ["0.1", "0.2"] assert revision in ["0.1", "0.2"]
self.revision = revision self.revision = revision
io = {"0.1": _io_r0_1, "0.2": _io_r0_2 }[revision] io = {"0.1": _io_r0_1, "0.2": _io_r0_2 }[revision]
connectors = {"0.1": _connectors_r0_1, "0.2": _connectors_r0_2}[revision] connectors = {"0.1": _connectors_r0_1, "0.2": _connectors_r0_2}[revision]
LatticePlatform.__init__(self, f"LFE5U-{device}-8MG285C", io, connectors, **kwargs) LatticePlatform.__init__(self, f"LFE5U-{device}-8MG285C", io, connectors, toolchain=toolchain, **kwargs)
def create_programmer(self): def create_programmer(self):
return DFUProg(vid="1209", pid="5af0") return DFUProg(vid="1209", pid="5af0")

View File

@ -67,8 +67,8 @@ class Platform(LatticePlatform):
default_clk_name = "clk16" default_clk_name = "clk16"
default_clk_period = 1e9/16e6 default_clk_period = 1e9/16e6
def __init__(self): def __init__(self, toolchain="icestorm"):
LatticePlatform.__init__(self, "ice40-lp8k-cm81", _io, _connectors, toolchain="icestorm") LatticePlatform.__init__(self, "ice40-lp8k-cm81", _io, _connectors, toolchain=toolchain)
self.add_extension(serial) self.add_extension(serial)
def create_programmer(self): def create_programmer(self):

View File

@ -259,8 +259,8 @@ class Platform(LatticePlatform):
default_clk_name = "clk12" default_clk_name = "clk12"
default_clk_period = 1e9/12e6 default_clk_period = 1e9/12e6
def __init__(self, **kwargs): def __init__(self, toolchain="trellis", **kwargs):
LatticePlatform.__init__(self, "LFE5UM5G-85F-8BG756C", _io, _connectors, **kwargs) LatticePlatform.__init__(self, "LFE5UM5G-85F-8BG756C", _io, _connectors, toolchain=toolchain, **kwargs)
def create_programmer(self): def create_programmer(self):
return OpenOCDJTAGProgrammer("openocd_trellisboard.cfg") return OpenOCDJTAGProgrammer("openocd_trellisboard.cfg")

View File

@ -146,11 +146,11 @@ class Platform(LatticePlatform):
default_clk_name = "clk25" default_clk_name = "clk25"
default_clk_period = 1e9/25e6 default_clk_period = 1e9/25e6
def __init__(self, device="LFE5U-45F", revision="2.0", **kwargs): def __init__(self, device="LFE5U-45F", revision="2.0", toolchain="trellis", **kwargs):
assert device in ["LFE5U-12F", "LFE5U-25F", "LFE5U-45F", "LFE5U-85F"] assert device in ["LFE5U-12F", "LFE5U-25F", "LFE5U-45F", "LFE5U-85F"]
assert revision in ["1.7", "2.0"] assert revision in ["1.7", "2.0"]
_io = _io_common + {"1.7": _io_1_7, "2.0": _io_2_0}[revision] _io = _io_common + {"1.7": _io_1_7, "2.0": _io_2_0}[revision]
LatticePlatform.__init__(self, device + "-6BG381C", _io, **kwargs) LatticePlatform.__init__(self, device + "-6BG381C", _io, toolchain=toolchain, **kwargs)
def create_programmer(self): def create_programmer(self):
return UJProg() return UJProg()

View File

@ -235,9 +235,9 @@ class Platform(LatticePlatform):
default_clk_name = "clk100" default_clk_name = "clk100"
default_clk_period = 1e9/100e6 default_clk_period = 1e9/100e6
def __init__(self, device="LFE5UM5G", **kwargs): def __init__(self, device="LFE5UM5G", toolchain="trellis", **kwargs):
assert device in ["LFE5UM5G", "LFE5UM"] assert device in ["LFE5UM5G", "LFE5UM"]
LatticePlatform.__init__(self, device + "-45F-8BG381C", _io, _connectors, **kwargs) LatticePlatform.__init__(self, device + "-45F-8BG381C", _io, _connectors, toolchain=toolchain, **kwargs)
def create_programmer(self): def create_programmer(self):
return OpenOCDJTAGProgrammer("openocd_versa_ecp5.cfg") return OpenOCDJTAGProgrammer("openocd_versa_ecp5.cfg")