### Install Binaries and Bitstreams Source: https://github.com/trabucayre/openfpgaloader/blob/master/CMakeLists.txt Installation rules for the main executable and logic for compressing and installing SPI/BPI bitstream files. ```cmake install(TARGETS openFPGALoader DESTINATION bin) #################################################################################################### # SPIOverJtag bitstreams install #################################################################################################### file(GLOB GZ_FILES spiOverJtag/spiOverJtag_*.*.gz) file(GLOB BPI_GZ_FILES bpiOverJtag/bpiOverJtag_*.bit.gz) list(APPEND GZ_FILES ${BPI_GZ_FILES}) # Compress rbf and bit files present into repository # TODO: test compat with Windows and MacOS list(INSERT CMAKE_MODULE_PATH 0 ${PROJECT_SOURCE_DIR}/cmake/Modules) include(FindGZIP) if (NOT ${CMAKE_SYSTEM_NAME} MATCHES "Windows" AND GZIP_PRG) set(SPIOVERJTAG_DIR "${CMAKE_CURRENT_SOURCE_DIR}/spiOverJtag") file(GLOB BITS_FILES RELATIVE ${SPIOVERJTAG_DIR} spiOverJtag/spiOverJtag_*.bit) file(GLOB RBF_FILES RELATIVE ${SPIOVERJTAG_DIR} spiOverJtag/spiOverJtag_*.rbf) STRING(REGEX REPLACE ".bit" ".bit.gz" BIT_GZ_FILES "${BITS_FILES}") STRING(REGEX REPLACE ".rbf" ".rbf.gz" RBF_GZ_FILES "${RBF_FILES}") FOREACH(bit ${BITS_FILES} ${RBF_FILES}) ADD_CUSTOM_COMMAND(OUTPUT ${bit}.gz COMMAND ${GZIP_PRG} -9 -c ${bit} > ${CMAKE_CURRENT_BINARY_DIR}/${bit}.gz DEPENDS ${SPIOVERJTAG_DIR}/${bit} WORKING_DIRECTORY ${SPIOVERJTAG_DIR} COMMENT "Building ${bit}.gz") list(APPEND GZ_FILES ${CMAKE_CURRENT_BINARY_DIR}/${bit}.gz) ENDFOREACH(bit) ADD_CUSTOM_TARGET(bit ALL DEPENDS ${BIT_GZ_FILES} ${RBF_GZ_FILES}) else() file(GLOB BITS_FILES spiOverJtag/spiOverJtag_*.bit) file(GLOB RBF_FILES spiOverJtag/spiOverJtag_*.rbf) install(FILES ${BITS_FILES} ${RBF_FILES} DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/openFPGALoader ) endif() install(FILES ${GZ_FILES} DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/openFPGALoader ) ``` -------------------------------- ### Install built binaries Source: https://github.com/trabucayre/openfpgaloader/blob/master/doc/guide/install.md Install the compiled application to the system. ```bash $ sudo make install ``` -------------------------------- ### Install via Guix package manager Source: https://github.com/trabucayre/openfpgaloader/blob/master/doc/guide/install.md Install the package from default repositories. ```bash guix install openfpgaloader ``` -------------------------------- ### Install via Debian/Ubuntu package manager Source: https://github.com/trabucayre/openfpgaloader/blob/master/doc/guide/install.md Install the package from default repositories. ```bash sudo apt install openfpgaloader ``` -------------------------------- ### Install via Fedora Copr repository Source: https://github.com/trabucayre/openfpgaloader/blob/master/doc/guide/install.md Enable the Copr repository and install the package. ```bash sudo dnf copr enable mobicarte/openFPGALoader sudo dnf install openFPGALoader ``` -------------------------------- ### Install openFPGALoader on macOS Source: https://github.com/trabucayre/openfpgaloader/blob/master/doc/guide/install.md Use Homebrew to install the pre-built package or build from source. ```bash brew install openfpgaloader ``` ```bash brew install --only-dependencies openfpgaloader brew install cmake pkg-config zlib gzip git clone https://github.com/trabucayre/openFPGALoader cd openFPGALoader mkdir build cd build cmake .. make -j ``` -------------------------------- ### Install via Arch Linux package manager Source: https://github.com/trabucayre/openfpgaloader/blob/master/doc/guide/install.md Install the package from default repositories. ```bash sudo pacman -S openfpgaloader ``` -------------------------------- ### Install openFPGALoader on Windows via MSYS2 Source: https://github.com/trabucayre/openfpgaloader/blob/master/doc/guide/install.md Install the native Windows build using the MSYS2 package manager. ```bash pacman -S mingw-w64-ucrt-x86_64-openFPGALoader ``` -------------------------------- ### Install build dependencies for source compilation Source: https://github.com/trabucayre/openfpgaloader/blob/master/doc/guide/install.md Install necessary development headers and tools on Debian-based systems. ```bash sudo apt install \ git \ gzip \ libftdi1-2 \ libftdi1-dev \ libhidapi-hidraw0 \ libhidapi-dev \ libudev-dev \ zlib1g-dev \ cmake \ pkg-config \ make \ g++ ``` -------------------------------- ### Install Arch Linux build dependencies Source: https://github.com/trabucayre/openfpgaloader/blob/master/doc/guide/install.md Install required libraries and tools for building from source. ```bash sudo pacman -S git cmake make gcc pkgconf libftdi libusb zlib hidapi gzip ``` -------------------------------- ### Install openFPGALoader on macOS Source: https://context7.com/trabucayre/openfpgaloader/llms.txt Installs openFPGALoader on macOS using the Homebrew package manager. ```bash brew install openfpgaloader ``` -------------------------------- ### Check openFPGALoader version Source: https://github.com/trabucayre/openfpgaloader/blob/master/doc/guide/troubleshooting.md Verify the installed version of openFPGALoader to ensure compatibility with recent hardware fixes. ```bash openFPGALoader -V ``` -------------------------------- ### Install openFPGALoader via Package Managers Source: https://github.com/trabucayre/openfpgaloader/blob/master/doc/guide/first-steps.md Commands to install openFPGALoader on Arch Linux, Fedora, MSYS2, and macOS. ```bash sudo pacman -S openfpgaloader ``` ```bash sudo dnf copr enable mobicarte/openFPGALoader; sudo dnf install openFPGALoader ``` ```bash pacman -S mingw-w64-ucrt-x86_64-openFPGALoader ``` ```bash brew install openfpgaloader ``` -------------------------------- ### Load FPGA Bitstream using JTAG Cable Source: https://github.com/trabucayre/openfpgaloader/blob/master/README.md This command loads a bitstream using a specified JTAG cable model ('cmsisdap' in this example) instead of a board configuration. Refer to the compatibility list for available cable models. ```bash openFPGALoader -c cmsisdap fpga_bitstream.bit ``` -------------------------------- ### Load FPGA Bitstream into SRAM Source: https://github.com/trabucayre/openfpgaloader/blob/master/README.md Use this command to load a bitstream into the FPGA's SRAM. Ensure the board configuration ('arty' in this example) is correctly specified. ```bash openFPGALoader -b arty arty_bitstream.bit # Loading in SRAM ``` -------------------------------- ### Write binary firmware to flash Source: https://github.com/trabucayre/openfpgaloader/blob/master/doc/vendors/intel.md Updates softcore CPU firmware by erasing and writing a binary file to UFM sectors. Use the --offset flag to specify a starting address. ```bash openFPGALoader [-b boardname] -c cablename [--offset $OFFSET] the_bin_file.bin ``` -------------------------------- ### Write FPGA Bitstream to Flash Source: https://github.com/trabucayre/openfpgaloader/blob/master/README.md Use this command to write a bitstream to the FPGA's flash memory. The '-f' flag indicates writing to flash. Ensure the board configuration ('arty' in this example) is correctly specified. ```bash openFPGALoader -b arty -f arty_bitstream.bit # Writing in flash ``` -------------------------------- ### Write to external flash via JTAG with offset Source: https://github.com/trabucayre/openfpgaloader/blob/master/doc/vendors/colognechip.md Write data to a specific offset in the external flash memory via JTAG using the GateMate Evaluation Board. The FPGA will not start automatically. Ensure the configuration mode pins are set to JTAG (0xC). ```bash openFPGALoader -b gatemate_evb_jtag -o .cfg.bit ``` -------------------------------- ### Write to external flash via SPI using Evaluation Board Source: https://github.com/trabucayre/openfpgaloader/blob/master/doc/vendors/colognechip.md Write data to an external flash memory via SPI using the GateMate Evaluation Board. If the FPGA should start from external memory after reset, set configuration mode pins to SPI active (0x0). ```bash openFPGALoader -b gatemate_evb_spi -f .cfg.bit ``` -------------------------------- ### Build and compile from source Source: https://github.com/trabucayre/openfpgaloader/blob/master/doc/guide/install.md Standard sequence of commands to clone, configure, and build the project. ```bash git clone https://github.com/trabucayre/openFPGALoader cd openFPGALoader mkdir build cd build cmake .. # add -DBUILD_STATIC=ON to build a static version # add -DENABLE_UDEV=OFF to disable udev support and -d /dev/xxx # add -DENABLE_CMSISDAP=OFF to disable CMSIS DAP support cmake --build . # or make -j$(nproc) ``` -------------------------------- ### List Boards and Cables Source: https://github.com/trabucayre/openfpgaloader/blob/master/doc/guide/first-steps.md Commands to list supported FPGA boards and cables. ```bash openFPGALoader --list-boards ``` ```bash openFPGALoader --list-cables ``` -------------------------------- ### Load Intel/Altera Bitstreams Source: https://github.com/trabucayre/openfpgaloader/blob/master/doc/vendors/intel.md Use openFPGALoader to program the FPGA with SVF or RBF files. ```bash openFPGALoader -b boardname project_name.svf # or openFPGALoader -b boardname project_name.rbf ``` -------------------------------- ### Build openFPGALoader from Source Source: https://context7.com/trabucayre/openfpgaloader/llms.txt Builds openFPGALoader from source using git, cmake, and make. This involves cloning the repository, creating a build directory, configuring with cmake, and compiling. ```bash git clone https://github.com/trabucayre/openFPGALoader cd openFPGALoader mkdir build && cd build cmake .. make -j$(nproc) sudo make install ``` -------------------------------- ### Enable FTDI Cables and Xilinx Support Source: https://github.com/trabucayre/openfpgaloader/blob/master/doc/guide/install.md Use this command to configure the build to include only FTDI-based cables and Xilinx device support. This is useful for projects targeting specific hardware configurations. ```bash cmake \ -DENABLE_CABLE_ALL=OFF \ -DENABLE_VENDORS_ALL=OFF \ -DENABLE_FTDI_BASED_CABLE=ON \ -DENABLE_XILINX_SUPPORT=ON \ .. ``` -------------------------------- ### Apply udev rules (Option 1) Source: https://github.com/trabucayre/openfpgaloader/blob/master/doc/guide/install.md Configure udev rules using the plugdev group. ```bash sudo groupadd --system plugdev # only required if plugdev is absent sudo cp 99-openfpgaloader.rules /etc/udev/rules.d/ sudo udevadm control --reload-rules && sudo udevadm trigger # force udev to take new rule sudo usermod -a $USER -G plugdev # add user to plugdev group ``` -------------------------------- ### Load iCE40 SPI Flash Memory (.bin) Source: https://github.com/trabucayre/openfpgaloader/blob/master/doc/vendors/lattice.md Use this command to load a .bin file into the SPI flash of an iCE40 device. The `-b ice40_generic` option is required for direct SPI flash access. ```bash openFPGALoader -b ice40_generic /somewhere/*.bin ``` -------------------------------- ### Build new device bitstream Source: https://github.com/trabucayre/openfpgaloader/blob/master/spiOverJtag/README.md Generic commands to build a bitstream for a newly registered device part. ```bash # Xilinx/Efinix make spiOverJtag_.bit.gz # or for Altera make spiOverJtag_.rbf.gz ``` -------------------------------- ### Write to external flash via JTAG using Programmer Cable Source: https://github.com/trabucayre/openfpgaloader/blob/master/doc/vendors/colognechip.md Write data to an external flash memory via JTAG using the GateMate Programmer cable. The FPGA will not start automatically after this operation. Ensure the configuration mode pins are set to JTAG (0xC). ```bash openFPGALoader -c gatemate_pgm -f .cfg.bit ``` -------------------------------- ### Cross-compile openFPGALoader for Windows from Linux Source: https://github.com/trabucayre/openfpgaloader/blob/master/doc/guide/install.md Build steps for cross-compiling the project for Windows using MinGW-w64 toolchains. ```bash sudo apt install \ mingw-w64 \ libz-mingw-w64-dev \ clang \ lld \ cmake \ pkg-config \ p7zip-full ``` ```bash sudo dnf install \ mingw64-gcc \ mingw64-gcc-c++ \ mingw64-zlib \ mingw64-zlib-static \ clang \ lld \ cmake \ p7zip \ p7zip-plugins ``` ```bash git clone https://github.com/trabucayre/openFPGALoader cd openFPGALoader mkdir build-win64 cd build-win64 ``` ```bash cmake -DCMAKE_TOOLCHAIN_FILE=../cmake/Toolchain-x86_64-w64-mingw32.cmake .. cmake --build . --parallel ``` ```bash cmake -DCMAKE_TOOLCHAIN_FILE=../cmake/Toolchain-x86_64-w64-mingw32-clang.cmake .. cmake --build . --parallel ``` ```bash x86_64-w64-mingw32-strip openFPGALoader.exe # or llvm-strip openFPGALoader.exe ``` -------------------------------- ### Write to external flash via SPI with offset Source: https://github.com/trabucayre/openfpgaloader/blob/master/doc/vendors/colognechip.md Write data to a specific offset in the external flash memory via SPI using the GateMate Evaluation Board. If the FPGA should start from external memory after reset, set configuration mode pins to SPI active (0x0). ```bash openFPGALoader -b gatemate_evb_spi -o .cfg.bit ``` -------------------------------- ### Library and Include Directories Configuration Source: https://github.com/trabucayre/openfpgaloader/blob/master/CMakeLists.txt Configures search paths for libraries and includes based on system requirements. ```cmake link_directories( ${LIBUSB_LIBRARY_DIRS} ${LIBFTDI_LIBRARY_DIRS} ) if (ENABLE_LIBGPIOD) link_directories(${LIBGPIOD_LIBRARY_DIRS}) endif() if (ENABLE_CMSISDAP AND HIDAPI_FOUND) link_directories(${HIDAPI_LIBRARY_DIRS}) endif() ``` ```cmake include_directories( ${LIBUSB_INCLUDE_DIRS} ${LIBFTDI_INCLUDE_DIRS} ) ``` -------------------------------- ### Write to external flash via SPI using Programmer Cable Source: https://github.com/trabucayre/openfpgaloader/blob/master/doc/vendors/colognechip.md Write data to an external flash memory via SPI using the GateMate Programmer cable. If the FPGA should start from external memory after reset, set configuration mode pins to SPI active (0x0). ```bash openFPGALoader -b gatemate_pgm_spi -f .cfg.bit ``` -------------------------------- ### Load .svf file onto Lichee Tang Source: https://github.com/trabucayre/openfpgaloader/blob/master/doc/vendors/anlogic.md Use this command to load an .svf file onto the Sipeed Lichee Tang board. ```bash openFPGALoader -b licheeTang /somewhere/*.svf ``` -------------------------------- ### Gowin FPGA Programming Source: https://context7.com/trabucayre/openfpgaloader/llms.txt Commands for programming Gowin LittleBee (GW1N) and Arora (GW2A/GW5A) series FPGAs. ```bash # Load .fs file to Tang Nano 9K SRAM openFPGALoader -m -b tangnano9k impl/pnr/project.fs # Write .fs file to Tang Nano 9K internal flash openFPGALoader -f -b tangnano9k impl/pnr/project.fs # Write to external SPI flash using BSCAN mode openFPGALoader -b tangnano9k --external-flash project.fs # Program user flash memory with additional data openFPGALoader -b tangnano9k --write-flash project.fs --user-flash userdata.bin # Program Tang Primer 20K openFPGALoader -b tangprimer20k impl/pnr/project.fs ``` -------------------------------- ### Configure Library Dependencies and Versioning Source: https://github.com/trabucayre/openfpgaloader/blob/master/CMakeLists.txt Logic for detecting and configuring optional dependencies such as ZLIB, Threads, and libftdi versioning. ```cmake if (ENABLE_USB_SCAN) add_definitions("-DENABLE_USB_SCAN=1") endif() if (ZLIB_FOUND) include_directories(${ZLIB_INCLUDE_DIRS}) target_link_libraries(openFPGALoader ${ZLIB_LIBRARIES}) add_definitions(-DHAS_ZLIB=1) else() message("zlib library not found: can't flash intel/altera devices") endif() if (LINK_CMAKE_THREADS) find_package(Threads REQUIRED) target_link_libraries(openFPGALoader Threads::Threads) endif() if (USE_LIBFTDI) # libftdi < 1.4 as no usb_addr # libftdi >= 1.5 as purge_buffer obsolete math(EXPR FTDI_VAL "${LIBFTDI_VERSION_MAJOR} * 100 + ${LIBFTDI_VERSION_MINOR}") add_definitions(-DFTDI_VERSION=${FTDI_VAL}) endif() ``` -------------------------------- ### Apply udev rules (Option 2) Source: https://github.com/trabucayre/openfpgaloader/blob/master/doc/guide/install.md Configure udev rules using the dialout group. ```bash sudo cp 70-openfpgaloader.rules /etc/udev/rules.d/ sudo udevadm control --reload-rules && sudo udevadm trigger # force udev to take new rule sudo usermod -a $USER -G dialout # add user to dialout group ``` -------------------------------- ### Xilinx Virtual Cable (XVC) Support Source: https://context7.com/trabucayre/openfpgaloader/llms.txt Commands to use openFPGALoader as an XVC client or server for remote JTAG access. ```bash # Connect as XVC client to remote server openFPGALoader -c xvc-client --ip 192.168.1.100 --port 2542 bitstream.bit # Start XVC server on local machine openFPGALoader -b arty --xvc --port 2542 ``` -------------------------------- ### Load .hex file to Xyloni board (SPI) Source: https://github.com/trabucayre/openfpgaloader/blob/master/doc/vendors/efinix.md Use this command to load a .hex file onto a Xyloni board in SPI active mode. The '-b xyloni_spi' argument is required as autodetection is not possible. ```bash openFPGALoader -b xyloni_spi /somewhere/project/outflow/*.hex ``` -------------------------------- ### Load MachXO2/3 Flash Memory (.jed) Source: https://github.com/trabucayre/openfpgaloader/blob/master/doc/vendors/lattice.md Use this command to load a .jed file into the flash memory of MachXO2 or MachXO3 devices. The `--flash-sector CFG0` option is required for the Mach3D Breakout Board. ```bash openFPGALoader [-b yourboard] [--flash-sector CFG0] impl1/*.jed ``` -------------------------------- ### Load ECP5/3/NX SRAM (.bit) Source: https://github.com/trabucayre/openfpgaloader/blob/master/doc/vendors/lattice.md This command loads a .bit file into the SRAM of ECP5, ECP3, Certus-NX, CertusPro-NX, or Crosslink-NX devices. The `-m` argument is optional as openFPGALoader loads bitstreams into memory by default. ```bash openFPGALoader [-b yourBoard] [-c yourCable] -m project_name/*.bit ``` -------------------------------- ### Program with External Cable Source: https://github.com/trabucayre/openfpgaloader/blob/master/doc/guide/first-steps.md Commands to program an FPGA using a specified external cable. ```bash openFPGALoader -c my_cable my_bitstream.bit # Program to SRAM openFPGALoader -c my_cable -f my_bitstream.bit # Program to flash ``` -------------------------------- ### Define Project Source and Header Files Source: https://github.com/trabucayre/openfpgaloader/blob/master/CMakeLists.txt Lists the core source and header files for the project and conditionally appends parser-specific files based on build flags. ```cmake set(OPENFPGALOADER_SOURCE src/common.cpp src/configBitstreamParser.cpp src/device.cpp src/display.cpp src/main.cpp src/progressBar.cpp ) set(OPENFPGALOADER_HEADERS src/board.hpp src/cable.hpp src/common.hpp src/configBitstreamParser.hpp src/cxxopts.hpp src/device.hpp src/display.hpp src/part.hpp src/progressBar.hpp ) # =========================== # Parsers classes # =========================== list(APPEND OPENFPGALOADER_SOURCE src/rawParser.cpp) list(APPEND OPENFPGALOADER_HEADERS src/rawParser.hpp) if (${ENABLE_LATTICE_SUPPORT} OR ${ENABLE_XILINX_SUPPORT}) list(APPEND OPENFPGALOADER_SOURCE src/jedParser.cpp src/mcsParser.cpp ) list(APPEND OPENFPGALOADER_HEADERS src/jedParser.hpp src/mcsParser.hpp ) endif() # =========================== # To be sorted # =========================== list(APPEND OPENFPGALOADER_SOURCE src/bpiFlash.cpp src/spiFlash.cpp src/flashInterface.cpp src/jtag.cpp ) list(APPEND OPENFPGALOADER_HEADERS src/bpiFlash.hpp src/jtag.hpp src/jtagInterface.hpp src/spiFlash.hpp src/spiFlashdb.hpp src/flashInterface.hpp ) ``` -------------------------------- ### Generate and load .svf file using prjtang Source: https://github.com/trabucayre/openfpgaloader/blob/master/doc/vendors/anlogic.md This snippet shows how to build the tangbit tool from the prjtang project and then use it to convert a .bit file to a .svf file. The generated .svf file can then be loaded. ```bash mkdir build cd build cmake ../ make ``` ```bash tangbit --input /somewhere.bit --svf bitstream.svf ``` -------------------------------- ### Configure Cable and Vendor Drivers Source: https://github.com/trabucayre/openfpgaloader/blob/master/doc/guide/install.md Enable or disable specific cable and vendor drivers to optimize build size and support. ```bash cmake -DENABLE_CABLE_ALL=ON -DENABLE_VENDORS_ALL=ON .. # and cmake .. # Implicit default values ``` ```bash cmake -DENABLE_CABLE_ALL=OFF -DENABLE_VENDORS_ALL=OFF .. ``` -------------------------------- ### Load ECP5/NX SPI Flash (.bit or .bin) Source: https://github.com/trabucayre/openfpgaloader/blob/master/doc/vendors/lattice.md Use this command to load .bit or .bin files into the SPI flash of ECP5, Certus-NX, CertusPro-NX, or Crosslink-NX devices. SPI Flash write is not supported for the ECP3 family. ```bash openFPGALoader [-b yourBoard] [-c yourCable] -f project_name/*.bit # or *.bin ``` -------------------------------- ### Load .hex file to Firant board (SPI) Source: https://github.com/trabucayre/openfpgaloader/blob/master/doc/vendors/efinix.md Use this command to load a .hex file onto a Firant board in SPI active mode. The '-b fireant' argument is required as autodetection is not possible. ```bash openFPGALoader -b fireant /somewhere/project/outflow/*.hex ``` -------------------------------- ### Check user groups and device permissions Source: https://github.com/trabucayre/openfpgaloader/blob/master/doc/guide/troubleshooting.md Commands to verify user group membership and device node access rights for troubleshooting connection failures. ```bash id $USER ``` ```bash ls -l /dev/ttyUSB* /dev/ttyACM* ``` -------------------------------- ### Load bitstream to memory Source: https://github.com/trabucayre/openfpgaloader/blob/master/doc/vendors/xilinx.md Commands to load .bit or .bin files directly into FPGA memory. ```bash openFPGALoader [-m] -b arty *.runs/impl_1/*.bit (or *.bin) ``` ```bash openFPGALoader [-m] -b spartanEdgeAccelBoard -c digilent_hs2 *.runs/impl_1/*.bit (or *.bin) ``` -------------------------------- ### Build bridge bitstreams Source: https://github.com/trabucayre/openfpgaloader/blob/master/spiOverJtag/README.md Commands to generate compressed bridge bitstreams for specific FPGA targets. ```bash # Xilinx Artix7 35t make spiOverJtag_xc7a35t.bit.gz # Altera Cyclone10CL 016 make spiOverJtag_10cl016484.rbf.gz # Efinix Trion T13 F256 make spiOverJtag_efinix_t13f256.bit.gz ``` -------------------------------- ### Configure Quartus Project for Bitstream Generation Source: https://github.com/trabucayre/openfpgaloader/blob/master/doc/vendors/intel.md Add these assignments to your QSF file or FuseSoC TCL script to automate file generation and disable real-time decompression. ```default set_global_assignment -name ON_CHIP_BITSTREAM_DECOMPRESSION OFF set_global_assignment -name GENERATE_RBF_FILE ON set_global_assignment -name GENERATE_SVF_FILE ON ``` -------------------------------- ### Lattice FPGA Programming Source: https://context7.com/trabucayre/openfpgaloader/llms.txt Commands for programming ECP5, ECP3, MachXO2/XO3, iCE40, Certus-NX, and CrossLink-NX devices. ```bash # Load bitstream to ECP5 SRAM openFPGALoader -b colorlight project.bit # Write bitstream to ECP5 flash openFPGALoader -b ulx3s -f project.bit # Load MCS file to Lattice flash openFPGALoader -b ecp5_evn project.mcs # Program MachXO2 with JED file openFPGALoader -b machXO2EVN impl1/project.jed # Program MachXO3D with specific flash sector openFPGALoader -b machXO3EVN --flash-sector CFG0 impl1/project.jed # Program iCE40 flash (direct SPI access) openFPGALoader -b ice40_generic project.bin ``` -------------------------------- ### Load dual MCS files for UltraScale FPGAs Source: https://github.com/trabucayre/openfpgaloader/blob/master/doc/vendors/xilinx.md Commands for programming primary and secondary SPI flash devices on supported UltraScale boards. ```bash openFPGALoader --board vcu118 -f --target-flash both --bitstream *.runs/impl_1/*_primary.mcs --secondary-bitstream *.runs/impl_1/*_secondary.mcs ``` ```bash openFPGALoader --board vcu118 -f --target-flash secondary --bitstream arbitrary_data ``` -------------------------------- ### Load .bit file into memory on Lichee Tang Source: https://github.com/trabucayre/openfpgaloader/blob/master/doc/vendors/anlogic.md Use this command to load a .bit file into the memory of the Sipeed Lichee Tang board. The -m flag is default and can be omitted. ```bash openFPGALoader -m -b licheeTang /somewhere/project/prj/*.bit ``` -------------------------------- ### Program MAX10 via SVF Source: https://github.com/trabucayre/openfpgaloader/blob/master/doc/vendors/intel.md Load a bitstream into SRAM using an SVF file. ```bash openFPGALoader [-b boardname] -c cablename the_svf_file.svf ``` -------------------------------- ### Load .bit file into SPI flash on Lichee Tang Source: https://github.com/trabucayre/openfpgaloader/blob/master/doc/vendors/anlogic.md Use this command to load a .bit file into the SPI flash of the Sipeed Lichee Tang board. ```bash openFPGALoader -f -b licheeTang /somewhere/project/prj/*.bit ``` -------------------------------- ### Reset FPGA using openFPGALoader Source: https://github.com/trabucayre/openfpgaloader/blob/master/doc/guide/advanced.md Use the `-r` option to reset the FPGA. This is a fundamental operation for re-initializing the FPGA after programming or configuration changes. ```bash openFPGALoader [options] -r ``` -------------------------------- ### Program Gowin FPGA User Flash Source: https://github.com/trabucayre/openfpgaloader/blob/master/doc/vendors/gowin.md This is an experimental feature to program the extra flash space on Gowin FPGAs via JTAG. Use `--write-flash` for the bitstream and `--user-flash` for the binary file. This functionality is not thoroughly tested and may potentially damage the device. ```bash openFPGALoader --write-flash /path/to/bitstream.fs --user-flash /path/to/flash.bin ``` -------------------------------- ### Flash Gowin FPGA SRAM Source: https://github.com/trabucayre/openfpgaloader/blob/master/doc/vendors/gowin.md Use the `-m` flag to flash the SRAM of Gowin FPGAs. Ensure you specify the correct BOARD_NAME for your hardware. ```bash openFPGALoader -m -b BOARD_NAME impl/pnr/*.fs ``` -------------------------------- ### Generate Intel/Altera Bitstream Files Source: https://github.com/trabucayre/openfpgaloader/blob/master/doc/vendors/intel.md Use quartus_cpf to convert SOF files into SVF or RBF formats for use with openFPGALoader. ```bash quartus_cpf -c -q 12.0MHz -g 3.3 -n p project_name.sof project_name.svf ``` ```bash quartus_cpf --option=bitstream_compression=off -c project_name.sof project_name.rbf ``` -------------------------------- ### Configure GuixSystem udev service Source: https://github.com/trabucayre/openfpgaloader/blob/master/doc/guide/install.md Extend the operating system configuration to allow non-root access. ```scheme (udev-rules-service 'openfpgaloader openfpgaloader #:groups '("plugdev") ``` -------------------------------- ### Configure udev Rules with plugdev Group Source: https://context7.com/trabucayre/openfpgaloader/llms.txt Sets up udev rules to allow non-root access to JTAG adapters using the 'plugdev' group. This is the recommended method. It involves creating the group, copying the rules file, reloading rules, and adding the user to the group. ```bash sudo groupadd --system plugdev sudo cp 99-openfpgaloader.rules /etc/udev/rules.d/ sudo udevadm control --reload-rules && sudo udevadm trigger sudo usermod -a $USER -G plugdev ``` -------------------------------- ### Program MAX10 Internal Flash via POF Source: https://github.com/trabucayre/openfpgaloader/blob/master/doc/vendors/intel.md Write a bitstream to internal flash using a POF file. Optionally specify flash sectors to update. ```bash openFPGALoader [-b boardname] [--flash-sector] -c cablename the_pof_file.pof ``` ```bash openFPGALoader -c usb-blaster --flash-sector UFM1,CFM0,CFM2 the_pof_file.pof ``` -------------------------------- ### Load .bin file via JTAG Source: https://github.com/trabucayre/openfpgaloader/blob/master/doc/vendors/efinix.md Load a .bin file into RAM or SPI Flash using JTAG. Requires specifying the cable type, e.g., 'jlink_base'. ```bash openFPGALoader --cable jlink_base -m /somewhere/project/outflow/*.bin ``` -------------------------------- ### Platform-Specific Build Settings Source: https://github.com/trabucayre/openfpgaloader/blob/master/CMakeLists.txt Adjusts build configuration based on the target operating system. ```cmake if (${CMAKE_SYSTEM_NAME} MATCHES "Windows") # winsock provides ntohs target_link_libraries(openFPGALoader ws2_32) target_sources(openFPGALoader PRIVATE src/pathHelper.cpp) list(APPEND OPENFPGALOADER_HEADERS src/pathHelper.hpp) endif() ``` ```cmake # libusb_attach_kernel_driver is only available on Linux. if (${CMAKE_SYSTEM_NAME} MATCHES "Linux") add_definitions(-DATTACH_KERNEL) endif() ``` -------------------------------- ### Load bitstream to FPGA board Source: https://github.com/trabucayre/openfpgaloader/blob/master/doc/compatibility/board.md Use these commands to load a bitstream file into either volatile SRAM or non-volatile flash memory on a specified board. ```bash openFPGALoader -b arty bitstream.bit # Loading in SRAM (volatile) openFPGALoader -b arty -f bitstream.bit # Writing in flash (non-volatile) ``` -------------------------------- ### Cologne Chip GateMate Programming Source: https://context7.com/trabucayre/openfpgaloader/llms.txt Commands for programming Cologne Chip GateMate series FPGAs. ```bash # Program GateMate EVB via JTAG openFPGALoader -b gatemate_evb_jtag project.cfg # Program GateMate EVB via SPI openFPGALoader -b gatemate_evb_spi project.cfg # Program using GateMate programmer cable openFPGALoader -b gatemate_pgm_spi project.cfg ``` -------------------------------- ### Configure Hardware Interface Flags Source: https://github.com/trabucayre/openfpgaloader/blob/master/CMakeLists.txt Conditional blocks for enabling features like libgpiod, Remote Bitbang, and Xilinx Virtual Cable. These blocks define preprocessor macros and link necessary libraries. ```cmake if (ENABLE_LIBGPIOD) include_directories(${LIBGPIOD_INCLUDE_DIRS}) target_link_libraries(openFPGALoader ${LIBGPIOD_LIBRARIES}) add_definitions(-DENABLE_LIBGPIOD=1) if (LIBGPIOD_VERSION VERSION_GREATER_EQUAL 2) message("libgpiod v2 support enabled") add_definitions(-DGPIOD_APIV2) else() message("libgpiod v1 support enabled") endif() endif(ENABLE_LIBGPIOD) if (ENABLE_REMOTEBITBANG) add_definitions(-DENABLE_REMOTEBITBANG=1) message("Remote bitbang client support enabled") else() message("Remote bitbang client support disabled") endif() if (ENABLE_XILINX_VIRTUAL_CABLE_CLIENT) add_definitions(-DENABLE_XVC_CLIENT=1) set(CMAKE_EXE_LINKER_FLAGS "-pthread ${CMAKE_EXE_LINKER_FLAGS}") message("Xilinx Virtual Client support enabled") else() message("Xilinx Virtual Client support disabled") endif() if (ENABLE_XILINX_VIRTUAL_CABLE_SERVER) add_definitions(-DENABLE_XVC_SERVER=1) set(CMAKE_EXE_LINKER_FLAGS "-pthread ${CMAKE_EXE_LINKER_FLAGS}") message("Xilinx Virtual Server support enabled") else() message("Xilinx Virtual Server support disabled") endif() ``` -------------------------------- ### Load Bitstream to SRAM (Volatile) Source: https://context7.com/trabucayre/openfpgaloader/llms.txt Use this command to load a bitstream into the FPGA's volatile memory for immediate testing. Changes are lost upon power cycling. ```bash openFPGALoader -b arty bitstream.bit ``` ```bash openFPGALoader -c digilent_hs2 bitstream.bit ``` ```bash openFPGALoader -m -b tangnano9k project.fs ``` ```bash openFPGALoader -d /dev/ttyUSB0 -b colorlight bitstream.bit ``` -------------------------------- ### Executable and Target Linking Source: https://github.com/trabucayre/openfpgaloader/blob/master/CMakeLists.txt Defines the main executable and links necessary libraries. ```cmake add_executable(openFPGALoader ${OPENFPGALOADER_SOURCE} ${OPENFPGALOADER_HEADERS} ) ``` ```cmake target_link_libraries(openFPGALoader ${LIBUSB_LIBRARIES} ${LIBFTDI_LIBRARIES} ) ``` -------------------------------- ### Configure Project Dependencies Source: https://github.com/trabucayre/openfpgaloader/blob/master/CMakeLists.txt Handles conditional detection of libraries such as LibFTDI, LibUSB, and Zlib using CMake's find_package or PkgConfig modules. ```cmake if (USE_LIBFTDI) # Try to find the LibFTDI1 with cmake find_package(LibFTDI1 QUIET) endif() if (USE_PKGCONFIG) find_package(PkgConfig REQUIRED) # Backward compat when the libftdi is not found # by using cmake if (USE_LIBFTDI) if (NOT LIBFTDI_FOUND) pkg_check_modules(LIBFTDI REQUIRED libftdi1) string(REPLACE "." ";" VERSION_LIST ${LIBFTDI_VERSION}) list(GET VERSION_LIST 0 LIBFTDI_VERSION_MAJOR) list(GET VERSION_LIST 1 LIBFTDI_VERSION_MINOR) endif() else() set(LIBFTDI_LIBRARY_DIRS "") set(LIBFTDI_INCLUDE_DIRS "") set(LIBFTDI_LIBRARIES "") endif(USE_LIBFTDI) if (USE_LIBUSB) pkg_check_modules(LIBUSB REQUIRED libusb-1.0) else() set(LIBUSB_LIBRARY_DIRS "") set(LIBUSB_INCLUDE_DIRS "") set(LIBUSB_LIBRARIES "") endif(USE_LIBUSB) if(ENABLE_CMSISDAP) pkg_check_modules(HIDAPI hidapi-libusb) # if libusb not found try with hidraw if (NOT HIDAPI_FOUND) pkg_check_modules(HIDAPI hidapi-hidraw) endif() if (NOT HIDAPI_FOUND) pkg_check_modules(HIDAPI hidapi) endif() endif() # zlib support (gzip) if(WINDOWS_CROSSCOMPILE) if (WINDOWS_STATIC_ZLIB) set(ZLIB_USE_STATIC_LIBS ON) endif() # Use CMake zlib finder for Windows builds to avoid host pkg-config contamination # during cross-compilation and to allow static linking selection. find_package(ZLIB QUIET) if (NOT ZLIB_FOUND) if (WINDOWS_CROSSCOMPILE) message(FATAL_ERROR "zlib for Windows target not found. Install MinGW zlib development files " "(for example: libz-mingw-w64-dev on Debian/Ubuntu or mingw64-zlib on Fedora).") else() message(FATAL_ERROR "zlib for Windows build not found. Install zlib development files for your " "Windows toolchain.") endif() endif() if (WINDOWS_STATIC_ZLIB AND ZLIB_LIBRARIES MATCHES "\\.dll\\.a$") message(FATAL_ERROR "Static zlib requested (WINDOWS_STATIC_ZLIB=ON), but CMake selected " "'${ZLIB_LIBRARIES}'. Install static zlib (for example mingw64-zlib-static) " "or set -DWINDOWS_STATIC_ZLIB=OFF.") endif() else() pkg_check_modules(ZLIB zlib) if (NOT ZLIB_FOUND) # try zlib-ng pkg_check_modules(ZLIB zlib-ng) if (ZLIB_FOUND) add_definitions(-DHAS_ZLIBNG) else() message(FATAL_ERROR "Could find ZLIB") endif() endif(NOT ZLIB_FOUND) endif() if (ENABLE_UDEV) pkg_check_modules(LIBUDEV libudev) if (LIBUDEV_FOUND) add_definitions(-DUSE_UDEV) else() message("libudev not found, disabling udev support and -D parameter") set(ENABLE_UDEV OFF) endif() endif() if (ENABLE_LIBGPIOD) pkg_check_modules(LIBGPIOD libgpiod) if (NOT LIBGPIOD_FOUND) message("libgpiod not found, disabling gpiod support") set(ENABLE_LIBGPIOD OFF) endif() endif() endif() ``` -------------------------------- ### Load MachXO2 SRAM (.bit) Source: https://github.com/trabucayre/openfpgaloader/blob/master/doc/vendors/lattice.md This command loads a .bit file into the SRAM of a MachXO2 device. Ensure the 'Bitstream file' option is checked in Lattice Diamond's Export Files settings. ```bash openFPGALoader [-b yourboard] impl1/*.bit ``` -------------------------------- ### JTAG Cable Configuration Source: https://context7.com/trabucayre/openfpgaloader/llms.txt Commands to specify JTAG cables for standalone FPGAs or to override board defaults. ```bash # Use FTDI FT2232 cable openFPGALoader -c ft2232 bitstream.bit # Use Digilent HS2 cable openFPGALoader -c digilent_hs2 bitstream.bit # Use J-Link debugger openFPGALoader -c jlink bitstream.bit # Use USB Blaster openFPGALoader -c usb-blaster project.svf # Use CMSIS-DAP interface openFPGALoader -c cmsisdap bitstream.bit # Use DirtyJTAG probe openFPGALoader -c dirtyJtag bitstream.bit # Use CH347 JTAG adapter openFPGALoader -c ch347_jtag bitstream.bit ``` -------------------------------- ### Feature Flag and Message Configuration Source: https://github.com/trabucayre/openfpgaloader/blob/master/CMakeLists.txt Sets preprocessor definitions and displays status messages for various features. ```cmake if (ENABLE_UDEV) include_directories(${LIBUDEV_INCLUDE_DIRS}) target_link_libraries(openFPGALoader ${LIBUDEV_LIBRARIES}) endif() ``` ```cmake if (BUILD_STATIC) set_target_properties(openFPGALoader PROPERTIES LINK_SEARCH_END_STATIC 1) endif() ``` ```cmake # Anlogic Cable if (ENABLE_ANLOGIC_CABLE) add_definitions(-DENABLE_ANLOGIC_CABLE=1) message("Anlogic Cable support enabled") else() message("Anlogic Cable support disabled") endif() ``` ```cmake # CH347 if (ENABLE_CH347) add_definitions(-DENABLE_CH347=1) message("CH347 support enabled") else() message("CH347 support disabled") endif() ``` ```cmake if (ENABLE_CMSISDAP) if (HIDAPI_FOUND) include_directories(${HIDAPI_INCLUDE_DIRS}) target_link_libraries(openFPGALoader ${HIDAPI_LIBRARIES}) add_definitions(-DENABLE_CMSISDAP=1) target_sources(openFPGALoader PRIVATE src/cmsisDAP.cpp) list (APPEND OPENFPGALOADER_HEADERS src/cmsisDAP.hpp) message("cmsis_dap support enabled") else() message("hidapi-libusb not found: cmsis_dap support disabled") endif() endif(ENABLE_CMSISDAP) ``` ```cmake # DFU if (ENABLE_DFU) add_definitions(-DENABLE_DFU=1) message("DFU support enabled") else() message("DFU support disabled") endif() ``` ```cmake # dirtyJtag if (ENABLE_DIRTYJTAG) add_definitions(-DENABLE_DIRTYJTAG=1) message("dirtyJtag support enabled") else() message("dirtyJtag support disabled") endif() ``` ```cmake # ESP32S3 if (ENABLE_ESP_USB) add_definitions(-DENABLE_ESP_USB=1) message("ESP32S3 support enabled") else() message("ESP32S3 support disabled") endif() ``` ```cmake # Gowin GWU2X JTAG interface if(ENABLE_GOWIN_GWU2X) add_definitions(-DENABLE_GOWIN_GWU2X=1) message("Gowin GWU2X support enabled") else() message("Gowin GWU2X support disabled") endif() ``` ```cmake # Jetson Nano (libGPIO based) if (ENABLE_JETSONNANOGPIO) add_definitions(-DENABLE_JETSONNANOGPIO=1) message("Jetson Nano GPIO support enabled") endif(ENABLE_JETSONNANOGPIO) ``` ```cmake # JLINK if (ENABLE_JLINK) add_definitions(-DENABLE_JLINK=1) message("JLink support enabled") else() message("JLink support disabled") endif() ``` -------------------------------- ### Configure ISE Path Source: https://github.com/trabucayre/openfpgaloader/blob/master/doc/guide/install.md Set the Xilinx ISE path during CMake configuration for XC2C bitstream remapping. ```bash -DISE_PATH=/somewhere/Xilinx/ISE_VERS/ ``` -------------------------------- ### Load Bitstream via Network Source: https://github.com/trabucayre/openfpgaloader/blob/master/doc/guide/advanced.md Load a bitstream over the network. The FPGA side listens for data via `nc`, and the bitstream side sends the file content using `nc`. ```bash # FPGA side nc -lp port | openFPGALoader --file-type xxx [option] ``` ```bash # Bitstream side nc -q 0 host port < /path/to/bitstream.ext ``` -------------------------------- ### Program FPGA via JTAG using Evaluation Board Source: https://github.com/trabucayre/openfpgaloader/blob/master/doc/vendors/colognechip.md Use this command to program an FPGA via JTAG using the GateMate Evaluation Board. Ensure the configuration mode pins are set to JTAG (0xC). ```bash openFPGALoader -b gatemate_evb_jtag .cfg.bit ``` -------------------------------- ### Efinix FPGA Programming Source: https://context7.com/trabucayre/openfpgaloader/llms.txt Commands for programming Efinix Trion and Titanium series FPGAs using SPI and JTAG modes. ```bash # Program Fireant board via SPI openFPGALoader -b fireant project.hex # Program Xyloni board via SPI openFPGALoader -b xyloni_spi project.hex # Load to SRAM via JTAG with J-Link openFPGALoader --cable jlink_base -m project.bin # Write to flash via JTAG (specify FPGA part) openFPGALoader --cable jlink_base --fpga-part ti60f225 -f project.hex ``` -------------------------------- ### Load SPI Flash Files Source: https://github.com/trabucayre/openfpgaloader/blob/master/doc/vendors/intel.md Program SPI flash memory using RPD or RBF files. ```bash openFPGALoader -b boardname -r project_name_auto.rpd # or openFPGALoader -b boardname -r project_name.rbf ``` -------------------------------- ### Load ECP5/NX SPI Flash (.mcs) Source: https://github.com/trabucayre/openfpgaloader/blob/master/doc/vendors/lattice.md This command loads a .mcs file into the SPI flash of ECP5, Certus-NX, CertusPro-NX, or Crosslink-NX devices. Ensure the 'PROM File' option is checked in Lattice Diamond's Export Files settings to generate the .mcs file. ```bash openFPGALoader [-b yourBoard] [-c yourCable] project_name/*.mcs ``` -------------------------------- ### Check for plugdev group Source: https://github.com/trabucayre/openfpgaloader/blob/master/doc/guide/install.md Verify if the plugdev group exists on the system. ```bash grep -w plugdev /etc/group ``` -------------------------------- ### Configure Vivado for BIN file generation Source: https://github.com/trabucayre/openfpgaloader/blob/master/doc/vendors/xilinx.md Use this TCL command within Vivado to enable the generation of .bin files during the bitstream write process. ```tcl set_property STEPS.WRITE_BITSTREAM.ARGS.BIN_FILE true [get_runs impl_1] ``` -------------------------------- ### Configure udev Rules with dialout Group Source: https://context7.com/trabucayre/openfpgaloader/llms.txt Sets up udev rules to allow non-root access to JTAG adapters using the 'dialout' group. This is an alternative method if 'plugdev' is not suitable. It involves copying the rules file, reloading rules, and adding the user to the group. ```bash sudo cp 70-openfpgaloader.rules /etc/udev/rules.d/ sudo udevadm control --reload-rules && sudo udevadm trigger sudo usermod -a $USER -G dialout ``` -------------------------------- ### JTAG Chain Configuration Source: https://context7.com/trabucayre/openfpgaloader/llms.txt Commands for handling multi-device JTAG chains and specifying device positions or cable parameters. ```bash # Select device by position in JTAG chain (0-indexed) openFPGALoader -b arty --index-chain 1 bitstream.bit # Add non-FPGA devices to chain (idcode,irlen,name) openFPGALoader --misc-device 0x12345678,8,ARM_DAP -b arty bitstream.bit # Select specific FTDI channel (0-3 maps to A-D) openFPGALoader --ftdi-channel 1 -c ft4232 bitstream.bit # Select cable by serial number openFPGALoader --ftdi-serial ABC123 -c ft2232 bitstream.bit # Select cable by bus and device number openFPGALoader --busdev-num 1:5 -c ft2232 bitstream.bit ``` -------------------------------- ### Program FPGA via JTAG using Programmer Cable Source: https://github.com/trabucayre/openfpgaloader/blob/master/doc/vendors/colognechip.md Use this command to program an FPGA via JTAG using the GateMate Programmer cable. Ensure the configuration mode pins are set to JTAG (0xC). ```bash openFPGALoader -c gatemate_pgm .cfg.bit ``` -------------------------------- ### Load Serial Vector Format file Source: https://github.com/trabucayre/openfpgaloader/blob/master/doc/vendors/intel.md Loads an SVF file onto a device using a specified cable interface. ```bash openFPGALoader -c usb-blaster project_name.svf ``` -------------------------------- ### Program FPGA via SPI using Evaluation Board Source: https://github.com/trabucayre/openfpgaloader/blob/master/doc/vendors/colognechip.md Use this command to program an FPGA via SPI using the GateMate Evaluation Board. Ensure the configuration mode pins are set to SPI passive (0x4). ```bash openFPGALoader -b gatemate_evb_spi .cfg.bit ``` -------------------------------- ### DFU Mode Programming Source: https://context7.com/trabucayre/openfpgaloader/llms.txt Commands for programming devices that support the DFU (Device Firmware Update) protocol. ```bash # Program Orange Crab via DFU openFPGALoader -b orangeCrab bitstream.bit # Program ULX3S via DFU mode openFPGALoader -b ulx3s_dfu bitstream.bit # Specify DFU altsetting openFPGALoader --dfu --altsetting 0 bitstream.dfu ``` -------------------------------- ### Write Raw Binary to Arbitrary Flash Address Source: https://github.com/trabucayre/openfpgaloader/blob/master/doc/guide/advanced.md For FPGAs with external SPI flash, use the `-o` option to write a raw binary file to a specific address in the flash memory. This is supported for various FPGA families including Xilinx, Lattice, Anlogic, and Efinix. ```bash openFPGALoader -o
``` -------------------------------- ### Convert Files for SPI Flash Source: https://github.com/trabucayre/openfpgaloader/blob/master/doc/vendors/intel.md Convert POF or SOF files to RPD format for SPI flash programming. ```bash quartus_cpf -c project_name.pof project_name.rpd ``` ```bash # CYC1000 quartus_cpf -o auto_create_rpd=on -c -d EPCQ16A -s 10CL025YU256C8G project_name.svf project_name.jic # C10LP-RefKit quartus_cpf -o auto_create_rpd=on -c -d EPCQ16A -s 10CL055YU484C8G project_name.svf project_name.jic ```