1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-06-12 01:53:07 +03:00

Make SPIFFS be an integer number of blocks (#5989)

* Make SPIFFS be an integer number of blocks

boards.txt.py simply calculated the end and start using flash sizes, but
in cases where an 8K page was used (>512KB SPIFFS), this could leave a
4K half-block left at the end of SPIFFS.

mkspiffs and the SPIFFS code uses integer division to calculate the
maximum block number, so it worked fine in practice and the code simply
ignored the extra, fractional block.

Now actually take block size into account when calculating the end of
SPIFFS, ensuring no fractional blocks are passed in.  Does not result in
data loss on pre-existing SPIFFS filesystems.

* Fix the 1m512 case and clean up code

Ensure that no SPIFFS_block in the LD files is modified from the
original to endure correct backwards compatibility

* Factor out common if, clean code

* Make boards.py vars "fs_xx" instead of "spiffs_xx"
This commit is contained in:
Earle F. Philhower, III
2019-07-09 01:24:25 -07:00
committed by david gauchard
parent adf2b14a6a
commit 828857d0e0
11 changed files with 129 additions and 130 deletions

View File

@ -1,7 +1,7 @@
/* Flash Split for 16M chips */
/* sketch @0x40200000 (~1019KB) (1044464B) */
/* empty @0x402FEFF0 (~1028KB) (1052688B) */
/* spiffs @0x40400000 (~14316KB) (14659584B) */
/* spiffs @0x40400000 (~14312KB) (14655488B) */
/* eeprom @0x411FB000 (4KB) */
/* rfcal @0x411FC000 (4KB) */
/* wifi @0x411FD000 (12KB) */
@ -15,7 +15,7 @@ MEMORY
}
PROVIDE ( _FS_start = 0x40400000 );
PROVIDE ( _FS_end = 0x411FB000 );
PROVIDE ( _FS_end = 0x411FA000 );
PROVIDE ( _FS_page = 0x100 );
PROVIDE ( _FS_block = 0x2000 );

View File

@ -1,7 +1,7 @@
/* Flash Split for 16M chips */
/* sketch @0x40200000 (~1019KB) (1044464B) */
/* empty @0x402FEFF0 (~4KB) (4112B) */
/* spiffs @0x40300000 (~15340KB) (15708160B) */
/* spiffs @0x40300000 (~15336KB) (15704064B) */
/* eeprom @0x411FB000 (4KB) */
/* rfcal @0x411FC000 (4KB) */
/* wifi @0x411FD000 (12KB) */
@ -15,7 +15,7 @@ MEMORY
}
PROVIDE ( _FS_start = 0x40300000 );
PROVIDE ( _FS_end = 0x411FB000 );
PROVIDE ( _FS_end = 0x411FA000 );
PROVIDE ( _FS_page = 0x100 );
PROVIDE ( _FS_block = 0x2000 );

View File

@ -1,7 +1,7 @@
/* Flash Split for 2M chips */
/* sketch @0x40200000 (~1019KB) (1044464B) */
/* empty @0x402FEFF0 (~4KB) (4112B) */
/* spiffs @0x40300000 (~1004KB) (1028096B) */
/* spiffs @0x40300000 (~1000KB) (1024000B) */
/* eeprom @0x403FB000 (4KB) */
/* rfcal @0x403FC000 (4KB) */
/* wifi @0x403FD000 (12KB) */
@ -15,7 +15,7 @@ MEMORY
}
PROVIDE ( _FS_start = 0x40300000 );
PROVIDE ( _FS_end = 0x403FB000 );
PROVIDE ( _FS_end = 0x403FA000 );
PROVIDE ( _FS_page = 0x100 );
PROVIDE ( _FS_block = 0x2000 );

View File

@ -1,7 +1,7 @@
/* Flash Split for 2M chips */
/* sketch @0x40200000 (~1019KB) (1044464B) */
/* empty @0x402FEFF0 (~516KB) (528400B) */
/* spiffs @0x40380000 (~492KB) (503808B) */
/* spiffs @0x40380000 (~488KB) (499712B) */
/* eeprom @0x403FB000 (4KB) */
/* rfcal @0x403FC000 (4KB) */
/* wifi @0x403FD000 (12KB) */
@ -15,7 +15,7 @@ MEMORY
}
PROVIDE ( _FS_start = 0x40380000 );
PROVIDE ( _FS_end = 0x403FB000 );
PROVIDE ( _FS_end = 0x403FA000 );
PROVIDE ( _FS_page = 0x100 );
PROVIDE ( _FS_block = 0x2000 );

