From: Florent Kermarrec Date: Tue, 5 May 2020 10:17:12 +0000 (+0200) Subject: build/lattice/programmer: make OpenOCDJTAGProgrammer closer to OpenOCD programmer. X-Git-Tag: 24jan2021_ls180~387 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=85ac5ef1333d93049c0b1c98197738c34b66d5f3;p=litex.git build/lattice/programmer: make OpenOCDJTAGProgrammer closer to OpenOCD programmer. --- diff --git a/litex/build/lattice/programmer.py b/litex/build/lattice/programmer.py index 0095c147..e3d7a963 100644 --- a/litex/build/lattice/programmer.py +++ b/litex/build/lattice/programmer.py @@ -25,34 +25,31 @@ class LatticeProgrammer(GenericProgrammer): # OpenOCDJTAGProgrammer -------------------------------------------------------------------------------- class OpenOCDJTAGProgrammer(GenericProgrammer): - def __init__(self, openocd_config, flash_proxy_basename=None): - GenericProgrammer.__init__(self, flash_proxy_basename=flash_proxy_basename) - self.openocd_config = openocd_config + def __init__(self, config, flash_proxy_basename=None): + GenericProgrammer.__init__(self, flash_proxy_basename) + self.config = config def load_bitstream(self, bitstream_file): + config = self.find_config() svf_file = bitstream_file.replace(".bit", ".svf") - - subprocess.call(["openocd", "-f", self.openocd_config , "-c", "transport select jtag; init; svf quiet progress \"{}\"; exit".format(svf_file)]) + subprocess.call(["openocd", "-f", config, "-c", "transport select jtag; init; svf quiet progress \"{}\"; exit".format(svf_file)]) def flash(self, address, data, verify=True): - if self.flash_proxy_basename is None: - flash_proxy = None - else: - flash_proxy = self.find_flash_proxy() - + config = self.find_config() + flash_proxy = self.find_flash_proxy() script = "; ".join([ "transport select jtag", "target create ecp5.spi0.proxy testee -chain-position ecp5.tap", "flash bank spi0 jtagspi 0 0 0 0 ecp5.spi0.proxy 0x32", "init", - "svf quiet progress \"{}\"".format(flash_proxy) if flash_proxy is not None else "", + "svf quiet progress \"{}\"".format(flash_proxy), "reset halt", "flash probe spi0", "flash write_image erase \"{0}\" 0x{1:x}".format(data, address), "flash verify_bank spi0 \"{0}\" 0x{1:x}" if verify else "".format(data, address), "exit" ]) - subprocess.call(["openocd", "-f", self.openocd_config, "-c", script]) + subprocess.call(["openocd", "-f", config, "-c", script]) # IceStormProgrammer -------------------------------------------------------------------------------