build/efinix: Improve error message when Efinity toolchain is not found.

This commit is contained in:
Florent Kermarrec 2021-10-13 14:41:44 +02:00
parent fd354c5759
commit f0a3fcfefa
2 changed files with 16 additions and 10 deletions

View File

@ -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)

View File

@ -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'