efinix: fix programmer load_bitstream

This commit is contained in:
Franck Jullien 2021-09-20 08:42:27 +02:00
parent 9b6ae2ff03
commit 106b1f29a7
1 changed files with 9 additions and 4 deletions

View File

@ -6,6 +6,7 @@
import os import os
import sys import sys
import subprocess
from litex.build.generic_programmer import GenericProgrammer from litex.build.generic_programmer import GenericProgrammer
@ -21,7 +22,11 @@ class EfinixProgrammer(GenericProgrammer):
def load_bitstream(self, bitstream_file, cable_suffix=""): def load_bitstream(self, bitstream_file, cable_suffix=""):
os.environ['EFXPGM_HOME'] = self.efinity_path + '/pgm' os.environ['EFXPGM_HOME'] = self.efinity_path + '/pgm'
self.call([self.efinity_path + '/bin/python3', self.efinity_path + if (subprocess.call([self.efinity_path + '/bin/python3', self.efinity_path +
'pgm/bin/efx_pgm/ftdi_program.py', bitstream_file, '/pgm/bin/efx_pgm/ftdi_program.py', bitstream_file,
"-m", "jtag" "-m", "jtag"], env=os.environ.copy()) != 0):
]) msg = f"Error occured during {self.__class__.__name__}'s call, please check:\n"
msg += f"- {self.__class__.__name__} installation.\n"
msg += f"- access permissions.\n"
msg += f"- hardware and cable."
raise OSError(msg)