Skip to content

Commit 83166f9

Browse files
Deprecate SPIFFS, move examples to LittleFS (#7263)
* Deprecate SPIFFS, move examples to LittleFS SPIFFS has been a great filesystem, but it has significant problems in many cases (and it's also pretty slow). Development seems to have slowed/stopped on the upstream version, and we're not able to provide support or fix the known issues with it as-is. Deprecate SPIFFS variable. Update all examples to use LittleFS instead of SPIFFS. Also, minor cleanup on very old examples which has obsolete delays waiting for the Serial port to come up, or which were stuck at 9600 baud because of their ancient AVR heritage. Fixes #7095 * Remove leftover debug code * Clean up comments in some examples * Update documentation on SPIFFS deprecation * Fix host tests to avoid deprecation warnings * Fix cut-n-paste error * Restore SpeedTest.ino, adjust to allow custom FSes Co-authored-by: Develo <deveyes@gmail.com>
1 parent 9845deb commit 83166f9

File tree

40 files changed

+176
-164
lines changed

40 files changed

+176
-164
lines changed

boards.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4960,15 +4960,15 @@ espinotee.menu.baud.3000000.upload.speed=3000000
49604960
wifinfo.name=WifInfo
49614961
wifinfo.build.board=WIFINFO
49624962
wifinfo.build.variant=wifinfo
4963-
wifinfo.menu.ESPModule.ESP07192=ESP07 (1M/192K SPIFFS)
4963+
wifinfo.menu.ESPModule.ESP07192=ESP07 (1M/192K FS)
49644964
wifinfo.menu.ESPModule.ESP07192.build.board=ESP8266_ESP07
49654965
wifinfo.menu.ESPModule.ESP07192.build.flash_ld=eagle.flash.1m192.ld
49664966
wifinfo.menu.ESPModule.ESP07192.build.flash_size=1M
49674967
wifinfo.menu.ESPModule.ESP07192.build.spiffs_blocksize=4096
49684968
wifinfo.menu.ESPModule.ESP07192.build.spiffs_end=0xFB000
49694969
wifinfo.menu.ESPModule.ESP07192.build.spiffs_start=0xCB000
49704970
wifinfo.menu.ESPModule.ESP07192.upload.maximum_size=827376
4971-
wifinfo.menu.ESPModule.ESP12=ESP12 (4M/1M SPIFFS)
4971+
wifinfo.menu.ESPModule.ESP12=ESP12 (4M/1M FS)
49724972
wifinfo.menu.ESPModule.ESP12.build.board=ESP8266_ESP12
49734973
wifinfo.menu.ESPModule.ESP12.build.flash_ld=eagle.flash.4m1m.ld
49744974
wifinfo.menu.ESPModule.ESP12.build.flash_size=4M

cores/esp8266/FS.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ using fs::SPIFFSConfig;
266266
#endif //FS_NO_GLOBALS
267267

268268
#if !defined(NO_GLOBAL_INSTANCES) && !defined(NO_GLOBAL_SPIFFS)
269-
extern fs::FS SPIFFS;
269+
extern fs::FS SPIFFS __attribute__((deprecated("SPIFFS has been deprecated. Please consider moving to LittleFS or other filesystems.")));
270270
#endif
271271

272272
#endif //FS_H

cores/esp8266/spiffs_api.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ int32_t spiffs_hal_read(uint32_t addr, uint32_t size, uint8_t *dst) {
3737
return flash_hal_read(addr, size, dst);
3838
}
3939

40-
41-
40+
#pragma GCC diagnostic push
41+
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
4242

4343
namespace spiffs_impl {
4444

@@ -149,6 +149,8 @@ extern "C" void spiffs_request_end(void)
149149
SPIFFS.end();
150150
}
151151

152+
#pragma GCC diagnostic pop
153+
152154
#endif // ARDUINO
153155
#endif // !CORE_MOCK
154156

cores/esp8266/spiffs_api.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ class SPIFFSImpl : public FSImpl
171171
return false;
172172
}
173173
_cfg = *static_cast<const SPIFFSConfig *>(&cfg);
174-
return true;
174+
return true;
175175
}
176176

177177
bool begin() override

doc/boards.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ Parameters in Arduino IDE:
344344
~~~~~~~~~~~~~~~~~~~~~~~~~~
345345

346346
- Card: "WEMOS D1 Mini Lite"
347-
- Flash Size: "1M (512K SPIFFS)"
347+
- Flash Size: "1M (512K FS)"
348348
- CPU Frequency: "80 Mhz"
349349

350350
Power:

doc/esp8266wifi/bearssl-client-secure-class.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,9 @@ The web browser you're using to read this document keeps a list of 100s of certi
102102

103103
In many cases your application will know the specific CA it needs to validate web or MQTT servers against (often just a single, self-signing CA private to your institution). Simply load your private CA in a `BearSSL::X509List` and use that as your trust anchor.
104104

105-
However, there are cases where you will not know beforehand which CA you will need (i.e. a user enters a website through a keypad), and you need to keep the list of CAs just like your web browser. In those cases, you need to generate a certificate bundle on the PC while compiling your application, upload the `certs.ar` bundle to SPIFFS or SD when uploading your application binary, and pass it to a `BearSSL::CertStore()` in order to validate TLS peers.
105+
However, there are cases where you will not know beforehand which CA you will need (i.e. a user enters a website through a keypad), and you need to keep the list of CAs just like your web browser. In those cases, you need to generate a certificate bundle on the PC while compiling your application, upload the `certs.ar` bundle to LittleFS or SD when uploading your application binary, and pass it to a `BearSSL::CertStore()` in order to validate TLS peers.
106106

