def configure_ecp5(device, args): """ Command that prints information about devices connected to the scan chain to the console. """ with device.jtag as jtag: programmer = ECP5_JTAGProgrammer(jtag) with open(args.argument, "rb") as f: bitstream = f.read() programmer.configure(bitstream)
def toolchain_program(self, products, name): """ Programs the relevant LUNA board via its sideband connection. """ from luna.apollo import ApolloDebugger from luna.apollo.ecp5 import ECP5_JTAGProgrammer # Create our connection to the debug module. debugger = ApolloDebugger() # Grab our generated bitstream, and upload it to the FPGA. bitstream = products.get("{}.bit".format(name)) with debugger.jtag as jtag: programmer = ECP5_JTAGProgrammer(jtag) programmer.configure(bitstream)
def toolchain_program(self, products, name): openocd = os.environ.get("OPENOCD", "openocd") interface = os.environ.get("INTERFACE", "/dev/ttyACM0") if interface == "SiPEED" or interface == "busblaster": if interface == "SiPEED": args = [ "-c", """ interface ftdi ftdi_vid_pid 0x0403 0x6010 ftdi_layout_init 0x0018 0x05fb ftdi_layout_signal nSRST -data 0x0010 """ ] elif interface == "busblaster": args = ["-f", "interface/ftdi/dp_busblaster.cfg"] with products.extract("{}.svf".format(name)) as vector_filename: subprocess.check_call([ openocd, *args, "-c", "transport select jtag; adapter_khz 10000; init; svf -quiet {}; exit" .format(vector_filename) ]) elif interface == "pergola_bringup": # Early bringup code with products.extract("{}.bit".format(name)) as (bitstream): print( subprocess.check_call([ "bash", "-c", """ stty -F {} 300 raw -clocal -echo icrnl; sleep 0.01; cat {} & > /dev/null; CATPID=$! ; echo -n "$(stat -c%s {})\n" > {}; cp {} {}; sync; sleep 1; """.format(interface, interface, bitstream, interface, bitstream, interface) ])) # kill $CATPID || true; elif interface == "h2": with products.extract("{}.bit".format(name)) as (bitstream): print( subprocess.check_call([ "hf2", "-v", "0x239a", "-p", "0x0058", "flash", "--file", bitstream, "--address", "0x70000000", "-s" ])) else: """ Programs the board using the Apollo firmware """ from luna.apollo import ApolloDebugger from luna.apollo.ecp5 import ECP5_JTAGProgrammer # Create our connection to the debug module. debugger = ApolloDebugger() # Grab our generated bitstream, and upload it to the FPGA. bitstream = products.get("{}.bit".format(name)) with debugger.jtag as jtag: programmer = ECP5_JTAGProgrammer(jtag) programmer.configure(bitstream)