From 87b17ed9bfae0f805d2c7a95776b825c0d79cff6 Mon Sep 17 00:00:00 2001 From: Andrew Dennison Date: Thu, 1 Jun 2023 11:05:26 +1000 Subject: [PATCH] efinix: support using JTAG interfaces --- doc/vendors/efinix.rst | 24 ++++++++++++++++++++++++ src/efinix.cpp | 17 +++++++++++++---- 2 files changed, 37 insertions(+), 4 deletions(-) diff --git a/doc/vendors/efinix.rst b/doc/vendors/efinix.rst index 8fe30dc..a47115b 100644 --- a/doc/vendors/efinix.rst +++ b/doc/vendors/efinix.rst @@ -25,3 +25,27 @@ or, for xyloni board Since openFPGALoader access the flash directly in SPI mode the ``-b fireant``, ``-b xyloni_spi`` is required (no autodetection possible). + +Trion and Titanium JTAG usage +========================================== + +*openFPGALoader* supports loading to RAM and SPI Flash with JTAG + +Tested with J-Link BASE + +bin file load +------------- + +.. code-block:: bash + + openFPGALoader --cable jlink_base -m /somewhere/project/outflow/*.bin + +hex file flash +------------- + +Example for ti60f225. +NOTE: JTAG chains with more than one device (eg --index-chain) are currently not supported for writing to SPI flash + +.. code-block:: bash + + openFPGALoader --cable jlink_base --fpga-part ti60f225 -f /somewhere/project/outflow/*.hex \ No newline at end of file diff --git a/src/efinix.cpp b/src/efinix.cpp index 6c6db3d..9436fd9 100644 --- a/src/efinix.cpp +++ b/src/efinix.cpp @@ -88,7 +88,7 @@ Efinix::Efinix(Jtag* jtag, const std::string &filename, } else if (board_name == "titanium_ti60_f225_jtag") { spi_board_name = "titanium_ti60_f225"; } else { - printInfo("Using efinix JTAG interface (no GPIO)"); + init_common(prg_type); return; } @@ -116,8 +116,10 @@ Efinix::Efinix(Jtag* jtag, const std::string &filename, void Efinix::init_common(const Device::prog_type_t &prg_type) { - _spi->gpio_set_input(_done_pin); - _spi->gpio_set_output(_rst_pin | _oe_pin); + if (_spi) { + _spi->gpio_set_input(_done_pin); + _spi->gpio_set_output(_rst_pin | _oe_pin); + } switch (prg_type) { case Device::WR_FLASH: @@ -142,8 +144,10 @@ Efinix::~Efinix() void Efinix::reset() { - if (!_spi) // not supported + if (!_spi) { + printError("jtag: reset not supported"); return; + } uint32_t timeout = 1000; _spi->gpio_clear(_rst_pin | _oe_pin); usleep(1000); @@ -218,6 +222,11 @@ void Efinix::program(unsigned int offset, bool unprotect_flash) bool Efinix::dumpFlash(uint32_t base_addr, uint32_t len) { + if (!_spi) { + printError("jtag: dumpFlash not supported"); + return false; + } + uint32_t timeout = 1000; _spi->gpio_clear(_rst_pin);