spiFlash: stop if jedec_id == 0xffffff
This commit is contained in:
parent
1f842e4ebc
commit
c64f1970d6
|
|
@ -272,8 +272,15 @@ bool SPIFlash::dump(const std::string &filename, const int &base_addr,
|
||||||
|
|
||||||
int SPIFlash::erase_and_prog(int base_addr, uint8_t *data, int len)
|
int SPIFlash::erase_and_prog(int base_addr, uint8_t *data, int len)
|
||||||
{
|
{
|
||||||
if (_jedec_id == 0)
|
if (_jedec_id == 0) {
|
||||||
read_id();
|
try {
|
||||||
|
read_id();
|
||||||
|
} catch(std::exception &e) {
|
||||||
|
printError(e.what());
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool must_relock = false; // used to relock after write;
|
bool must_relock = false; // used to relock after write;
|
||||||
|
|
||||||
/* microchip SST26VF032B have global lock set
|
/* microchip SST26VF032B have global lock set
|
||||||
|
|
@ -432,6 +439,10 @@ void SPIFlash::read_id()
|
||||||
printf("%x ", rx[i]);
|
printf("%x ", rx[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* something wrong with read */
|
||||||
|
if ((_jedec_id >> 8) == 0xffff)
|
||||||
|
throw std::runtime_error("Read ID failed");
|
||||||
|
|
||||||
if (_verbose > 0)
|
if (_verbose > 0)
|
||||||
printf("read %x\n", _jedec_id);
|
printf("read %x\n", _jedec_id);
|
||||||
auto t = flash_list.find(_jedec_id >> 8);
|
auto t = flash_list.find(_jedec_id >> 8);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue