Program a Board with updatePcieFpga.py
software/scripts/updatePcieFpga.py
(software/scripts/updatePcieFpga.py) programs a SPI/BPI
configuration PROM over PCIe and then rescans the PCIe bus so the new
bitstream becomes active. This avoids the JTAG cable round-trip when
you just want to swap firmware on an in-rack card.
Prerequisites
A PCIe-attached SLAC card with the
aes-stream-driverskernel module loaded (/dev/datadev_0present) — see Load the PCIe Kernel Driver.The card already runs a working
axi-pcie-core-based bitstream with the SPI/BPI PROM access path exposed via the PyRogue device tree. (Every target built frompgp-pcie-appsincludes this.)A
.mcs(or.mcs.gz) file produced by a priormake(see First Build — XilinxVariumC1100DmaLoopback) — the script picks the file up from a directory, not by filename.The Rogue environment activated (
source software/setup_env_slac.shat SLAC S3DF,source software/cds_env_setup.shat PCDS/CDS, or any equivalent env that suppliesrogue≥ v6.5.0).
Usage
The script takes a directory of images via --path and finds the
.mcs / .mcs.gz inside. Programming the PROM requires root (the
script issues a PCIe rescan via sysfs):
cd software/scripts
sudo $(which python) updatePcieFpga.py \
--path ../../firmware/targets/XilinxVariumC1100/XilinxVariumC1100DmaLoopback/images/
Useful CLI flags (defined in software/scripts/updatePcieFpga.py):
Flag |
Default |
Effect |
|---|---|---|
|
|
Pick a specific card when multiple are installed. |
|
(required) |
Directory containing the |
|
Alternate path used by the Debian package install. |
|
|
|
Skip the PCIe-rescan step if you plan to reboot instead. |
|
|
Debug only: skip the actual PROM write, exercise the rescan path. |
After Programming
If you ran with --rescan true (the default), the new bitstream is
already active on the same PCIe bus address. If you set
--rescan false (or the script reports that it could not rescan),
reboot the host:
sudo reboot
How long it takes
A typical SPIx4 program + verify of a single-chip Varium C1100 MCS is roughly 5–15 minutes — most of the time is in PROM erase/program cycles, not the PCIe rescan.
Troubleshooting
Permission denied on ``/dev/datadev_0`` — running as a non-root user needs
udevrules fromaes-stream-driversto be installed, or run viasudo. See Load the PCIe Kernel Driver.“Unable to reprogram FPGA as loss of PCIe link” — the in-running driver lost the BAR window. Use software/scripts/rescanPcieFpga.sh to recover, or reboot.
“Programming (.mcs, .mcs.gz) files NOT detected in the –path arg directory” — confirm the
images/directory actually contains a.mcs(or.mcs.gz); amakethat ran withGEN_MCS_IMAGE=0produces no PROM file.MCS file too big —
XilinxVariumC1100uses a 1 GB SPI Flash; bitstreams fromaxi-pcie-core-based projects fit comfortably. Ifwrite_cfgmemerrors out about size during the originalmake, check firmware/targets/<Board>/<Target>/vivado/promgen.tcl for the configuredsizeparameter.