mirror of
https://github.com/enjoy-digital/litex.git
synced 2025-01-04 09:52:26 -05:00
Merge pull request #952 from smunaut/dfu
build/DFUProg: Allow to specify alt interface and to not reboot
This commit is contained in:
commit
26df3fa2c4
1 changed files with 10 additions and 3 deletions
|
@ -14,11 +14,18 @@ from litex.build.generic_programmer import GenericProgrammer
|
|||
class DFUProg(GenericProgrammer):
|
||||
needs_bitreverse = False
|
||||
|
||||
def __init__(self, vid, pid):
|
||||
def __init__(self, vid, pid, alt=None):
|
||||
self.vid = vid
|
||||
self.pid = pid
|
||||
self.alt = alt
|
||||
|
||||
def load_bitstream(self, bitstream_file):
|
||||
def load_bitstream(self, bitstream_file, reset=True):
|
||||
subprocess.call(["cp", bitstream_file, bitstream_file + ".dfu"])
|
||||
subprocess.call(["dfu-suffix", "-v", self.vid, "-p", self.pid, "-a", bitstream_file + ".dfu"])
|
||||
subprocess.call(["dfu-util", "--download", bitstream_file + ".dfu", "-R"])
|
||||
|
||||
flash_cmd = ["dfu-util", "--download", bitstream_file + ".dfu"]
|
||||
if reset:
|
||||
flash_cmd.append("-R")
|
||||
if self.alt is not None:
|
||||
flash_cmd.extend(["-a", str(self.alt)])
|
||||
subprocess.call(flash_cmd)
|
||||
|
|
Loading…
Reference in a new issue