diff --git a/litex/build/osfpga/blinky.py b/litex/build/osfpga/blinky.py index 7c1054e0b..38baa7a01 100755 --- a/litex/build/osfpga/blinky.py +++ b/litex/build/osfpga/blinky.py @@ -22,7 +22,7 @@ _io = [ class Platform(OSFPGAPlatform): def __init__(self): - OSFPGAPlatform.__init__(self, device=None, io=_io) # FIXME: Add device support. + OSFPGAPlatform.__init__(self, device=None, toolchain="raptor", io=_io) # FIXME: Add device support. # Minimal Design ----------------------------------------------------------------------------------- diff --git a/litex/build/osfpga/foedag.py b/litex/build/osfpga/osfpga.py similarity index 84% rename from litex/build/osfpga/foedag.py rename to litex/build/osfpga/osfpga.py index a84a718d2..d69ca648d 100644 --- a/litex/build/osfpga/foedag.py +++ b/litex/build/osfpga/osfpga.py @@ -62,13 +62,14 @@ def _build_tcl(name, device, files, build_name): with open("build.tcl", "w") as f: f.write("\n".join(tcl)) -# FOEDAGToolchain ----------------------------------------------------------------------------------- +# OSFPGAToolchain ----------------------------------------------------------------------------------- -class FOEDAGToolchain: +class OSFPGAToolchain: attr_translate = {} - def __init__(self): - self.clocks = dict() + def __init__(self, toolchain): + self.toolchain = toolchain + self.clocks = dict() def build(self, platform, fragment, build_dir = "build", @@ -114,14 +115,14 @@ class FOEDAGToolchain: # Run if run: - foedag_sh = "foedag" - if which(foedag_sh) is None: - msg = "Unable to find FOEDAG toolchain, please:\n" - msg += "- Add FOEDAG toolchain to your $PATH." + toolchain_sh = self.toolchain + if which(toolchain_sh) is None: + msg = f"Unable to find {toolchain_sh.upper()} toolchain, please:\n" + msg += f"- Add {toolchain_sh.upper()} toolchain to your $PATH." raise OSError(msg) - if subprocess.call([foedag_sh, "--batch", "--script", "build.tcl"]) != 0: - raise OSError("Error occured during FOEDAG's script execution.") + if subprocess.call([toolchain_sh, "--batch", "--script", "build.tcl"]) != 0: + raise OSError(f"Error occured during {toolchain_sh.upper()}'s script execution.") os.chdir(cwd) diff --git a/litex/build/osfpga/platform.py b/litex/build/osfpga/platform.py index 6412bd1b8..d04fc06f0 100644 --- a/litex/build/osfpga/platform.py +++ b/litex/build/osfpga/platform.py @@ -7,7 +7,7 @@ import os from litex.build.generic_platform import GenericPlatform -from litex.build.osfpga import common, foedag +from litex.build.osfpga import common, osfpga # OSFPGAPlatform ----------------------------------------------------------------------------------- @@ -17,8 +17,8 @@ class OSFPGAPlatform(GenericPlatform): def __init__(self, device, *args, toolchain="foedag", devicename=None, **kwargs): GenericPlatform.__init__(self, device, *args, **kwargs) self.devicename = devicename - if toolchain == "foedag": - self.toolchain = foedag.FOEDAGToolchain() + if toolchain in ["foedag", "raptor"]: + self.toolchain = osfpga.OSFPGAToolchain(toolchain=toolchain) else: raise ValueError(f"Unknown toolchain {toolchain}")