File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -148,6 +148,25 @@ void Ice40::program(unsigned int offset, bool unprotect_flash)
148148 post_flash_access ();
149149}
150150
151+ bool Ice40::detect_flash ()
152+ {
153+ /* prepare SPI access */
154+ prepare_flash_access ();
155+ printInfo (" Read Flash " , false );
156+ try {
157+ SPIFlash flash (reinterpret_cast <SPIInterface *>(_spi), false , _verbose_level);
158+ flash.read_id ();
159+ flash.display_status_reg ();
160+ } catch (std::exception &e) {
161+ printError (" Fail" );
162+ printError (std::string (e.what ()));
163+ return false ;
164+ }
165+
166+ /* release SPI access / reload */
167+ return post_flash_access ();
168+ }
169+
151170bool Ice40::dumpFlash (uint32_t base_addr, uint32_t len)
152171{
153172 /* prepare SPI access */
Original file line number Diff line number Diff line change @@ -24,9 +24,7 @@ class Ice40: public Device, SPIInterface {
2424 void program (unsigned int offset, bool unprotect_flash) override ;
2525 bool program_cram (const uint8_t *data, uint32_t length);
2626 bool dumpFlash (uint32_t base_addr, uint32_t len) override ;
27- bool detect_flash () override {
28- return SPIInterface::detect_flash ();
29- }
27+ bool detect_flash () override ;
3028 bool protect_flash (uint32_t len) override ;
3129 bool unprotect_flash () override ;
3230 bool bulk_erase_flash () override ;
You can’t perform that action at this time.
0 commit comments