From e29dc39377a4660983ebf6dc369683c1de4b4399 Mon Sep 17 00:00:00 2001 From: Matthias Breithaupt Date: Wed, 5 Jun 2024 10:44:30 +0200 Subject: [PATCH] openocd/jtagspi: Allow users to specify additional init commands This change makes it possible to e.g. use flahs chips that would not be correctly detected by OpenOCD. All that has to be done is to add `init_commands=["jtagspi set 0 \"name\" {size} {pagesize} {read_cmd} 0 {pprg_cmd} {mass_erase_cmd} {sector_size} {sector_erase_cmd}"]`. Signed-off-by: Matthias Breithaupt --- litex/build/openocd.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/litex/build/openocd.py b/litex/build/openocd.py index c9160c51c..62644da5f 100644 --- a/litex/build/openocd.py +++ b/litex/build/openocd.py @@ -27,12 +27,13 @@ class OpenOCD(GenericProgrammer): ]) self.call(["openocd", "-f", config, "-c", script]) - def flash(self, address, data, set_qe=False): + def flash(self, address, data, set_qe=False, init_commands=[]): config = self.find_config() flash_proxy = self.find_flash_proxy() script = "; ".join([ "init", - "jtagspi_init 0 {{{}}}".format(flash_proxy), + "jtagspi_init 0 {{{}}}".format(flash_proxy) + ] + init_commands + [ "jtagspi set_qe 0 1" if set_qe else "", "jtagspi_program {{{}}} 0x{:x}".format(data, address), "fpga_program",