How to recover an Acorn with a bad image¶
You have an Acorn on a Raspberry Pi 5 whose golden image is bad, and want to write a good one back over JTAG.
The images and the flash layout are on the fpgas.online Acorn design. A bad operational image at 0x400000 needs nothing from you. The watchdog fires, the FPGA reloads from 0x0, the golden image brings PCIe up, and the host rewrites the operational slot. A Compute Blade is recovered only once the site operator has taken it out of service. There, use --pins 2:3:4:14 and the card’s address from lspci (how to run JTAG on a Compute Blade).
This procedure is waiting for its run: test-designs issue #228.
Danger
Never write flash address 0x0 during normal operation. The golden image there is the recovery mechanism. Overwrite it badly and the only way back is the SRAM bootstrap below. On a board whose JTAG does not answer, there is no way back at all. fpgas-acorn-flash refuses 0x0 without --i-know-this-writes-golden; litepcie_util does not check. Use 0x400000 for operational updates.
What you need¶
JTAG wired and answering
--detecton the Pi (step 1). A card whose JTAG does not answer cannot be rescued, and its golden slot must not be written. The cards known not to answer: test-designs issue #209 and test-designs issue #214.The JTAG wiring left connected on every deployed board. Without JTAG a bad golden image bricks the board until JTAG is reconnected.
openFPGALoaderwith thelibgpiodcable, and the flash toolfpgas-acorn-flashfrom How to install the Acorn packages.golden.bit, the golden build’s.bit(acorn_pcie_soc.py --variant <v> --golden --build, a Vivado build); the packages carry only the operational.bit. In the design’s release it isacorn-cle-215p-golden-sqrl_acorn.bitfor a CLE-215+.sqrl_acorn_fallback.binandsqrl_acorn_operational.bin, the golden and operational flash images.A copy of every file on the Pi after each reboot, because files under
/home/pido not survive one.Power to the board until step 4 completes: the SRAM-loaded design is volatile.
Steps¶
On the Pi, make sure
gpiochip0is the header’s GPIO chip, then read the IDCODE. It is0x3636093on a CLE-215+ (XC7A200T); a CLE-101 or LiteFury carries an XC7A100T and reports0x3631093.The header’s GPIO chip is the one
gpiodetectlists aspinctrl-rp1; its number varies from 11 to 15. Where the Acorn packages are installed, the boot check makesgpiochip0a link to it whengpiochip0is missing. The link is gone at each reboot. Check which chipgpiochip0is:$ sudo gpiodetect $ ls -l /dev/gpiochip0
Skip the link if
ls -lshows-> gpiochipNwith N the number ofpinctrl-rp1, orgpiodetectlistsgpiochip0itself aspinctrl-rp1. If/dev/gpiochip0is missing or another chip, link it. The line below is forgpiochip15: put your chip’s number in place of 15.$ sudo ln -sfn /dev/gpiochip15 /dev/gpiochip0
$ openFPGALoader --cable libgpiod --pins 10:9:11:8 --detect
On the Pi, detach the endpoint and load
golden.bitinto SRAM. With a corrupt golden image nothing is enumerated, so the detach reportsNo such file or directory: carry on.$ echo 1 | sudo tee /sys/bus/pci/devices/0001:01:00.0/remove
$ openFPGALoader --cable libgpiod --pins 10:9:11:8 golden.bit
On the Pi, bring the card back and list it; it enumerates as the design. If step 2’s detach found the card, rescan:
$ echo 1 | sudo tee /sys/bus/pci/rescan $ lspci -nn -s 0001:01:00.0
If the detach reported
No such file or directory, the PCIe host bridge removed itself at boot, with no link to the card. Bind it again, with no unbind first. This command waits for its run on a Pi 5 (test-designs issue #228):$ echo 1000110000.pcie | sudo tee /sys/bus/platform/drivers/brcm-pcie/bind $ lspci -nn -s 0001:01:00.0
On the Pi, write the golden image to 0x0, then the operational one to 0x400000; both writes complete.
$ sudo fpgas-acorn-flash write sqrl_acorn_fallback.bin 0x0 --idcode 0x3636093 --i-know-this-writes-golden
$ sudo fpgas-acorn-flash write sqrl_acorn_operational.bin 0x400000 --idcode 0x3636093
At the switch, PoE-cycle the host’s port; the golden image boots from flash and chain-loads the operational one.
Check¶
After step 5 lspci -nn -s 0001:01:00.0 shows the design’s ID again, without any JTAG load. Step 3 shows the same line before the flash is written.
Memory controller [0580]: Xilinx Corporation Device [10ee:7021]
If it fails¶
Step 1 lists no
idcodeline, or prints nothing: this board cannot be rescued over JTAG; stop and repair the JTAG wiring.Step 3 shows the SQRL ID
1e24:021f, or no device: the JTAG load did not take; go back to step 2 rather than writing flash.Open file … FAILafter a reboot: the bitstream is gone, because/home/piis a memory overlay (overlayroot=tmpfs); copy it again before each attempt.The board lost power before step 4 completed: the flash still holds the corrupt golden image; start again from step 2.
The bind in step 3 reports
No such device: the card still has no link; go back to step 2.The rescan in step 3 finds nothing on a Pi that booted with the card: re-probe the slot’s root complex. The re-probe commands are under “If it fails” on How to check an Acorn’s PCIe link by hand on a Raspberry Pi 5.