ice40: fix detect_flash
This commit is contained in:
parent
4ab6f220b9
commit
3eff88e331
|
|
@ -148,6 +148,25 @@ void Ice40::program(unsigned int offset, bool unprotect_flash)
|
||||||
post_flash_access();
|
post_flash_access();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Ice40::detect_flash()
|
||||||
|
{
|
||||||
|
/* prepare SPI access */
|
||||||
|
prepare_flash_access();
|
||||||
|
printInfo("Read Flash ", false);
|
||||||
|
try {
|
||||||
|
SPIFlash flash(reinterpret_cast<SPIInterface *>(_spi), false, _verbose_level);
|
||||||
|
flash.read_id();
|
||||||
|
flash.display_status_reg();
|
||||||
|
} catch (std::exception &e) {
|
||||||
|
printError("Fail");
|
||||||
|
printError(std::string(e.what()));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* release SPI access / reload */
|
||||||
|
return post_flash_access();
|
||||||
|
}
|
||||||
|
|
||||||
bool Ice40::dumpFlash(uint32_t base_addr, uint32_t len)
|
bool Ice40::dumpFlash(uint32_t base_addr, uint32_t len)
|
||||||
{
|
{
|
||||||
/* prepare SPI access */
|
/* prepare SPI access */
|
||||||
|
|
|
||||||
|
|
@ -24,9 +24,7 @@ class Ice40: public Device, SPIInterface {
|
||||||
void program(unsigned int offset, bool unprotect_flash) override;
|
void program(unsigned int offset, bool unprotect_flash) override;
|
||||||
bool program_cram(const uint8_t *data, uint32_t length);
|
bool program_cram(const uint8_t *data, uint32_t length);
|
||||||
bool dumpFlash(uint32_t base_addr, uint32_t len) override;
|
bool dumpFlash(uint32_t base_addr, uint32_t len) override;
|
||||||
bool detect_flash() override {
|
bool detect_flash() override;
|
||||||
return SPIInterface::detect_flash();
|
|
||||||
}
|
|
||||||
bool protect_flash(uint32_t len) override;
|
bool protect_flash(uint32_t len) override;
|
||||||
bool unprotect_flash() override;
|
bool unprotect_flash() override;
|
||||||
bool bulk_erase_flash() override;
|
bool bulk_erase_flash() override;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue