ECPDAP allows you to program ECP5 FPGAs and attached SPI flash using CMSIS-DAP probes in JTAG mode.
This crate uses jtagdap to handle CMSIS-DAP and JTAG, and spi-flash-rs to handle the SPI flash itself. For programming SPI flashes directly, for example when using iCE40 FPGAs, check out spidap, which uses the same libraries.
ECP5 bitstreams can specify an IDCODE which the FPGA checks against its
internal IDCODE. By default this would prevent loading (for example) an
LFE5U-45F bitstream onto an LFE5UM-45F, even though it would be
compatible. By default, ecpdap will patch the bitstream IDCODE when
programming either SRAM or SPI flash to match the IDCODE detected via JTAG.
Use --no-fix-idcode to disable this functionality. Alternatively, use
--remove-idcode to entirely remove the IDCODE check from the bitstream.
Bitstreams can also include an SPI mode command to enable faster bitstream
loading from SPI flash. However, if a bitstream with such a command is loaded
directly to SRAM, and the SPI flash does not have a valid bitstream loaded,
the ECP5 aborts loading the bitstream. To work around this issue, ecpdap
will by default remove SPI mode commands from bitstreams loaded to SRAM.
Use --no-remove-spimode to disable this functionality.
The default clock frequency is 1MHz, but in many situations higher frequencies are possible and reduce operation time. It is also possible to require lower speeds in situations with poor signal integrity.
Use -f or --freq to change, for example -f 10M.
ECP5 FPGAs can be programmed on arbitrary length JTAG scan chains; you may need
to specify --ir-lengths and possibly specify a higher --scan-chain-length
depending on the other devices on your scan chain.
However, accessing the attached SPI flashes require that the ECP5 is the only device on the scan chain (in other words, the probe TDI and TDO connect directly to the ECP5 pins).
Pre-built binaries are available for Windows and Linux on the Releases page. You must have libusb installed or available on your system, and you must have permissions or drivers set up to access your CMSIS-DAP probe. See the drivers page for information on setup.
ECPDAP is also packaged for NixOS under the ecpdap attribute.
- You must have a working Rust compiler installed. Visit rustup.rs to install Rust.
- libusb is required to use the higher-speed CMSIS-DAPv2 protocol, where supported by your probe.
- You may need to set up drivers or permissions to access the USB device, see
drivers/for details
To build and install for your user, without checking out the repository:
cargo install ecpdapOr, building locally after checking out this repository:
cargo build --releaseYou can either run the ecpdap executable directly from target/release/ecpdap,
or you can install it for your user using cargo install --path ..
Run ecpdap help for detailed usage. Commonly used commands:
ecpdap probes: List all detected CMSIS-DAP probesecpdap scan: Scan the JTAG chain to detect ECP5 devicesecpdap program bitstream.bit -f10M: Programbitstream.bitto the ECP5 at 10MHzecpdap flash id: Read the flash manufacturer and product IDsecpdap flash scan: Read the flash SFDP metadata and status registersecpdap flash write bitstream.bit: Writebitstream.bitto flash memory.
ecpdap is licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.