Merge pull request #736 from Disasm/ecpdap

Add ECPDAP programmer
This commit is contained in:
enjoy-digital 2020-12-18 15:39:24 +01:00 committed by GitHub
commit 7fccf9fcd0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -147,3 +147,30 @@ class UJProg(GenericProgrammer):
def load_bitstream(self, bitstream_file): def load_bitstream(self, bitstream_file):
self.call(["ujprog", bitstream_file]) self.call(["ujprog", bitstream_file])
# EcpDapProgrammer -------------------------------------------------------------------------------
class EcpDapProgrammer(GenericProgrammer):
"""ECPDAP allows you to program ECP5 FPGAs and attached SPI flash using CMSIS-DAP probes in JTAG mode.
You can get `ecpdap` here: https://github.com/adamgreig/ecpdap
"""
needs_bitreverse = False
def __init__(self, frequency=8_000_000):
self.frequency_khz = frequency // 1000
def flash(self, address, bitstream_file):
self.call(["ecpdap",
"flash", "write",
"--freq", str(self.frequency_khz),
"--offset", str(address),
bitstream_file
])
def load_bitstream(self, bitstream_file):
self.call(["ecpdap",
"program",
"--freq", str(self.frequency_khz),
bitstream_file
])