107-
See the `BearSSL_CertStore` example for full details as the `BearSSL::CertStore` requires the creation of a cookie-cutter object for filesystem access (because the SD and SPIFFS filesystems are presently incompatible with each other). At a high level in your `setup()` you will call `BearSSL::initCertStore()` on a global object, and then pass this global certificate store to `client.setCertStore(&gCA)` before every connection attempt to enable it as a validation option.
107+
See the `BearSSL_CertStore` example for full details.
108108

109109
Supported Crypto
110110
~~~~~~~~~~~~~~~~

doc/esp8266wifi/client-secure-class.rst

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,31 +42,32 @@ Load client certificate from file system.
4242
.. code:: cpp
4343
4444
#include <FS.h>
45+
#include <LittleFS.h>
4546
#include <ESP8266WiFi.h>
4647
#include <WiFiClientSecure.h>
4748
48-
const char* certyficateFile = "/client.cer";
49+
const char* certificateFile = "/client.cer";
4950
5051
*setup() or loop()*
5152

5253
.. code:: cpp
5354
54-
if (!SPIFFS.begin())
55+
if (!LittleFS.begin())
5556
{
5657
Serial.println("Failed to mount the file system");
5758
return;
5859
}
5960
60-
Serial.printf("Opening %s", certyficateFile);
61-
File crtFile = SPIFFS.open(certyficateFile, "r");
61+
Serial.printf("Opening %s", certificateFile);
62+
File crtFile = LittleFS.open(certificateFile, "r");
6263
if (!crtFile)
6364
{
6465
Serial.println(" Failed!");
6566
}
6667
6768
WiFiClientSecure client;
6869
69-
Serial.print("Loading %s", certyficateFile);
70+
Serial.print("Loading %s", certificateFile);
7071
if (!client.loadCertificate(crtFile))
7172
{
7273
Serial.println(" Failed!");

doc/faq/readme.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ perform. It is not listed among libraries verified to work with ESP8266.
7979

8080
`Read more <a03-library-does-not-work.rst>`__.
8181

82-
In the IDE, for ESP-12E that has 4M flash, I can choose 4M (1M SPIFFS) or 4M (3M SPIFFS). No matter what I select, the IDE tells me the maximum code space is about 1M. Where does my flash go?
82+
In the IDE, for ESP-12E that has 4M flash, I can choose 4M (1M FS) or 4M (3M FS). No matter what I select, the IDE tells me the maximum code space is about 1M. Where does my flash go?
8383
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
8484

8585
The reason we cannot have more than 1MB of code in flash has to do with
@@ -90,7 +90,7 @@ total, but switching such "banks" on the fly is not easy and efficient,
9090
so we don't bother doing that. Besides, no one has so far complained
9191
about 1MB of code space being insufficient for practical purposes.
9292

93-
The option to choose 3M or 1M SPIFFS is to optimize the upload time.
93+
The option to choose 3M or 1M filesystem is to optimize the upload time.
9494
Uploading 3MB takes a long time so sometimes you can just use 1MB. Other
9595
2MB of flash can still be used with ``ESP.flashRead`` and
9696
``ESP.flashWrite`` APIs if necessary.

doc/filesystem.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,16 @@ following include to the sketch:
6363
6464
#include "FS.h"
6565
66+
SPIFFS Deprecation Warning
67+
--------------------------
68+
69+
SPIFFS is currently deprecated and may be removed in future releases of
70+
the core. Please consider moving your code to LittleFS. SPIFFS is not
71+
actively supported anymore by the upstream developer, while LittleFS is
72+
under active development, supports real directories, and is many times
73+
faster for most operations.
74+
75+
6676
SPIFFS and LittleFS
6777
-------------------
6878

doc/installing.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,6 @@ BeagleBone, CubieBoard).
244244
- `What is PlatformIO? <https://docs.platformio.org/en/latest/what-is-platformio.html?utm_source=arduino-esp8266>`__
245245
- `PlatformIO IDE <https://platformio.org/platformio-ide?utm_source=arduino-esp8266>`__
246246
- `PlatformIO Core <https://docs.platformio.org/en/latest/core.html?utm_source=arduino-esp8266>`__ (command line tool)
247-
- `Advanced usage <https://docs.platformio.org/en/latest/platforms/espressif8266.html?utm_source=arduino-esp8266>`__ - custom settings, uploading to SPIFFS, Over-the-Air (OTA), staging version
247+
- `Advanced usage <https://docs.platformio.org/en/latest/platforms/espressif8266.html?utm_source=arduino-esp8266>`__ - custom settings, uploading to LittleFS, Over-the-Air (OTA), staging version
248248
- `Integration with Cloud and Standalone IDEs <https://docs.platformio.org/en/latest/ide.html?utm_source=arduino-esp8266>`__ - Cloud9, Codeanywhere, Eclipse Che (Codenvy), Atom, CLion, Eclipse, Emacs, NetBeans, Qt Creator, Sublime Text, VIM, Visual Studio, and VSCode
249249
- `Project Examples <https://docs.platformio.org/en/latest/platforms/espressif8266.html?utm_source=arduino-esp8266#examples>`__

0 commit comments

Comments
 (0)