From d6f92d1ffd6c0886974f7162a6739ef6fe9f54b0 Mon Sep 17 00:00:00 2001 From: Florent Kermarrec Date: Thu, 11 Jun 2020 14:45:50 +0200 Subject: [PATCH] build: add DFUProg. --- litex/build/dfu.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 litex/build/dfu.py diff --git a/litex/build/dfu.py b/litex/build/dfu.py new file mode 100644 index 00000000..9890e1b8 --- /dev/null +++ b/litex/build/dfu.py @@ -0,0 +1,21 @@ +# This file is Copyright (c) 2020 Florent Kermarrec +# License: BSD + +import subprocess + +from litex.build.tools import write_to_file +from litex.build.generic_programmer import GenericProgrammer + +# DFUProg ------------------------------------------------------------------------------------------ + +class DFUProg(GenericProgrammer): + needs_bitreverse = False + + def __init__(self, vid, pid): + self.vid = vid + self.pid = pid + + def load_bitstream(self, bitstream_file): + 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"]) -- 2.30.2