Skip to content

Commit 8d6aa82

Browse files
committedJul 8, 2015
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.
1 parent 73ea404 commit 8d6aa82

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed
 

Diff for: ‎mibuild/openocd.py

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import subprocess
2+
3+
from mibuild.generic_programmer import GenericProgrammer
4+
5+
6+
class OpenOCD(GenericProgrammer):
7+
needs_bitreverse = False
8+
9+
def __init__(self, config, flash_proxy_basename=None):
10+
GenericProgrammer.__init__(self, flash_proxy_basename)
11+
self.config = config
12+
13+
def load_bitstream(self, bitstream):
14+
script = "; ".join([
15+
"init",
16+
"pld load 0 {}".format(bitstream),
17+
"exit",
18+
])
19+
subprocess.call(["openocd", "-f", self.config, "-c", script])
20+
21+
def flash(self, address, data):
22+
flash_proxy = self.find_flash_proxy()
23+
script = "; ".join([
24+
"init",
25+
"jtagspi_init 0 {}".format(flash_proxy),
26+
"jtagspi_program {} 0x{:x}".format(data, address),
27+
"fpga_program",
28+
"exit"
29+
])
30+
subprocess.call(["openocd", "-f", self.config, "-c", script])

0 commit comments

Comments
 (0)
Please sign in to comment.