Exemplo n.º 1
0
def program_config_flash(device, args):
    """ Command that programs a given bitstream into the device's configuration flash. """
    ensure_flash_gateware_loaded(device, log_function=logging.info)

    with open(args.argument, "rb") as f:
        bitstream = f.read()

    with device.flash as flash:
        flash.program(bitstream, logging.info)
Exemplo n.º 2
0
    def toolchain_erase(self):
        """ Erases the LUNA board's flash. """

        from luna.apollo import ApolloDebugger
        from luna.apollo.flash import ensure_flash_gateware_loaded

        # Create our connection to the debug module.
        debugger = ApolloDebugger()
        ensure_flash_gateware_loaded(debugger, platform=self.__class__())

        with debugger.flash as flash:
            flash.erase()

        debugger.soft_reset()
Exemplo n.º 3
0
def read_out_config_flash(device, args):
    """ Command that programs a given bitstream into the device's configuration flash. """
    ensure_flash_gateware_loaded(device, log_function=logging.info)

    # For now, always read back a ECP5-12F.
    read_back_length = 582376

    read_back_length = 512

    with device.flash as flash:
        bitstream = flash.readback(read_back_length, log_function=logging.info)

    with open(args.argument, "wb") as f:
        f.write(bitstream)
Exemplo n.º 4
0
def print_flash_info(device, args):
    """ Command that prints information about the connected SPI flash. """
    ensure_flash_gateware_loaded(device, log_function=logging.info)

    with device.flash as flash:
        flash_id, description = flash.read_flash_info()

    if flash_id is None:
        logging.error("No connected flash detected.\n")
        sys.exit(-1)
    else:
        logging.info("Detected a configuration flash!")
        logging.info("    {:04x} -- {}".format(flash_id, description))
        logging.info()
Exemplo n.º 5
0
    def toolchain_flash(self, products, name="top"):
        """ Programs the LUNA board's flash via its sideband connection. """

        from luna.apollo import ApolloDebugger
        from luna.apollo.flash import ensure_flash_gateware_loaded

        # Create our connection to the debug module.
        debugger = ApolloDebugger()
        ensure_flash_gateware_loaded(debugger, platform=self.__class__())

        # Grab our generated bitstream, and upload it to the .
        bitstream =  products.get("{}.bit".format(name))
        with debugger.flash as flash:
            flash.program(bitstream)

        debugger.soft_reset()
Exemplo n.º 6
0
def erase_config_flash(device, args):
    """ Command that erases the connected configuration flash. """
    ensure_flash_gateware_loaded(device, log_function=logging.info)

    with device.flash as flash:
        flash.erase()