-
Notifications
You must be signed in to change notification settings - Fork 211
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tested with pipistrello and kc705. Needs patches from https://github.com/jordens/openocd/tree/bscan_spi waiting to be merged in the openocd queue.
Showing
1 changed file
with
30 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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]) |