I am interested in modifying OpenOCD so it can program Xilinx FPGAs (well, Spartan 3’s anyway). There is already a stand-alone program (xc3sprog) that does this, but to my mind it makes sense to reuse existing JTAG driver code instead of re-inventing the wheel.
I tried building OpenOCD (on FreeBSD - I patched it a bit) and running it but I get this…
Unfortunately I don’t have much JTAG clue and I haven’t delved into the code (no time just yet)… Anyone have an opinion as to the feasibility?
I note that OpenOCD has an XSVF player and the Xilinx FPGA tools can generate those for programming the FPGA (or flash memory) so it would be nice if at least that would work.
Extending the XSVF player to Spartan and Virtex devices is on my todo list, but it’s low priority and I haven’t had time yet.
It’s certainly feasible, but you’d have to look at the programming algorithms of the respective chips. What type of input does xc3sprog take? The .bit file?
As far as I know OpenOCD should build on FreeBSD. The 2006-06-25 version is rather old - you should grab the latest code from SVN to make sure you have all the latest fixes (these include portability patches).
SVF is generated by Lattice, Xilinx, Altera FPGA CPLD anti-fuse …
BUT, the tricky using SVF is that all FPGA makers are missing to include the FREQUENCY (TCK) in the SVF.
The time base of Xilinx SVF is 1MHZ, but many of Xilinx devices can up their JTAG chain to 16MHz ! Than if you run the SVF as-it-is at 16MHz there are many change to genrate a wrong JTAG chain).
Your have to rework some contents of the SVF. :shock:
Also, some devices need to re-run x times the same DATA SCAN if it is not checked successfully … This is not a feature of SVF :shock:
Anyway, SVF will be better than to work directly on the binary content of the FPGA (.bit file). Using SVF you do not need to know so much about the architecture of the FPGA and their JTAG chain !
Anyway, SVF will be better than to work directly on the binary content of the FPGA (.bit file). Using SVF you do not need to know so much about the architecture of the FPGA and their JTAG chain !
I could use the Xilinx tools to generate xsvf files so I think I wouldn’t need special support, however I think it would be nice if OpenOCD could read .bit files directly for convenience.
Extending the XSVF player to Spartan and Virtex devices is on my todo list, but it’s low priority and I haven’t had time yet.
Ah well I’m happy to do the coding
What is needed to extend it?
It’s certainly feasible, but you’d have to look at the programming algorithms of the respective chips. What type of input does xc3sprog take? The .bit file?
Yes, xc3sprog reads .bit files.
As far as I know OpenOCD should build on FreeBSD. The 2006-06-25 version is rather old - you should grab the latest code from SVN to make sure you have all the latest fixes (these include portability patches).
My SVN clue is low too so I guess I checked it out incorrectly
I checked out the latest rev (82) and have modified parport.c so that it can use /dev/ppi (the FreeBSD equivalent of Linux’s /dev/parport) I submitted it as patch 1301.
Thanks for the patch, I’ve added it to the SVN repository in revision 83.
What config file settings did you use, and what device(s) did you test with? The jtag_device lines have to describe the actual JTAG scan chain found on your board, i.e. the size of the IR register and the value expected during an IR scan.
Your IR mask values are wrong. That parameter describes which bits of the IR capture value should be checked against the value captured in the Capture-IR state and scanned out in Shift-IR.
The JTAG standard only guarantess b…01, i.e. the least significant bits b01, while the meaning of the other bits is up to the vendor. A safe setting that works with all IEEE 1149.1 compliant devices would be jtag_device 0x1 0x3 .
The BSDL file for the XC3S has the following information:
attribute INSTRUCTION_CAPTURE of XC3S400_BARE : entity is
– Bit 5 is 1 when DONE is released (part of startup sequence)
– Bit 4 is 1 if house-cleaning is complete
– Bit 3 is ISC_Enabled
– Bit 2 is ISC_Done
“XXXX01”;
So you can’t count on anything but the first two bits to be b01.