Repository navigation
Load And Flash
You load a bitstream in the FPGA with --load (gone at power off) and write it in the SPI
flash the FPGA boots from with --flash, through the programmer the platform declares in
create_programmer(). Most boards use one of the two open-source tools below; the vendor
programmers (Vivado, Quartus, Gowin, Efinity, Diamond, Libero, TangDynasty) and a few
board-specific ones (iceprog, ecpprog, ecpdap, ujprog, tinyprog, DFU) are wrapped the
same way in litex/build/<vendor>/programmer.py.
python3 -m litex_boards.targets.digilent_arty --build --load # SRAM
python3 -m litex_boards.targets.digilent_arty --build --flash # SPI flash (when the target has --flash)A programmer can also be used from Python: prog = platform.create_programmer(); prog.load_bitstream("build/<board>/gateware/<board>.bit"), prog.flash(0, "<board>.bin").
openFPGALoader (by @trabucayre) supports most boards of the open-FPGA communities, the exotic ones included, with the usual cables (FTDI, Digilent, DirtyJTAG, ...): it is the default programmer of most LiteX-Boards targets (Xilinx, Lattice, Gowin, Efinix, CologneChip, Intel). Use the upstream version:
sudo apt install openfpgaloader # Debian/Ubuntu (a recent release), or build it:
sudo apt install libftdi1-2 libftdi1-dev libhidapi-hidraw0 libhidapi-dev libudev-dev cmake pkg-config make g++
git clone https://github.com/trabucayre/openFPGALoader && cd openFPGALoader
mkdir build && cd build && cmake ../ && make && sudo make install
openFPGALoader --detect # the cable and the deviceIn a platform: OpenFPGALoader(board="arty_a7_35t"), or OpenFPGALoader(cable="ft2232", fpga_part="xc7a35t")
with --freq, --index-chain, --ftdi-serial when needed; flash() takes the address and
accepts the tool's --unprotect-flash/--verify/external flash options.
OpenOCD loads bitstreams on Xilinx and Lattice devices and flashes the
SPI flash through JTAG with the bscan SPI proxy bitstreams (downloaded on first use from
quartiq/bscan_spi_bitstreams into ~/.litex).
It is also the JTAG transport of the JTAGBone bridge and of the
CPU debugging with GDB. The upstream OpenOCD works;
our fork adds a few cables and fixes:
git clone https://github.com/enjoy-digital/openocd && cd openocd
./bootstrap && ./configure --enable-ftdi && make && sudo make installIn a platform: OpenOCD("openocd_xc7_ft2232.cfg", "bscan_spi_xc7a35t.bit"); the configuration
files are in the prog/ directory of LiteX and of LiteX-Boards, and the OPENOCD environment
variable selects another binary.
-
Vivado (
VivadoProgrammer(flash_part="n25q256-3.3v-spi-x1_x2_x4")): JTAG through the hardware manager, flashing through Vivado's flash programming;vivado_path/vivado_verwhen several versions are installed. -
Quartus (
USBBlaster(cable_name="USB-Blaster")):quartus_pgmwith the.sof;.rbfand.svfcan be generated for other tools. -
Gowin (
GowinProgrammer(devname, cable=...)):programmer_cliof the Gowin EDA, SRAM and flash (fifile/mcufilefor the EMCU devices), GWU2X or FT2CH cables. -
Efinix (
EfinixProgrammer): Efinity'sftdi_program.py(JTAG) andjtag_bridgefor the flash;EfinixAtmelProgrammerfor the boards with the Atmel USB bridge. -
Lattice:
IceStormProgrammer(iceprog, iCE40),EcpprogProgrammer/EcpDapProgrammer(ECP5),UJProg/fujprog(ULX3S),TinyProgProgrammer(TinyFPGA),LatticeProgrammer(pgrcmdwith an.xcf),OpenOCDJTAGProgrammer(SVF through OpenOCD). -
DFU (
DFUProg(vid, pid, alt)): boards with a DFU bootloader (OrangeCrab, Fomu, ...):dfu-suffixthendfu-util --download. -
Microsemi (
LiberoProgrammer), Anlogic (TangDynastyProgrammer), Xilinx legacy (iMPACT,XC3SProg,UrJTAG,Adept).
Permissions: on Linux, the USB cables need udev rules (openFPGALoader ships 99-openfpgaloader.rules,
OpenOCD 60-openocd.rules) or sudo.
-
Create a minimal SoC:
--build --loadon your first target. -
Add a new board:
create_programmer()in a platform of yours. - Write firmware for it: the firmware next to the bitstream in the flash.
- Build backends: the toolchains the programmers come with.
Have a question or want to get in touch? Join us on Discord or on IRC: #litex at irc.libera.chat. This wiki is generated from doc/wiki in the LiteX repository: edit it with a pull request.
- Start here
- Build your SoC
- Run software on it
- How LiteX works
- Reference
- Projects and community
- For AI agents