From fb55ef5d3c6bdef65106d27ad750ed8a52238f78 Mon Sep 17 00:00:00 2001 From: Sven Schwermer Date: Fri, 10 Oct 2025 23:28:30 +0200 Subject: [PATCH] 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. --- cores/esp8266/Esp.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cores/esp8266/Esp.cpp b/cores/esp8266/Esp.cpp index 8a3ea32515..cb5d3e075b 100644 --- a/cores/esp8266/Esp.cpp +++ b/cores/esp8266/Esp.cpp @@ -289,7 +289,12 @@ uint8_t EspClass::getFlashChipVendorId(void) uint32_t EspClass::getFlashChipRealSize(void) { - return (1 << ((spi_flash_get_id() >> 16) & 0xFF)); + uint32_t id = spi_flash_get_id(); + if ((id & 0xFF) == SPI_FLASH_VENDOR_ATMEL) { + return (0x8000 << ((id >> 8) & 0x1F)); + } else { + return (1 << ((id >> 16) & 0xFF)); + } } uint32_t EspClass::getFlashChipSize(void)