Moderator: igrr
Do you wish to know the Flash size and SPIFFS size at run time ?
str = "FlashID : ";
str += String(ESP.getFlashChipId(), HEX);
str += "\r\nFlashSizeByChipId : ";
str += ESP.getFlashChipSizeByChipId();
str += "\r\nFlashChipSize : ";
str += ESP.getFlashChipSize();
str += "\r\nSPIFFS Size : ";
str += ((uint32_t) (&_SPIFFS_end) - (uint32_t) (&_SPIFFS_start));
str += "\r\nMagic : ";
uint32_t data;
uint8_t * bytes = (uint8_t *) &data;
// read first 4 byte (magic byte + flash config)
spi_flash_read(0x0000, &data, 4);
str += ((bytes[3] & 0xf0) >> 4);
FSInfo fsInfo;
SPIFFS.info(fsInfo);
str += "\r\nFS Bytes: ";
str += fsInfo.usedBytes;
str += " / ";
str += fsInfo.totalBytes;
str += "\r\n";
Serial.println(str);