Skip to content

Commit fb55ef5

Browse files
committed
fix: Correctly detect Adesto flash size
Adesto/Atmel flash chips report their size differently than most. This patch is equivalent to what has previously been applied to esptool with 0b56f85.
1 parent 1297133 commit fb55ef5

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

cores/esp8266/Esp.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,12 @@ uint8_t EspClass::getFlashChipVendorId(void)
289289

290290
uint32_t EspClass::getFlashChipRealSize(void)
291291
{
292-
return (1 << ((spi_flash_get_id() >> 16) & 0xFF));
292+
uint32_t id = spi_flash_get_id();
293+
if ((id & 0xFF) == SPI_FLASH_VENDOR_ATMEL) {
294+
return (0x8000 << ((id >> 8) & 0x1F));
295+
} else {
296+
return (1 << ((id >> 16) & 0xFF));
297+
}
293298
}
294299

295300
uint32_t EspClass::getFlashChipSize(void)

0 commit comments

Comments
 (0)