timvideos / litex-buildenv

An environment for building LiteX based FPGA designs. Makes it easy to get everything you need!
BSD 2-Clause "Simplified" License
214 stars 79 forks source link

openocd fails to flash image on numato opsis #245

Open piotr-binkowski opened 4 years ago

piotr-binkowski commented 4 years ago

openocd that comes with buildenv as a conda package fails to flash image on the FPGA flash, it looks like it has some kind of communication issue because the flash ID is detected as 0x00ffffff

(LX P=opsis T=hdmi2usb C=vexriscv) [pbinkowski@arch litex-buildenv]$ which openocd
/home/pbinkowski/projects/fx2/litex-buildenv/build/conda/bin/openocd
(LX P=opsis T=hdmi2usb C=vexriscv) [pbinkowski@arch litex-buildenv]$ sudo openocd -f board/numato_opsis.cfg -c 'init; xc6s_print_dna xc6s.tap; jtagspi_init 0 /home/pbinkowski/projects/fx2/litex-buildenv/build/conda/lib/python3.7/site-packages/hdmi2usb/firmware/spartan6/opsis/bscan_spi_xc6slx45t.bit; jtagspi_program /home/pbinkowski/projects/fx2/litex-buildenv/build/opsis_hdmi2usb_vexriscv/image-gateware+bios+firmware.bin 0x0; exit'
Open On-Chip Debugger 0.10.0+dev-00941-g3a50bb46d-dirty (2019-10-17-06:47)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
Info : only one transport option; autoselect 'jtag'
Warn : incomplete ublast_vid_pid configuration
jtagspi_program
Info : usb blaster interface using libftdi
Info : This adapter doesn't support configurable speed
Info : JTAG tap: xc6s.tap tap/device found: 0x44028093 (mfg: 0x049 (Xilinx), part: 0x4028, ver: 0x4)
DNA = 100110110101001011111011110100110000001100110110010010111 (0x136a5f7a6066c97)

Info : JTAG tap: xc6s.tap tap/device found: 0x44028093 (mfg: 0x049 (Xilinx), part: 0x4028, ver: 0x4)
Error: Unknown flash device (ID 0x00ffffff)

Using the openocd version provided by system works correctly:

[pbinkowski@arch litex-buildenv]$ sudo openocd -f board/numato_opsis.cfg -c 'init; xc6s_print_dna xc6s.tap; jtagspi_init 0 /home/pbinkowski/projects/fx2/litex-buildenv/build/conda/lib/python3.7/site-packages/hdmi2usb/firmware/spartan6/opsis/bscan_spi_xc6slx45t.bit; jtagspi_program /home/pbinkowski/projects/fx2/litex-buildenv/build/opsis_hdmi2usb_vexriscv/image-gateware+bios+firmware.bin 0x0; exit'
Open On-Chip Debugger 0.10.0
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
Warn : Adapter driver 'usb_blaster' did not declare which transports it allows; assuming legacy JTAG-only
Info : only one transport option; autoselect 'jtag'
Warn : incomplete ublast_vid_pid configuration
jtagspi_program
Info : usb blaster interface using libftdi
Info : This adapter doesn't support configurable speed
Info : JTAG tap: xc6s.tap tap/device found: 0x44028093 (mfg: 0x049 (Xilinx), part: 0x4028, ver: 0x4)
DNA = 100110110101001011111011110100110000001100110110010010111 (0x136a5f7a6066c97)

loaded file /home/pbinkowski/projects/fx2/litex-buildenv/build/conda/lib/python3.7/site-packages/hdmi2usb/firmware/spartan6/opsis/bscan_spi_xc6slx45t.bit to pld device 0 in 10s 125001us
Info : JTAG tap: xc6s.tap tap/device found: 0x44028093 (mfg: 0x049 (Xilinx), part: 0x4028, ver: 0x4)
Info : Found flash device 'micron n25q128' (ID 0x0018ba20)
flash 'jtagspi' found at 0x00000000
auto erase enabled
Info : Found flash device 'micron n25q128' (ID 0x0018ba20)
Info : Found flash device 'micron n25q128' (ID 0x0018ba20)
Info : Found flash device 'micron n25q128' (ID 0x0018ba20)
Info : sector 0 took 273 ms
...
Info : sector 34 took 276 ms
wrote 2293760 bytes from file /home/pbinkowski/projects/fx2/litex-buildenv/build/opsis_hdmi2usb_vexriscv/image-gateware+bios+firmware.bin in 88.975311s (25.176 KiB/s)
Info : Found flash device 'micron n25q128' (ID 0x0018ba20)
read 2256020 bytes from file /home/pbinkowski/projects/fx2/litex-buildenv/build/opsis_hdmi2usb_vexriscv/image-gateware+bios+firmware.bin and flash bank 0 at offset 0x00000000 in 83.625496s (26.345 KiB/s)
contents match
stefanor commented 2 years ago

We have reproduced this. Debian openocd 0.11.0~rc2-1 & 0.11.0-1 show this bug. The old version in Debian buster - 0.10.0-5 works correctly, and is still installable on bullseye.

Need to bisect...