Skip to content

Commit

Permalink
openocd/jtagspi: Allow users to specify additional init commands
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
m-byte committed Jun 5, 2024
1 parent fea4165 commit 1c13dc9
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions litex/build/openocd.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,13 @@ def load_bitstream(self, bitstream):
])
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",
Expand Down

0 comments on commit 1c13dc9

Please sign in to comment.