Skip to content

Commit 69f3e81

Browse files
Restore EEPROM address to prior released location (#6537)
When the FS_END was adjusted to end on a full block (i.e. rounded down) to avoid filesystem issues, but _FS_end was changed. The EEPROM library used _FS_end to implicitly calculate the start of the EEPROM data, so this means after the _FS_end fix, EEPROM data written with prior releases would "disappear." Avoid the issue by explicitly calculating the EEPROM start location in the linker, using the same formula as prior release. Fixes #6531
1 parent 3733ece commit 69f3e81

28 files changed

+34
-3
lines changed

libraries/EEPROM/EEPROM.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ extern "C" {
3030
#include "spi_flash.h"
3131
}
3232

33-
extern "C" uint32_t _FS_end;
33+
extern "C" uint32_t _EEPROM_start;
3434

3535
EEPROMClass::EEPROMClass(uint32_t sector)
3636
: _sector(sector)
@@ -41,7 +41,7 @@ EEPROMClass::EEPROMClass(uint32_t sector)
4141
}
4242

4343
EEPROMClass::EEPROMClass(void)
44-
: _sector((((uint32_t)&_FS_end - 0x40200000) / SPI_FLASH_SEC_SIZE))
44+
: _sector((((uint32_t)&_EEPROM_start - 0x40200000) / SPI_FLASH_SEC_SIZE))
4545
, _data(0)
4646
, _size(0)
4747
, _dirty(false)

package/package_esp8266com_index.template.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -359,4 +359,4 @@
359359
]
360360
}
361361
]
362-
}
362+
}

tools/boards.txt.py

+6
Original file line numberDiff line numberDiff line change
@@ -1181,6 +1181,11 @@ def flash_map (flashsize_kb, fs_kb = 0):
11811181
rfcal_size_kb = 4
11821182
sdkwifi_size_kb = 12
11831183
fs_end = (flashsize_kb - sdkwifi_size_kb - rfcal_size_kb - eeprom_size_kb) * 1024
1184+
1185+
# For legacy reasons (#6531), the EEPROM sector needs to be at the old
1186+
# FS_end calculated without regards to block size
1187+
eeprom_start = fs_end
1188+
11841189
rfcal_addr = (flashsize_kb - sdkwifi_size_kb - rfcal_size_kb) * 1024
11851190
if flashsize_kb <= 1024:
11861191
max_upload_size = (flashsize_kb - (fs_kb + eeprom_size_kb + rfcal_size_kb + sdkwifi_size_kb)) * 1024 - reserved
@@ -1264,6 +1269,7 @@ def flash_map (flashsize_kb, fs_kb = 0):
12641269
print("PROVIDE ( _FS_end = 0x%08X );" % (0x40200000 + fs_end))
12651270
print("PROVIDE ( _FS_page = 0x%X );" % page)
12661271
print("PROVIDE ( _FS_block = 0x%X );" % fs_blocksize)
1272+
print("PROVIDE ( _EEPROM_start = 0x%08x );" % (0x40200000 + eeprom_start))
12671273
print("")
12681274
print('INCLUDE "local.eagle.app.v6.common.ld"')
12691275

tools/sdk/ld/eagle.flash.16m14m.ld

+1
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,6 @@ PROVIDE ( _FS_start = 0x40400000 );
1818
PROVIDE ( _FS_end = 0x411FA000 );
1919
PROVIDE ( _FS_page = 0x100 );
2020
PROVIDE ( _FS_block = 0x2000 );
21+
PROVIDE ( _EEPROM_start = 0x411fb000 );
2122

2223
INCLUDE "local.eagle.app.v6.common.ld"

tools/sdk/ld/eagle.flash.16m15m.ld

+1
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,6 @@ PROVIDE ( _FS_start = 0x40300000 );
1818
PROVIDE ( _FS_end = 0x411FA000 );
1919
PROVIDE ( _FS_page = 0x100 );
2020
PROVIDE ( _FS_block = 0x2000 );
21+
PROVIDE ( _EEPROM_start = 0x411fb000 );
2122

2223
INCLUDE "local.eagle.app.v6.common.ld"

tools/sdk/ld/eagle.flash.1m.ld

+1
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,6 @@ PROVIDE ( _FS_start = 0x402FB000 );
1818
PROVIDE ( _FS_end = 0x402FB000 );
1919
PROVIDE ( _FS_page = 0x0 );
2020
PROVIDE ( _FS_block = 0x0 );
21+
PROVIDE ( _EEPROM_start = 0x402fb000 );
2122

2223
INCLUDE "local.eagle.app.v6.common.ld"

tools/sdk/ld/eagle.flash.1m128.ld

+1
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,6 @@ PROVIDE ( _FS_start = 0x402DB000 );
1818
PROVIDE ( _FS_end = 0x402FB000 );
1919
PROVIDE ( _FS_page = 0x100 );
2020
PROVIDE ( _FS_block = 0x1000 );
21+
PROVIDE ( _EEPROM_start = 0x402fb000 );
2122

2223
INCLUDE "local.eagle.app.v6.common.ld"

tools/sdk/ld/eagle.flash.1m144.ld

