Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cli: show both serial number and flash UID in info and flash-info #85

Merged
merged 1 commit into from
Jun 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions apollo_fpga/commands/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,10 @@ def print_device_info(device, args):
logging.info(f"\tSerial number: {device.serial_number}")
logging.info(f"\tFirmware version: {device.get_firmware_version()}")
logging.info(f"\tUSB API version: {device.get_usb_api_version_string()}")

with device.jtag as jtag:
programmer = device.create_jtag_programmer(jtag)
flash_uid = programmer.read_flash_uid()
logging.info(f"\tFlash UID: {flash_uid:016x}")

def print_chain_info(device, args):
""" Command that prints information about devices connected to the scan chain to the console. """
Expand Down Expand Up @@ -240,17 +243,19 @@ def read_back_flash(device, args):
def print_flash_info(device, args):
""" Command that prints information about the currently connected FPGA's configuration flash. """
ensure_unconfigured(device)
serial_number = device.serial_number

with device.jtag as jtag:
programmer = device.create_jtag_programmer(jtag)
manufacturer, device = programmer.read_flash_id()
unique_id = programmer.read_flash_uid()

if manufacturer == 0xFF:
logging.info("No flash detected.")
return

logging.info("")
logging.info(f"Detected an FPGA-connected SPI configuration flash!")
logging.info(f"Device serial number: {serial_number}")
logging.info("Detected an FPGA-connected SPI configuration flash!")

try:
logging.info(f"\tManufacturer: {JEDEC_MANUFACTURERS[manufacturer]} ({manufacturer:02x})")
Expand All @@ -262,6 +267,8 @@ def print_flash_info(device, args):
except KeyError:
logging.info(f"\tUnknown device ({device:06x}).")

logging.info(f"\tUnique ID: {unique_id:016x}")

logging.info("")


Expand Down