XC3SPROG(1)
π xc3sprog β the JTAG glow-up manual (part 1)
okay bestie, sit down, hydrate, because we're talking about xc3sprog, aka the JTAG programming utility for Xilinx FPGAs and PROMs. yes, that's the whole vibe: it's a command-line tool that programs FPGAs, microcontrollers and PROMs over JTAG. no cap. π¦
β¨ SYNOPSIS β¨
xc3sprog -c cable [options] file1spec [file2spec ...]
xc3sprog -c cable [options] -j
πΈ DESCRIPTION πΈ
So. xc3sprog is a command-line tool for programming FPGAs, microcontrollers and PROMs via JTAG. That's it, that's the job, and it does it beautifully. π
In a typical application β like, the main character use case β xc3sprog reads a .BIT file that an FPGA design tool generated, and programs it into the PROM chip on an FPGA board for persistent storage, or into the configuration RAM of an FPGA for temporary storage. Other use cases? Scroll down to the EXAMPLES section, bestie, they're right there.
As its name indicates, xc3sprog was originally designed for Xilinx Spartan-3 FPGAs. But the way it's been extendedβ¦ it now handles several other types of devices, including Xilinx FPGAs, CPLDs, XCF flash PROMs, Atmel AVRs and SPI flash chips. And it supports several JTAG cables too β parallel port cables and USB programmers both. iconic behaviour, honestly β¨
π OPTIONS π
-c cableβ Specify the type of JTAG cable. The specified type, cable, refers to a label in the cable database. Common cable types arepp(parallel port cable),xpc(Xilinx USB programmer), andftdi(FTDI-based USB programmer). you basically always need this one, fr fr-jβ Detect the JTAG chain and print a list of attached devices. This is the default if no other action is specified. π-p val[,val,...]β Use the device at JTAG chain position val, default is position0, the device connected to the TDO pin of the JTAG cable. Use this option to select a device from a multi-device JTAG chain.
If multiple chain positions are specified, the data file will be split, programming the first part of the file into the first specified device and so on. This is useful for boards which a chain of multiple XCF chips to configure a single FPGA.
-Tnβ Test the JTAG chain n times. When running in ISF mode, test the SPI connection. If n is not specified, the default is to test10000times. If *n = 0`, keep testing forever. forever forever. like, until you ctrl-C it. π-J freqβ Run at the specified JTAG clock frequency (freq in Hz). If not specified, or if freq = 0, the default is to run at the maximum frequency supported by the cable. Currently only supported for FTDI-based cables. only FTDI, don't come for me-eβ Erase the entire device. poof. gone. π«§-I[file]β Work in ISF mode to program an internal serial flash memory. The flash memory is attached to the primary JTAG target, but not directly accessible via the JTAG chain. The primary JTAG target is used as a proxy to forward SPI transactions to the flash memory. If file is specified, start by programming the specified bitfile into the primary JTAG target (typically an FPGA).-Rβ Send a reconfiguration command to the target device (XCV, XCF, XCFP for reconfiguration of the connected FPGA device or XC3S, XC6S, XC2V direct). π«-m mapdirβ Search for XC2C map files in the specified directory. Map files are required to handle JEDEC files during CPLD programming. If not specified, defaults to the value of$XC_MAPDIR.-d /dev/parportNβ Specify the parallel port device to be used. If not specified, defaults to the value of$XCPORTor/dev/parport0. Only used for cable typepp. pp only, bestie, don't try it elsewhere-s serialnumβ Use the USB device with the specified serial number string. Needed if several adapters of the same type are connected at the same time. multi-adapter girlies, this one's for you-Lβ UselibFTD2XXinstead oflibftdito access FTDI-based cables.-Dβ Dump the device database and cable database to filesdevlist.txtandcablelist.txtin the current directory. If a file already exists,xc3sprogtries to generate a unique name by appending an increasing number. π₯-X opt[,opt...]β Set configuration mode for XCFnnP PROM devices. Configuration from XCFnnP PROM may be done in several modes, depending on the wiring between XCFnnP and FPGA. By default,xc3sprogprepares XCFnnP devices for slave serial mode (FPGA running in master serial mode).
To override the defaults, specify a comma-separated list of options. The following options are accepted:
masterβ XCFnnP is master (FPGA is slave)slaveβ XCFnnP is slave (FPGA is master, this is default)parallelβ Parallel configuration data busserialβ Serial configuration data line (default)extclkβ Use external clock in master modeintclkβ Use internal clock in master modefastclkβ Use fast internal clockslowclkβ Use slow internal clock
-vβ Enable verbose output. your bestie telling you everything that's happening, in detail, unprompted π£οΈ-hβ Print a help text. π«Ά
π ACTION SPECIFICATION π
One or more programming actions may be specified. Each action consists of a filename, optionally followed by attributes in the form <filename:action:offset:style:length>.
filenameβ The file to be written to the device, or the file in which to store data after reading from the device. On windows systems, a colon on position 2 is considered as filename part and not as an action separator. windows girlies, watch that colon πactionβ One letter indicating whether to write, read, or verify the device. If not specified, the default action is'w'.wβ Erase, then write data from file to device and verify.Wβ Write with auto-sector erase, then verify.vβ Verify device against file.rβ Read from device and write to file (no overwriting).Rβ Read from device and write to file, overwriting existing files. capital R does NOT care about your existing files, periodt
offsetβ The byte offset inside the device where programming/reading should start. Only supported for SPI, XCFnnS devices and XMEGA.styleβ The format of the specified file.BITβ Xilinx.BITfile format. Default for FPGA, XCF and SPI devices.BINβ Raw binary file.BPIβ Raw binary file not bit reversed.MCSβ Xilinx.MCSfile format.IHEXβ Intel HEX format. Also used by Xilinx PROMGEN when writing MCS files. Default for XMEGA devices.HEXRAWβ Raw sequence of hexadecimal digits.JEDECβ Default for CPLD devices.
lengthβ The number of bytes to program/read. Only supported for SPI, XCFnnS and XMEGA devices.
π§ DEVICE DATABASE π§
The device database contains a list of supported JTAG devices. When xc3sprog starts, it scans the JTAG chain to discover all attached devices. A device database is used to map the 32-bit ID codes of the devices to descriptive names and get basic knowledge how to handle the part, at minimum how to skip it. like a little rolodex of everyone invited to the chain party π
A default device database is compiled into the xc3sprog executable. The database is tried to be loaded from a file at run time. If the environment variable $XCDB is defined, it specifies the name of the device database file, otherwise the file devlist.txt is read from the current directory. If a database file is not found at all, the internal compile-time database will be used.
If a device is not yet known, the builtin list can be dumped, the information on the unknown part added and on the next run the new list will be read and used. DIY database glow-up β¨
π¦ CABLE DATABASE π¦
The cable database contains a list of supported JTAG cables. Each cable type is identified by a short label, such as pp, ftdijtag, or xpc. The database maps the label to parameters to be used to access the hardware of the cable. π
A default cable database is compiled into the xc3sprog executable. The database is tried to be loaded from a file at run time. If the environment variable $CABLEDB is defined, it specifies the name of the cable database file, otherwise the file cablelist.txt is read from the current directory. If a database file is not found at all, the internal compile-time database will be used.
If a cable subtype (e.g. different VID/PID) is not yet known, the builtin list can be dumped, the information on the new cable added and on the next run the new list will be read and used.
The database contains a line for each known cable. The line consists of the alias for that cable to used with the -c option, the basic type of the cable, the maximum allowed JTAG frequency of the cable and an optional option string.
For FTDI devices the option string contains the USB vendor ID (VID), USB product ID (PID), the USB device description string, the FTDI channel of the JTAG interface and eventual commands for setting other pins beside the JTAG pins. e.g. to switch on some buffers. If the JTAG device uses a FTDI default VID/PID, the USB device description string is important to destinguish your JTAG device from other eventual connected FTDI devices with the same VID/PID. do not skip the description string, bestie, it's how your cable gets picked out of the crowd π
π EXAMPLES π
xc3sprog -c pp -jShow a list of JTAG devices attached to the parallel port JTAG cable.xc3sprog -c ftdijtag -v -p 0 design.bitProgram the specified bitfile into the first device (position 0) in the JTAG chain. Use an FTDI-based USB JTAG cable. Show detailed progress information.xc3sprog -c ftidjtag -TTest the integrity of the JTAG chain.xc3sprog -c xpc -p 1 dump.bit:rRead the contents from the JTAG device in position 1 in the chain, and write the data as a Xilinx.BITfile. Use a Xilinx USB programmer.xc3sprog -c cable -Ibscan_spi/xc3s50an.bit design.bitLoadxc3s50an.bitinto the FPGA in position 0 in the JTAG chain. Then, programdesign.bitinto the ISF memory in the FPGA.xc3sprog -c cable -I image.bit:w:0x10000Program the image file into the SPI memory attached to the FPGA, starting at byte offset0x10000. An appropriatebscan_spifile must already be loaded in the FPGA, so that it will act as a bridge between the JTAG cable and SPI bus.
okay that's part 1, don't go anywhere β there's more, and it's giving π«Ά
πΈ ENVIRONMENT πΈ
ok so bestie, these are the env vars that change how xc3sprog acts, no cap. Set them in your shell and they just... vibe in the background π
XCDBβ the name of the file to use as the device database. default isdevlist.txtin the current directory. β¨CABLEDBβ the name of the file to use as the cable database. default iscablelist.txtin the current directory. πXCPORTβ the parallel port device used for JTAG cable typepp. default is/dev/parport0. lowkey important: this setting can be overridden by the command-line option-d.XC_MAPDIRβ the default directory to search for XC2C map files. and yes, this one can be overridden by the command-line option-m. she's flexible like that πJTAG_DEBUGβ if you specify it, a log of JTAG operations gets written to a file with this name. πFTDI_DEBUGβ if specified, a log of interactions with the FTDI device is written to a file with this name. only used for FTDI-based cable types, iykyk.XPC_DEBUGβ if specified, a log of interactions with the XPC programmer is written to a file with this name. only for XPC-based cable types π¦SPI_DEBUGβ if specified, a log of SPI operations is written to a file with this name. only used in ISF mode fr fr.PDI_DEBUGβ if specified, a log of PDI operations is written to a file with this name. only used when programming an Atmel XMega device π
π FILES π
devlist.txtβ the device database, containing a list of known JTAG target devices. this file is read from the current directory by default, or from the location indicated by theXCDBenvironment variable. and if it's not found? no stress β an internal compile-time version of the device database gets used instead πcablelist.txtβ the cable database, containing a list of known JTAG cable types. read from the current directory by default, or from wherever theCABLEDBenvironment variable points. if it's not found, an internal compile-time version of the cable database is used. iconic fallback behaviour tbh π«Ά
β SEE ALSO β
http://sourceforge.net/projects/xc3sprog/
π Contribute back π
got feedback? success stories, failure reports, enhancement requests β all of it is welcome, bestie:
- Feedback on success/failure/enhancement requests:
http://sourceforge.net/mail/?group_id=170565π
and that's the whole page!! go flash something and tell the group chat π β¨
mwah π this was xc3sprog, dated 2011-09-04, living in section XC3SPROG(1) of the manual β go forth and slay, bestie π§π
π¦ where this page comes from
- debian bookworm: xc3sprog 0+svn795+dfsg-4 Β· GPL-2.0-or-later
- debian trixie: xc3sprog 0+svn795+dfsg-4 Β· GPL-2.0-or-later
- ubuntu jammy: xc3sprog 0+svn795+dfsg-4 Β· GPL-2.0-or-later
- ubuntu noble: xc3sprog 0+svn795+dfsg-4 Β· GPL-2.0-or-later
- ubuntu questing: xc3sprog 0+svn795+dfsg-4
- ubuntu resolute: xc3sprog 0+svn795+dfsg-6 Β· GPL-2.0-or-later
- ubuntu stonking: xc3sprog 0+svn795+dfsg-6 Β· GPL-2.0-or-later
- Copyright (C) 2011 Joris van Rantwijk
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms