flash-size agnostic builds by d-a-v · Pull Request #6690 · esp8266/Arduino (original) (raw)

@TD-er for a start I ran the same binary DOUT lib-eeprom read/write sketch on esp8285(1M) and esp8266(4M) with good results.

#include <EEPROM.h>

#if AUTOFLASHSIZE
void flashinit()
{
  FLASHMAPCONFIG(FLASH_MAP_MAX_FS); // maximum for FS
  // or FLASH_MAP_OTA_FS (maximum space for OTA, rest of free space for FS)
  // or FLASH_MAP_NO_FS (no FS needed)
}
#endif

void setup() {
  Serial.begin(115200);

  Serial.printf("\n\nsize=%d\nsize=%d\naddr=0x%08x\n\n", ESP.getFlashChipSize(), ESP.getFlashChipRealSize(), EEPROM_start);

  EEPROM.begin(512);
  Serial.printf("%02x %02x %02x %02x\nwait 10s\n",
                EEPROM.read(0),
                EEPROM.read(1),
                EEPROM.read(2),
                EEPROM.read(3));
  delay(10000);
  Serial.printf("write\n");
  EEPROM.write(0, 0xde);
  EEPROM.write(1, 0xad);
  EEPROM.write(2, 0xbe);
  EEPROM.write(3, 0xef);
  EEPROM.commit();
}

void loop() {
}

esp8285:

size=1048576
size=1048576
addr=0x402fb000

esp8266:

size=4194304
size=4194304
addr=0x405fb000