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 <m.breithaupt@vogl-electronic.com>
This commit is contained in:
Matthias Breithaupt 2024-06-05 10:44:30 +02:00 committed by Fin Maaß
parent 41b346d141
commit e29dc39377
1 changed files with 3 additions and 2 deletions

View File

@ -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",