diff --git a/src/efinix.cpp b/src/efinix.cpp index 87d3b35..328a5c2 100644 --- a/src/efinix.cpp +++ b/src/efinix.cpp @@ -228,11 +228,23 @@ void Efinix::program(unsigned int offset, bool unprotect_flash) delete bit; } +bool Efinix::detect_flash() +{ + if (_jtag) { + return SPIInterface::detect_flash(); + } + + uint32_t timeout = 1000; + _spi->gpio_clear(_rst_pin); + + return reinterpret_cast(_spi)->detect_flash(); +} + bool Efinix::dumpFlash(uint32_t base_addr, uint32_t len) { - if (!_spi) { - printError("jtag: dumpFlash not supported"); - return false; + if (_jtag) { + SPIInterface::set_filename(_filename); + return SPIInterface::dump(base_addr, len); } uint32_t timeout = 1000; diff --git a/src/efinix.hpp b/src/efinix.hpp index fda7384..2e0ac6a 100644 --- a/src/efinix.hpp +++ b/src/efinix.hpp @@ -28,6 +28,7 @@ class Efinix: public Device, SPIInterface { ~Efinix(); void program(unsigned int offset, bool unprotect_flash) override; + bool detect_flash() override; bool dumpFlash(uint32_t base_addr, uint32_t len) override; bool protect_flash(uint32_t len) override { (void) len;