View File

@ -1,7 +1,7 @@
/* Flash Split for 4M chips */
/* sketch @0x40200000 (~1019KB) (1044464B) */
/* empty @0x402FEFF0 (~2052KB) (2101264B) */
/* spiffs @0x40500000 (~1004KB) (1028096B) */
/* spiffs @0x40500000 (~1000KB) (1024000B) */
/* eeprom @0x405FB000 (4KB) */
/* rfcal @0x405FC000 (4KB) */
/* wifi @0x405FD000 (12KB) */
@ -15,7 +15,7 @@ MEMORY
}
PROVIDE ( _FS_start = 0x40500000 );
PROVIDE ( _FS_end = 0x405FB000 );
PROVIDE ( _FS_end = 0x405FA000 );
PROVIDE ( _FS_page = 0x100 );
PROVIDE ( _FS_block = 0x2000 );

View File

@ -1,7 +1,7 @@
/* Flash Split for 4M chips */
/* sketch @0x40200000 (~1019KB) (1044464B) */
/* empty @0x402FEFF0 (~1028KB) (1052688B) */
/* spiffs @0x40400000 (~2028KB) (2076672B) */
/* spiffs @0x40400000 (~2024KB) (2072576B) */
/* eeprom @0x405FB000 (4KB) */
/* rfcal @0x405FC000 (4KB) */
/* wifi @0x405FD000 (12KB) */
@ -15,7 +15,7 @@ MEMORY
}
PROVIDE ( _FS_start = 0x40400000 );
PROVIDE ( _FS_end = 0x405FB000 );
PROVIDE ( _FS_end = 0x405FA000 );
PROVIDE ( _FS_page = 0x100 );
PROVIDE ( _FS_block = 0x2000 );

View File

@ -1,7 +1,7 @@
/* Flash Split for 4M chips */
/* sketch @0x40200000 (~1019KB) (1044464B) */
/* empty @0x402FEFF0 (~4KB) (4112B) */
/* spiffs @0x40300000 (~3052KB) (3125248B) */
/* spiffs @0x40300000 (~3048KB) (3121152B) */
/* eeprom @0x405FB000 (4KB) */
/* rfcal @0x405FC000 (4KB) */
/* wifi @0x405FD000 (12KB) */
@ -15,7 +15,7 @@ MEMORY
}
PROVIDE ( _FS_start = 0x40300000 );
PROVIDE ( _FS_end = 0x405FB000 );
PROVIDE ( _FS_end = 0x405FA000 );
PROVIDE ( _FS_page = 0x100 );
PROVIDE ( _FS_block = 0x2000 );

View File

@ -1,7 +1,7 @@
/* Flash Split for 8M chips */
/* sketch @0x40200000 (~1019KB) (1044464B) */
/* empty @0x402FEFF0 (~1028KB) (1052688B) */
/* spiffs @0x40400000 (~6124KB) (6270976B) */
/* spiffs @0x40400000 (~6120KB) (6266880B) */
/* eeprom @0x409FB000 (4KB) */
/* rfcal @0x409FC000 (4KB) */
/* wifi @0x409FD000 (12KB) */
@ -15,7 +15,7 @@ MEMORY
}
PROVIDE ( _FS_start = 0x40400000 );
PROVIDE ( _FS_end = 0x409FB000 );
PROVIDE ( _FS_end = 0x409FA000 );
PROVIDE ( _FS_page = 0x100 );
PROVIDE ( _FS_block = 0x2000 );

View File

@ -1,7 +1,7 @@
/* Flash Split for 8M chips */
/* sketch @0x40200000 (~1019KB) (1044464B) */
/* empty @0x402FEFF0 (~4KB) (4112B) */
/* spiffs @0x40300000 (~7148KB) (7319552B) */
/* spiffs @0x40300000 (~7144KB) (7315456B) */
/* eeprom @0x409FB000 (4KB) */
/* rfcal @0x409FC000 (4KB) */
/* wifi @0x409FD000 (12KB) */
@ -15,7 +15,7 @@ MEMORY
}
PROVIDE ( _FS_start = 0x40300000 );
PROVIDE ( _FS_end = 0x409FB000 );
PROVIDE ( _FS_end = 0x409FA000 );
PROVIDE ( _FS_page = 0x100 );
PROVIDE ( _FS_block = 0x2000 );