+1
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,6 @@ PROVIDE ( _FS_start = 0x402D7000 );
1818
PROVIDE ( _FS_end = 0x402FB000 );
1919
PROVIDE ( _FS_page = 0x100 );
2020
PROVIDE ( _FS_block = 0x1000 );
21+
PROVIDE ( _EEPROM_start = 0x402fb000 );
2122

2223
INCLUDE "local.eagle.app.v6.common.ld"

tools/sdk/ld/eagle.flash.1m160.ld

+1
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,6 @@ PROVIDE ( _FS_start = 0x402D3000 );
1818
PROVIDE ( _FS_end = 0x402FB000 );
1919
PROVIDE ( _FS_page = 0x100 );
2020
PROVIDE ( _FS_block = 0x1000 );
21+
PROVIDE ( _EEPROM_start = 0x402fb000 );
2122

2223
INCLUDE "local.eagle.app.v6.common.ld"

tools/sdk/ld/eagle.flash.1m192.ld

+1
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,6 @@ PROVIDE ( _FS_start = 0x402CB000 );
1818
PROVIDE ( _FS_end = 0x402FB000 );
1919
PROVIDE ( _FS_page = 0x100 );
2020
PROVIDE ( _FS_block = 0x1000 );
21+
PROVIDE ( _EEPROM_start = 0x402fb000 );
2122

2223
INCLUDE "local.eagle.app.v6.common.ld"

tools/sdk/ld/eagle.flash.1m256.ld

+1
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,6 @@ PROVIDE ( _FS_start = 0x402BB000 );
1818
PROVIDE ( _FS_end = 0x402FB000 );
1919
PROVIDE ( _FS_page = 0x100 );
2020
PROVIDE ( _FS_block = 0x1000 );
21+
PROVIDE ( _EEPROM_start = 0x402fb000 );
2122

2223
INCLUDE "local.eagle.app.v6.common.ld"

tools/sdk/ld/eagle.flash.1m512.ld

+1
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,6 @@ PROVIDE ( _FS_start = 0x4027B000 );
1818
PROVIDE ( _FS_end = 0x402FB000 );
1919
PROVIDE ( _FS_page = 0x100 );
2020
PROVIDE ( _FS_block = 0x2000 );
21+
PROVIDE ( _EEPROM_start = 0x402fb000 );
2122

2223
INCLUDE "local.eagle.app.v6.common.ld"

tools/sdk/ld/eagle.flash.1m64.ld

+1
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,6 @@ PROVIDE ( _FS_start = 0x402EB000 );
1818
PROVIDE ( _FS_end = 0x402FB000 );
1919
PROVIDE ( _FS_page = 0x100 );
2020
PROVIDE ( _FS_block = 0x1000 );
21+
PROVIDE ( _EEPROM_start = 0x402fb000 );
2122

2223
INCLUDE "local.eagle.app.v6.common.ld"

tools/sdk/ld/eagle.flash.2m.ld

+1
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,6 @@ PROVIDE ( _FS_start = 0x403FB000 );
1818
PROVIDE ( _FS_end = 0x403FB000 );
1919
PROVIDE ( _FS_page = 0x0 );
2020
PROVIDE ( _FS_block = 0x0 );
21+
PROVIDE ( _EEPROM_start = 0x403fb000 );
2122

2223
INCLUDE "local.eagle.app.v6.common.ld"

tools/sdk/ld/eagle.flash.2m128.ld

+1
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,6 @@ PROVIDE ( _FS_start = 0x403E0000 );
1818
PROVIDE ( _FS_end = 0x403FB000 );
1919
PROVIDE ( _FS_page = 0x100 );
2020
PROVIDE ( _FS_block = 0x1000 );
21+
PROVIDE ( _EEPROM_start = 0x403fb000 );
2122

2223
INCLUDE "local.eagle.app.v6.common.ld"

tools/sdk/ld/eagle.flash.2m1m.ld

+1
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,6 @@ PROVIDE ( _FS_start = 0x40300000 );
1818
PROVIDE ( _FS_end = 0x403FA000 );
1919
PROVIDE ( _FS_page = 0x100 );
2020
PROVIDE ( _FS_block = 0x2000 );
21+
PROVIDE ( _EEPROM_start = 0x403fb000 );
2122

2223
INCLUDE "local.eagle.app.v6.common.ld"

tools/sdk/ld/eagle.flash.2m256.ld

+1
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,6 @@ PROVIDE ( _FS_start = 0x403C0000 );
1818
PROVIDE ( _FS_end = 0x403FB000 );
1919
PROVIDE ( _FS_page = 0x100 );
2020
PROVIDE ( _FS_block = 0x1000 );
21+
PROVIDE ( _EEPROM_start = 0x403fb000 );
2122

2223
INCLUDE "local.eagle.app.v6.common.ld"

tools/sdk/ld/eagle.flash.2m512.ld

+1
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,6 @@ PROVIDE ( _FS_start = 0x40380000 );
1818
PROVIDE ( _FS_end = 0x403FA000 );
1919
PROVIDE ( _FS_page = 0x100 );
2020
PROVIDE ( _FS_block = 0x2000 );
21+
PROVIDE ( _EEPROM_start = 0x403fb000 );
2122

