programmer: add USBBlaster and use platform.bitstream_ext in make
authorFlorent Kermarrec <florent@enjoy-digital.fr>
Mon, 14 Apr 2014 15:23:04 +0000 (17:23 +0200)
committerSebastien Bourdeauducq <sb@m-labs.hk>
Thu, 17 Apr 2014 17:32:46 +0000 (19:32 +0200)
make.py
programmer.py

diff --git a/make.py b/make.py
index 0b866e52fbbf4ada57a7eeea13a6e78ded5bfd6c..c245e0c8b20843bd639160b43c5f1f153f12d455 100755 (executable)
--- a/make.py
+++ b/make.py
@@ -183,7 +183,7 @@ Subtarget: {}
        if actions["load-bitstream"] or actions["flash-bitstream"] or actions["flash-bios"]:
                prog = programmer.create_programmer(platform.name, args.flash_proxy_dir)
                if actions["load-bitstream"]:
-                       prog.load_bitstream("build/" + build_name + ".bit")
+                       prog.load_bitstream("build/" + build_name + platform.bitstream_ext)
                if actions["flash-bitstream"]:
                        if prog.needs_bitreverse:
                                flashbit = "build/" + build_name + ".fpg"
index 7615fdeafc1445aa712c6d455c6facafbba7ff3b..64f455a43067195571b5fbf9337f0e003b4f009d 100644 (file)
@@ -57,9 +57,20 @@ class XC3SProg(Programmer):
                flash_proxy = self.find_flash_proxy("bscan_spi_lx9_papilio.bit")
                subprocess.call(["xc3sprog", "-c", "papilio", "-I"+flash_proxy, "{}:w:0x{:x}:BIN".format(data_file, address)])
 
+class USBBlaster(Programmer):
+       needs_bitreverse = False
+
+       def load_bitstream(self, bitstream_file, port=0):
+               usb_port = "[USB-"+str(port)+"]"
+               subprocess.call(["quartus_pgm", "-m", "jtag", "-c", "USB-Blaster"+usb_port, "-o", "p;"+bitstream_file])
+
+       def flash(self, address, data_file):
+               raise NotImplementedError
+
 def create_programmer(platform_name, *args, **kwargs):
        return {
                "mixxeo":               UrJTAG,
                "m1":                   UrJTAG,
-               "papilio_pro":  XC3SProg
+               "papilio_pro":  XC3SProg,
+               "de0nano":              USBBlaster
        }[platform_name](platform_name, *args, **kwargs)