build/lattice/programmer/load_bitstream: convert .bit to .svf with bit_to_svf it bitstream_file provided as .bit.

This commit is contained in:
Florent Kermarrec 2020-11-28 08:58:57 +01:00
parent 289234b102
commit e2dcdcf917
1 changed files with 9 additions and 2 deletions

View File

@ -33,8 +33,15 @@ class OpenOCDJTAGProgrammer(GenericProgrammer):
def load_bitstream(self, bitstream_file): def load_bitstream(self, bitstream_file):
config = self.find_config() config = self.find_config()
svf_file = bitstream_file.replace(".bit", ".svf") assert bitstream_file.endswith(".bit") or bitstream_file.endswith(".svf")
self.call(["openocd", "-f", config, "-c", "transport select jtag; init; svf quiet progress \"{}\"; exit".format(svf_file)]) if bitstream_file.endswith(".bit"):
from litex.build.lattice.bit_to_svf import bit_to_svf
bit = bitstream_file
svf = bit.replace(".bit", ".svf")
bit_to_svf(bit=bit, svf=svf)
else:
svf = bitstream_file
self.call(["openocd", "-f", config, "-c", "transport select jtag; init; svf quiet progress \"{}\"; exit".format(svf)])
def flash(self, address, data, verify=True): def flash(self, address, data, verify=True):
config = self.find_config() config = self.find_config()