2223
INCLUDE "local.eagle.app.v6.common.ld"

tools/sdk/ld/eagle.flash.4m.ld

+1
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,6 @@ PROVIDE ( _FS_start = 0x405FB000 );
1818
PROVIDE ( _FS_end = 0x405FB000 );
1919
PROVIDE ( _FS_page = 0x0 );
2020
PROVIDE ( _FS_block = 0x0 );
21+
PROVIDE ( _EEPROM_start = 0x405fb000 );
2122

2223
INCLUDE "local.eagle.app.v6.common.ld"

tools/sdk/ld/eagle.flash.4m1m.ld

+1
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,6 @@ PROVIDE ( _FS_start = 0x40500000 );
1818
PROVIDE ( _FS_end = 0x405FA000 );
1919
PROVIDE ( _FS_page = 0x100 );
2020
PROVIDE ( _FS_block = 0x2000 );
21+
PROVIDE ( _EEPROM_start = 0x405fb000 );
2122

2223
INCLUDE "local.eagle.app.v6.common.ld"

tools/sdk/ld/eagle.flash.4m2m.ld

+1
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,6 @@ PROVIDE ( _FS_start = 0x40400000 );
1818
PROVIDE ( _FS_end = 0x405FA000 );
1919
PROVIDE ( _FS_page = 0x100 );
2020
PROVIDE ( _FS_block = 0x2000 );
21+
PROVIDE ( _EEPROM_start = 0x405fb000 );
2122

2223
INCLUDE "local.eagle.app.v6.common.ld"

tools/sdk/ld/eagle.flash.4m3m.ld

+1
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,6 @@ PROVIDE ( _FS_start = 0x40300000 );
1818
PROVIDE ( _FS_end = 0x405FA000 );
1919
PROVIDE ( _FS_page = 0x100 );
2020
PROVIDE ( _FS_block = 0x2000 );
21+
PROVIDE ( _EEPROM_start = 0x405fb000 );
2122

2223
INCLUDE "local.eagle.app.v6.common.ld"

tools/sdk/ld/eagle.flash.512k.ld

+1
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,6 @@ PROVIDE ( _FS_start = 0x4027B000 );
1818
PROVIDE ( _FS_end = 0x4027B000 );
1919
PROVIDE ( _FS_page = 0x0 );
2020
PROVIDE ( _FS_block = 0x0 );
21+
PROVIDE ( _EEPROM_start = 0x4027b000 );
2122

2223
INCLUDE "local.eagle.app.v6.common.ld"

tools/sdk/ld/eagle.flash.512k128.ld

+1
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,6 @@ PROVIDE ( _FS_start = 0x4025B000 );
1818
PROVIDE ( _FS_end = 0x4027B000 );
1919
PROVIDE ( _FS_page = 0x100 );
2020
PROVIDE ( _FS_block = 0x1000 );
21+
PROVIDE ( _EEPROM_start = 0x4027b000 );
2122

2223
INCLUDE "local.eagle.app.v6.common.ld"

tools/sdk/ld/eagle.flash.512k32.ld

+1
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,6 @@ PROVIDE ( _FS_start = 0x40273000 );
1818
PROVIDE ( _FS_end = 0x4027B000 );
1919
PROVIDE ( _FS_page = 0x100 );
2020
PROVIDE ( _FS_block = 0x1000 );
21+
PROVIDE ( _EEPROM_start = 0x4027b000 );
2122

2223
INCLUDE "local.eagle.app.v6.common.ld"

tools/sdk/ld/eagle.flash.512k64.ld

+1
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,6 @@ PROVIDE ( _FS_start = 0x4026B000 );
1818
PROVIDE ( _FS_end = 0x4027B000 );
1919
PROVIDE ( _FS_page = 0x100 );
2020
PROVIDE ( _FS_block = 0x1000 );
21+
PROVIDE ( _EEPROM_start = 0x4027b000 );
2122

2223
INCLUDE "local.eagle.app.v6.common.ld"

tools/sdk/ld/eagle.flash.8m6m.ld

+1
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,6 @@ PROVIDE ( _FS_start = 0x40400000 );
1818
PROVIDE ( _FS_end = 0x409FA000 );
1919
PROVIDE ( _FS_page = 0x100 );
2020
PROVIDE ( _FS_block = 0x2000 );
21+
PROVIDE ( _EEPROM_start = 0x409fb000 );
2122

2223
INCLUDE "local.eagle.app.v6.common.ld"

tools/sdk/ld/eagle.flash.8m7m.ld

+1
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,6 @@ PROVIDE ( _FS_start = 0x40300000 );
1818
PROVIDE ( _FS_end = 0x409FA000 );
1919
PROVIDE ( _FS_page = 0x100 );
2020
PROVIDE ( _FS_block = 0x2000 );
21+
PROVIDE ( _EEPROM_start = 0x409fb000 );
2122

2223
INCLUDE "local.eagle.app.v6.common.ld"

0 commit comments

Comments
 (0)