build/sim/core/modules: fix compilation warnings
[litex.git] / litex / build / dfu.py
1 # This file is Copyright (c) 2020 Florent Kermarrec <florent@enjoy-digital.fr>
2 # License: BSD
3
4 import subprocess
5
6 from litex.build.tools import write_to_file
7 from litex.build.generic_programmer import GenericProgrammer
8
9 # DFUProg ------------------------------------------------------------------------------------------
10
11 class DFUProg(GenericProgrammer):
12 needs_bitreverse = False
13
14 def __init__(self, vid, pid):
15 self.vid = vid
16 self.pid = pid
17
18 def load_bitstream(self, bitstream_file):
19 subprocess.call(["cp", bitstream_file, bitstream_file + ".dfu"])
20 subprocess.call(["dfu-suffix", "-v", self.vid, "-p", self.pid, "-a", bitstream_file + ".dfu"])
21 subprocess.call(["dfu-util", "--download", bitstream_file + ".dfu"])