From d9f006e123ed6991578466cf3740305cd4b6eb6b Mon Sep 17 00:00:00 2001 From: Andrew Dennison Date: Mon, 5 Feb 2024 10:38:24 +1100 Subject: [PATCH 1/2] litex/build/efinix: add spi_width Doesn't seem needed for Trion but probably essential for Titanium? --- litex/build/efinix/efinity.py | 2 +- litex/build/efinix/platform.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/litex/build/efinix/efinity.py b/litex/build/efinix/efinity.py index 04f6df610..5fdd4ea1f 100644 --- a/litex/build/efinix/efinity.py +++ b/litex/build/efinix/efinity.py @@ -361,7 +361,7 @@ class EfinityToolchain(GenericToolchain): "--io_weak_pullup", "on", "--enable_roms", "on", "--mode", self.platform.spi_mode, - "--width", "1", + "--width", self.platform.spi_width, "--enable_crc_check", "on" ], common.colors) if r != 0: diff --git a/litex/build/efinix/platform.py b/litex/build/efinix/platform.py index 1dc76fb90..52d1fc4cc 100644 --- a/litex/build/efinix/platform.py +++ b/litex/build/efinix/platform.py @@ -23,13 +23,14 @@ class EfinixPlatform(GenericPlatform): _supported_toolchains = ["efinity"] - def __init__(self, *args, iobank_info=None, toolchain="efinity", spi_mode="active", **kwargs): + def __init__(self, *args, iobank_info=None, toolchain="efinity", spi_mode="active", spi_width="1", **kwargs): GenericPlatform.__init__(self, *args, **kwargs) self.timing_model = self.device[-2:] self.device = self.device[:-2] self.iobank_info = iobank_info self.spi_mode = spi_mode + self.spi_width = spi_width if self.device[:2] == "Ti": self.family = "Titanium" else: From f81c940e7bb123d0fbc4c7eeacc01e8418a938c2 Mon Sep 17 00:00:00 2001 From: Andrew Dennison Date: Mon, 5 Feb 2024 10:40:04 +1100 Subject: [PATCH 2/2] litex/build/efinix: add binary output This is the file required for passive SPI loading. --- litex/build/efinix/efinity.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/litex/build/efinix/efinity.py b/litex/build/efinix/efinity.py index 5fdd4ea1f..2e0b79963 100644 --- a/litex/build/efinix/efinity.py +++ b/litex/build/efinix/efinity.py @@ -366,3 +366,14 @@ class EfinityToolchain(GenericToolchain): ], common.colors) if r != 0: raise OSError("Error occurred during efx_pgm execution.") + + # BINARY + os.environ['EFXPGM_HOME'] = self.efinity_path + "/pgm" + r = tools.subprocess_call_filtered([self.efinity_path + "/bin/python3", + self.efinity_path + "/pgm/bin/efx_pgm/export_bitstream.py", + "hex_to_bin", + f"{self._build_name}.hex", + f"{self._build_name}.bin" + ], common.colors) + if r != 0: + raise OSError("Error occurred during export_bitstream execution.")