From: Robert Jordens Date: Fri, 3 Jul 2015 04:04:04 +0000 (-0600) Subject: mibuild/openocd.py: add support X-Git-Tag: 24jan2021_ls180~2099^2~39 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=8d6aa820823fa8493d71addc053e26856b3afe29;p=litex.git mibuild/openocd.py: add support Tested with pipistrello and kc705. Needs patches from https://github.com/jordens/openocd/tree/bscan_spi waiting to be merged in the openocd queue. --- diff --git a/mibuild/openocd.py b/mibuild/openocd.py new file mode 100644 index 00000000..47e51c7e --- /dev/null +++ b/mibuild/openocd.py @@ -0,0 +1,30 @@ +import subprocess + +from mibuild.generic_programmer import GenericProgrammer + + +class OpenOCD(GenericProgrammer): + needs_bitreverse = False + + def __init__(self, config, flash_proxy_basename=None): + GenericProgrammer.__init__(self, flash_proxy_basename) + self.config = config + + def load_bitstream(self, bitstream): + script = "; ".join([ + "init", + "pld load 0 {}".format(bitstream), + "exit", + ]) + subprocess.call(["openocd", "-f", self.config, "-c", script]) + + def flash(self, address, data): + flash_proxy = self.find_flash_proxy() + script = "; ".join([ + "init", + "jtagspi_init 0 {}".format(flash_proxy), + "jtagspi_program {} 0x{:x}".format(data, address), + "fpga_program", + "exit" + ]) + subprocess.call(["openocd", "-f", self.config, "-c", script])