7-series SRAM load: the board's own QSPI boot wins the race after JPROGRAM, and flip-flops in the loaded design do not get their INIT values
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 58/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- cpp
- Domain
- embedded-iot
Research direction
Start with src/xilinx.cpp and program_mem(), especially the JPROGRAM/INIT_B polling and the Run-Test/Idle clock wait described here. Check how the existing 7-series sequence handles INIT_B and when it enters CFG_IN; the reproduction compares INIT values and MIG calibration across repeated loads. Done means SRAM loading reliably applies flip-flop INIT values and calibrates the MIG on the reported master-SPI setup, without regressing other configuration modes.
Written by the indexing model from the issue text.
Description
Board / setup
- Puzhi PA35T-Starlite (XC7A35T-2FGG484), onboard FT232H JTAG (
-c digilent_hs2), Debian 13. - The mode pins are hard-wired to master SPI, and the QSPI flash holds a valid image (the vendor's
LED demo). - openFPGALoader: Debian v0.13.1, and master
bf2b529(v1.1.1). Both load to SRAM only.
Symptom
- After
openFPGALoader -c digilent_hs2 design.bit, DONE=1 and the new design runs. - However, its flip-flops do not start at their INIT values. Some keep the state of the previously
running design; others are garbage. - Logic that resets itself after configuration works. Anything that relies on INIT values breaks:
- A Xilinx MIG DDR3 controller never calibrates, in the vendor's Microblaze designs too.
- FSMs that are only reset by a push-button start in illegal states.
- The same
.bitloaded with Vivado (program_hw_devices) or xsdb (fpga -file) always works.
Reproduction. The test design has a UART status reporter whose 32-bit report counter T has
INIT 0, plus the MIG's init_calib_complete. Before each run a different design is loaded, so
retained state cannot fake a pass. Results over 10 loads:
| loader | MIG calibrated | T starts at 0/1 (INIT applied) |
|---|---|---|
Vivado 2026.1 program_hw_devices |
always | always |
| Debian v0.13.1 | 1/10 | 0/10 (e.g. T = 0xF4846F) |
| master bf2b529 | 0/10 | 0/10 |
| master + patch below | 10/10 | 10/10 |
Reloading the same bitstream over a running copy with the unpatched loader, T just continues
counting (0x88D72 → 0x88D73 …). The flip-flops are never re-initialised.
What happens
- After JPROGRAM this board reconfigures itself from flash within milliseconds. After
openFPGALoader -r, Vivado readsCONFIG_STATUSDONE_PIN = 1 and BOOT_STATUS = valid. program_mem()polls INIT_B and then clocks 10,000 × 12 TCK in Run-Test/Idle (20 ms at 6 MHz)
before loading CFG_IN, following UG470's table.- In master-SPI mode with a valid flash image, the device has already booted the flash image by
then. The JTAG bitstream is written into a running device, the frames are replaced, and the GSR
initialisation does not happen.
Patch (against bf2b529, src/xilinx.cpp, program_mem()): wait for INIT_B to go low
(housecleaning), then high, then load CFG_IN immediately.
_jtag->shiftIR(get_ircode(_ircode_map, "JPROGRAM"), NULL, _irlen);
- /* Poll INIT_B (bit 4 of IR capture) until config memory is cleared */
+ /* Wait for INIT_B to go low (housecleaning), then high, and load CFG_IN at once: with
+ * master-SPI mode pins and a valid flash image, any delay lets the device boot the flash
+ * image first, and the JTAG bitstream then lands in a running device. */
tx_buf = get_ircode(_ircode_map, "BYPASS");
+ int guard = 0;
+ do {
+ _jtag->shiftIR(tx_buf, rx_buf, _irlen);
+ } while ((rx_buf[0] & 0x10) && ++guard < 100000);
do {
_jtag->shiftIR(tx_buf, rx_buf, _irlen);
} while (!(rx_buf[0] & 0x10));
- /*
- * 8: Move into the RTI state. X 0 10,000(1)
- */
- _jtag->set_state(Jtag::RUN_TEST_IDLE);
- _jtag->toggleClk(10000*12);
Notes
- Removing only the 120,000-clock wait (no wait for INIT_B low) calibrated 10/10 when a different
design ran before. ButTsometimes started at 0x17 or 0x1DC, and one run without that scrub
failed outright. Waiting for the low phase as well made every run clean. - I have not checked whether UG470's 10,000 TCK are needed on boards strapped for JTAG or slave
modes. If they are, the wait could be made conditional on the mode pins, or skipped only when
INIT_B has been seen low and high. - v0.13.1 polled INIT_B on bit 0 of the IR capture, which is constant 1 on 7-series. Master
already tests bit 4.
- Dominant language
- C++
- Stars
- 1.7k
- Forks
- 396
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 15
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from trabucayre/openFPGALoader
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
trabucayre/openFPGALoader#767 ·
Maintainers usually reply within 1 day
-
Done Wait for feedback
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
trabucayre/openFPGALoader#735 · 2 comments ·
Maintainers usually reply within 1 day
-
spiFlash: sectors_erase() erases outside the requested rangePossibly taken @Milo0x1 claimed this today. Open
Difficulty 3/5 1-2 days Newbie friendliness 20/100
trabucayre/openFPGALoader#765 ·
Maintainers usually reply within 1 day
-
Difficulty 5/5 Over a week Newbie friendliness 12/100
trabucayre/openFPGALoader#753 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 28/100
trabucayre/openFPGALoader#752 · 1 comment ·
Maintainers usually reply within 1 day
All issues in trabucayre/openFPGALoader
Similar issues
-
bug needs-triage
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
microsoft/DirectXShaderCompiler#9155 ·
Maintainers usually reply within 2 days
-
Errors in 1.20 proseOpenCampaign DiD Campaign EI Campaign HttT Campaign TDG Campaign TSG Campaign WoF Enhancement Help Prose Stable 1.20
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
wesnoth/wesnoth#11749 · 2 comments ·
Maintainers usually reply within 1 day
-
agent:Windows bug in progress pri:medium sev:low testing windows
Difficulty 1/5 Under an hour Newbie friendliness 91/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
protocolbuffers/protobuf#31768 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
godotengine/godot#125651 ·
Maintainers usually reply within 1 day