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

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>
This commit is contained in:
Earle F. Philhower, III
2020-05-04 11:22:50 -07:00
committed by GitHub
parent 9845deb283
commit 83166f948b
40 changed files with 176 additions and 164 deletions

View File

@ -102,9 +102,9 @@ The web browser you're using to read this document keeps a list of 100s of certi
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.
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.
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.
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.
See the `BearSSL_CertStore` example for full details.
Supported Crypto
~~~~~~~~~~~~~~~~

View File

@ -42,23 +42,24 @@ Load client certificate from file system.
.. code:: cpp
#include <FS.h>
#include <LittleFS.h>
#include <ESP8266WiFi.h>
#include <WiFiClientSecure.h>
const char* certyficateFile = "/client.cer";
const char* certificateFile = "/client.cer";
*setup() or loop()*
.. code:: cpp
if (!SPIFFS.begin())
if (!LittleFS.begin())
{
Serial.println("Failed to mount the file system");
return;
}
Serial.printf("Opening %s", certyficateFile);
File crtFile = SPIFFS.open(certyficateFile, "r");
Serial.printf("Opening %s", certificateFile);
File crtFile = LittleFS.open(certificateFile, "r");
if (!crtFile)
{
Serial.println(" Failed!");
@ -66,7 +67,7 @@ Load client certificate from file system.
WiFiClientSecure client;
Serial.print("Loading %s", certyficateFile);
Serial.print("Loading %s", certificateFile);
if (!client.loadCertificate(crtFile))
{
Serial.println(" Failed!");