efinix: support using JTAG interfaces

This commit is contained in:
Andrew Dennison 2023-06-01 11:05:26 +10:00
parent ec82dd6467
commit 87b17ed9bf
2 changed files with 37 additions and 4 deletions

View File

@ -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

View File

@ -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);