diff --git a/litex/build/efinix/platform.py b/litex/build/efinix/platform.py index 5f73823b8..ef550e7ed 100644 --- a/litex/build/efinix/platform.py +++ b/litex/build/efinix/platform.py @@ -22,11 +22,14 @@ class EfinixPlatform(GenericPlatform): self.pll_available = ['PLL_TL0', 'PLL_TR0', 'PLL_TR1', 'PLL_TR2', 'PLL_TR3', 'PLL_BR0', 'PLL_BR1', 'PLL_BR2', 'PLL_BL0'] self.pll_used = [] - if 'LITEX_ENV_EFINITY' in os.environ: - self.efinity_path = os.environ['LITEX_ENV_EFINITY'].rstrip('/') - os.environ['EFINITY_HOME'] = self.efinity_path - else: - raise OSError('Unable to find Efinity toolchain, please set LITEX_ENV_EFINITY to ${install_dir}') + if os.getenv("LITEX_ENV_EFINITY", False) == False: + msg = "Unable to find or source Efinity toolchain, please either:\n" + msg += "- Set LITEX_ENV_EFINITY environment variant to Efinity path.\n" + msg += "- Or add Efinity toolchain to your $PATH." + raise OSError(msg) + + self.efinity_path = os.environ["LITEX_ENV_EFINITY"].rstrip('/') + os.environ["EFINITY_HOME"] = self.efinity_path if toolchain == "efinity": self.toolchain = efinity.EfinityToolchain(self.efinity_path) diff --git a/litex/build/efinix/programmer.py b/litex/build/efinix/programmer.py index c8607bf20..6ed48a64b 100644 --- a/litex/build/efinix/programmer.py +++ b/litex/build/efinix/programmer.py @@ -16,11 +16,14 @@ class EfinixProgrammer(GenericProgrammer): def __init__(self, cable_name=""): self.cable_name = cable_name - if 'LITEX_ENV_EFINITY' in os.environ: - self.efinity_path = os.environ['LITEX_ENV_EFINITY'].rstrip('/') - os.environ['EFINITY_HOME'] = self.efinity_path - else: - raise OSError('Unable to find Efinity toolchain, please set LITEX_ENV_EFINITY to ${install_dir}') + if os.getenv("LITEX_ENV_EFINITY", False) == False: + msg = "Unable to find or source Efinity toolchain, please either:\n" + msg += "- Set LITEX_ENV_EFINITY environment variant to Efinity path.\n" + msg += "- Or add Efinity toolchain to your $PATH." + raise OSError(msg) + + self.efinity_path = os.environ["LITEX_ENV_EFINITY"].rstrip('/') + os.environ["EFINITY_HOME"] = self.efinity_path def load_bitstream(self, bitstream_file, cable_suffix=""): os.environ['EFXPGM_HOME'] = self.efinity_path + '/pgm'