Skip to content

Commit

Permalink
Merge pull request #736 from Disasm/ecpdap
Browse files Browse the repository at this point in the history
Add ECPDAP programmer
  • Loading branch information
enjoy-digital authored Dec 18, 2020
2 parents b7aec66 + 0fe2477 commit 7fccf9f
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions litex/build/lattice/programmer.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,3 +147,30 @@ class UJProg(GenericProgrammer):

def load_bitstream(self, 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
])

0 comments on commit 7fccf9f

Please sign in to comment.