Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using LittleFS with ESP32 but app still with SPIFFS+LittleFS #472

Closed
Hieromon opened this issue Mar 2, 2022 Discussed in #471 · 1 comment · Fixed by #473
Closed

Using LittleFS with ESP32 but app still with SPIFFS+LittleFS #472

Hieromon opened this issue Mar 2, 2022 Discussed in #471 · 1 comment · Fixed by #473
Labels
enhancement New feature or request fixed The issue has been resolved

Comments

@Hieromon
Copy link
Owner

Hieromon commented Mar 2, 2022

Discussed in #471

Originally posted by HankLloydRight March 2, 2022
Hello,
I've converted my main ESP32 app to use LittleFS instead of SPIFFS, which is working great. But I still see SPIFFS being compiled in the dependency tree due to AutoConnect and Pagebuilder:

-- <LittleFS_esp32> 1.0.6
|   |-- <FS> 1.0
|-- <AutoConnect> 1.3.3
|   |-- <PageBuilder> 1.5.2
|   |   |-- <FS> 1.0
|   |   |-- <LittleFS_esp32> 1.0.6
|   |   |   |-- <FS> 1.0
|   |   |-- <SPIFFS> 1.0
|   |   |   |-- <FS> 1.0
|   |   |-- <WebServer> 1.0
|   |   |   |-- <WiFi> 1.0
|   |   |   |-- <FS> 1.0
|   |   |-- <WiFi> 1.0
|   |-- <ArduinoJson> 6.19.2
|   |-- <DNSServer> 1.1.0
|   |   |-- <WiFi> 1.0
|   |-- <EEPROM> 1.0.3
|   |-- <WebServer> 1.0
|   |   |-- <WiFi> 1.0
|   |   |-- <FS> 1.0
|   |-- <WiFi> 1.0
|   |-- <Preferences> 1.0
|   |-- <LittleFS_esp32> 1.0.6
|   |   |-- <FS> 1.0
|   |-- <FS> 1.0
|   |-- <SPIFFS> 1.0
|   |   |-- <FS> 1.0
|   |-- <Update> 1.0
|   |-- <Ticker> 1.1
|   |-- <HTTPClient> 1.2
|   |   |-- <WiFi> 1.0
|   |   |-- <WiFiClientSecure> 1.0
|   |   |   |-- <WiFi> 1.0
|   |-- <HTTPUpdate> 1.3
|   |   |-- <HTTPClient> 1.2
|   |   |   |-- <WiFi> 1.0
|   |   |   |-- <WiFiClientSecure> 1.0
|   |   |   |   |-- <WiFi> 1.0
|   |   |-- <Update> 1.0
|   |   |-- <WiFi> 1.0
|   |-- <SD(esp32)> 1.0.5
|   |   |-- <FS> 1.0
|   |   |-- <SPI> 1.0
|   |-- <SPI> 1.0
|-- <SD_MMC> 1.0
|   |-- <FS> 1.0
|-- <NimBLE-Arduino> 1.3.7
|-- <Preferences> 1.0
|-- <ESP8266 and ESP32 OLED driver for SSD1306 displays> 4.2.1
|   |-- <SPI> 1.0
|   |-- <Wire> 1.0.1

The code compiles clean and runs great, even with both SPIFFS and LITTLEFS in the tree. I'd like to figure out how to not have SPIFFS compiled into the code, hopefully freeing up some code and stack memory. For the record, I am not using any of the Autoconnect features of uploading files or custom web pages that actually need to write to the local FS.

I've read this entire page: https://hieromon.github.io/AutoConnect/filesystem.html#selecting-appropriate-filesystem and I've added this to my platformio.ini file:

board_build.filesystem = littlefs   ; was already there
lib_ldf_mode=deep
build_flags =
    -DAC_USE_LITTLEFS
    -DPB_USE_LITTLEFS

But when I do that, I get a long list of compile errors (see below). I've search and search and tried everything I could find, but can't figure out how to get this to compile with only LITTLEFS. I'm sure it's probably one little thing that's triggering all these errors, but I sure can't figure it out. Help me Hieromon, you're my only hope!

Thank you, and thank you for your awesome library!

-HLR

.pio\libdeps\lolin32\AutoConnect\src/AutoConnectFS.h:60:47: error: 'LittleFSFS' in namespace 'fs' does not name a type
 #define AUTOCONNECT_APPLIED_FILECLASS     fs::LittleFSFS

.pio\libdeps\lolin32\AutoConnect\src/AutoConnectFS.h:66:14: note: in expansion of macro 'AUTOCONNECT_APPLIED_FILECLASS'
   using FS = AUTOCONNECT_APPLIED_FILECLASS;

.pio\libdeps\lolin32\AutoConnect\src/AutoConnectFS.h:67:41: error: 'AutoConnectFS::_isMounted' declared as an 'inline' variable
   inline bool _isMounted(AutoConnectFS::FS* filesystem) {

.pio\libdeps\lolin32\AutoConnect\src/AutoConnectFS.h:67:26: error: 'FS' is not a member of 'AutoConnectFS'
   inline bool _isMounted(AutoConnectFS::FS* filesystem) {
                          ^
.pio\libdeps\lolin32\AutoConnect\src/AutoConnectFS.h:67:26: note: suggested alternatives:
In file included from .pio\libdeps\lolin32\LittleFS_esp32\src/LITTLEFS.h:17:0,
                 from src\main.h:4,
                 from src\ILDAC-WIFI.cpp:2:
C:\.platformio\packages\framework-arduinoespressif32\libraries\FS\src/FS.h:86:7: note:   'fs::FS'
 class FS
       ^
C:\.platformio\packages\framework-arduinoespressif32\libraries\FS\src/FS.h:86:7: note:   'fs::FS'
In file included from .pio\libdeps\lolin32\AutoConnect\src/AutoConnectOTA.h:25:0,
                 from .pio\libdeps\lolin32\AutoConnect\src/AutoConnect.h:39,
                 from src\main.h:40,
.pio\libdeps\lolin32\AutoConnect\src/AutoConnectFS.h:67:45: error: 'filesystem' was not declared in this scope
   inline bool _isMounted(AutoConnectFS::FS* filesystem) {
.pio\libdeps\lolin32\AutoConnect\src/AutoConnectFS.h:67:57: error: expected ',' or ';' before '{' token
   inline bool _isMounted(AutoConnectFS::FS* filesystem) {
In file included from .pio\libdeps\lolin32\AutoConnect\src/AutoConnect.h:39:0,
                 from src\main.h:40,
                 from src\ILDAC-WIFI.cpp:2:
.pio\libdeps\lolin32\AutoConnect\src/AutoConnectOTA.h:99:18: error: 'FS' in namespace 'AutoConnectFS' does not name a type
   AutoConnectFS::FS*  _fs;      /**< Filesystem for the native file uploading */
                  ^
In file included from .pio\libdeps\lolin32\AutoConnect\src/AutoConnectOTA.h:25:0,
                 from .pio\libdeps\lolin32\AutoConnect\src/AutoConnect.h:39,
                 from src\main.h:40,
                 from src\ILDAC-ILDA.cpp:1:
.pio\libdeps\lolin32\AutoConnect\src/AutoConnectFS.h:60:47: error: 'LittleFSFS' in namespace 'fs' does not name a type
 #define AUTOCONNECT_APPLIED_FILECLASS     fs::LittleFSFS
                                               ^
.pio\libdeps\lolin32\AutoConnect\src/AutoConnectFS.h:66:14: note: in expansion of macro 'AUTOCONNECT_APPLIED_FILECLASS'
   using FS = AUTOCONNECT_APPLIED_FILECLASS;
              ^
.pio\libdeps\lolin32\AutoConnect\src/AutoConnectFS.h:67:41: error: 'AutoConnectFS::_isMounted' declared as an 'inline' variable
   inline bool _isMounted(AutoConnectFS::FS* filesystem) {
                                         ^
.pio\libdeps\lolin32\AutoConnect\src/AutoConnectFS.h:67:26: error: 'FS' is not a member of 'AutoConnectFS'
   inline bool _isMounted(AutoConnectFS::FS* filesystem) {
                          ^
.pio\libdeps\lolin32\AutoConnect\src/AutoConnectFS.h:67:26: note: suggested alternatives:
In file included from .pio\libdeps\lolin32\LittleFS_esp32\src/LITTLEFS.h:17:0,
                 from src\main.h:4,
                 from src\ILDAC-ILDA.cpp:1:
C:\.platformio\packages\framework-arduinoespressif32\libraries\FS\src/FS.h:86:7: note:   'fs::FS'
 class FS
       ^
C:\.platformio\packages\framework-arduinoespressif32\libraries\FS\src/FS.h:86:7: note:   'fs::FS'
In file included from .pio\libdeps\lolin32\AutoConnect\src/AutoConnectOTA.h:25:0,
                 from .pio\libdeps\lolin32\AutoConnect\src/AutoConnect.h:39,
                 from src\main.h:40,
                 from src\ILDAC-ILDA.cpp:1:
.pio\libdeps\lolin32\AutoConnect\src/AutoConnectFS.h:67:45: error: 'filesystem' was not declared in this scope
   inline bool _isMounted(AutoConnectFS::FS* filesystem) {
                                             ^
In file included from .pio\libdeps\lolin32\AutoConnect\src/AutoConnectOTA.h:25:0,
                 from .pio\libdeps\lolin32\AutoConnect\src/AutoConnect.h:39,
                 from src\main.h:40,
                 from src\ILDAC-BLE.cpp:2:
.pio\libdeps\lolin32\AutoConnect\src/AutoConnectFS.h:60:47: error: 'LittleFSFS' in namespace 'fs' does not name a type
 #define AUTOCONNECT_APPLIED_FILECLASS     fs::LittleFSFS
                                               ^
.pio\libdeps\lolin32\AutoConnect\src/AutoConnectFS.h:66:14: note: in expansion of macro 'AUTOCONNECT_APPLIED_FILECLASS'
   using FS = AUTOCONNECT_APPLIED_FILECLASS;
              ^
.pio\libdeps\lolin32\AutoConnect\src/AutoConnectFS.h:67:41: error: 'AutoConnectFS::_isMounted' declared as an 'inline' variable
   inline bool _isMounted(AutoConnectFS::FS* filesystem) {
                                         ^
.pio\libdeps\lolin32\AutoConnect\src/AutoConnectFS.h:67:26: error: 'FS' is not a member of 'AutoConnectFS'
   inline bool _isMounted(AutoConnectFS::FS* filesystem) {
                          ^
.pio\libdeps\lolin32\AutoConnect\src/AutoConnectFS.h:67:26: note: suggested alternatives:
.pio\libdeps\lolin32\AutoConnect\src/AutoConnectFS.h:67:57: error: expected ',' or ';' before '{' token
   inline bool _isMounted(AutoConnectFS::FS* filesystem) {
                                                         ^
In file included from .pio\libdeps\lolin32\LittleFS_esp32\src/LITTLEFS.h:17:0,
                 from src\main.h:4,
                 from src\ILDAC-BLE.cpp:2:
C:\.platformio\packages\framework-arduinoespressif32\libraries\FS\src/FS.h:86:7: note:   'fs::FS'
 class FS
       ^
C:\.platformio\packages\framework-arduinoespressif32\libraries\FS\src/FS.h:86:7: note:   'fs::FS'
In file included from .pio\libdeps\lolin32\AutoConnect\src/AutoConnectOTA.h:25:0,
                 from .pio\libdeps\lolin32\AutoConnect\src/AutoConnect.h:39,
                 from src\main.h:40,
                 from src\ILDAC-BLE.cpp:2:
.pio\libdeps\lolin32\AutoConnect\src/AutoConnectFS.h:67:45: error: 'filesystem' was not declared in this scope
   inline bool _isMounted(AutoConnectFS::FS* filesystem) {
                                             ^
.pio\libdeps\lolin32\AutoConnect\src/AutoConnectFS.h:67:57: error: expected ',' or ';' before '{' token
   inline bool _isMounted(AutoConnectFS::FS* filesystem) {
                                                         ^
In file included from .pio\libdeps\lolin32\AutoConnect\src/AutoConnect.h:39:0,
                 from src\main.h:40,
                 from src\ILDAC-BLE.cpp:2:
.pio\libdeps\lolin32\AutoConnect\src/AutoConnectOTA.h:99:18: error: 'FS' in namespace 'AutoConnectFS' does not name a type
   AutoConnectFS::FS*  _fs;      /**< Filesystem for the native file uploading */
                  ^
In file included from .pio\libdeps\lolin32\AutoConnect\src/AutoConnect.h:39:0,
                 from src\main.h:40,
                 from src\ILDAC-ILDA.cpp:1:
.pio\libdeps\lolin32\AutoConnect\src/AutoConnectOTA.h:99:18: error: 'FS' in namespace 'AutoConnectFS' does not name a type
   AutoConnectFS::FS*  _fs;      /**< Filesystem for the native file uploading */
                  ^
In file included from src\main.h:11:0,
                 from src\ILDAC-WIFI.cpp:2:
src\icons.h:27:16: warning: 'bluetooth_bits' defined but not used [-Wunused-variable]
 static uint8_t bluetooth_bits[] = {
                ^
In file included from .pio\libdeps\lolin32\AutoConnect\src/AutoConnectOTA.h:25:0,
                 from .pio\libdeps\lolin32\AutoConnect\src/AutoConnect.h:39,
                 from src\main.h:40,
                 from src\main.cpp:5:
.pio\libdeps\lolin32\AutoConnect\src/AutoConnectFS.h:60:47: error: 'LittleFSFS' in namespace 'fs' does not name a type
 #define AUTOCONNECT_APPLIED_FILECLASS     fs::LittleFSFS
                                               ^
.pio\libdeps\lolin32\AutoConnect\src/AutoConnectFS.h:66:14: note: in expansion of macro 'AUTOCONNECT_APPLIED_FILECLASS'
   using FS = AUTOCONNECT_APPLIED_FILECLASS;
              ^
.pio\libdeps\lolin32\AutoConnect\src/AutoConnectFS.h:67:41: error: 'AutoConnectFS::_isMounted' declared as an 'inline' variable
   inline bool _isMounted(AutoConnectFS::FS* filesystem) {
                                         ^
.pio\libdeps\lolin32\AutoConnect\src/AutoConnectFS.h:67:26: error: 'FS' is not a member of 'AutoConnectFS'
   inline bool _isMounted(AutoConnectFS::FS* filesystem) {
                          ^
.pio\libdeps\lolin32\AutoConnect\src/AutoConnectFS.h:67:26: note: suggested alternatives:
In file included from .pio\libdeps\lolin32\LittleFS_esp32\src/LITTLEFS.h:17:0,
                 from src\main.h:4,
                 from src\main.cpp:5:
C:\.platformio\packages\framework-arduinoespressif32\libraries\FS\src/FS.h:86:7: note:   'fs::FS'
 class FS
       ^
C:\.platformio\packages\framework-arduinoespressif32\libraries\FS\src/FS.h:86:7: note:   'fs::FS'
In file included from .pio\libdeps\lolin32\AutoConnect\src/AutoConnectOTA.h:25:0,
                 from .pio\libdeps\lolin32\AutoConnect\src/AutoConnect.h:39,
                 from src\main.h:40,
                 from src\main.cpp:5:
.pio\libdeps\lolin32\AutoConnect\src/AutoConnectFS.h:67:45: error: 'filesystem' was not declared in this scope
   inline bool _isMounted(AutoConnectFS::FS* filesystem) {
                                             ^
.pio\libdeps\lolin32\AutoConnect\src/AutoConnectFS.h:67:57: error: expected ',' or ';' before '{' token
   inline bool _isMounted(AutoConnectFS::FS* filesystem) {
                                                         ^
In file included from src\main.h:11:0,
                 from src\ILDAC-BLE.cpp:2:

In file included from .pio\libdeps\lolin32\AutoConnect\src/AutoConnect.h:39:0,
                 from src\main.h:40,
                 from src\main.cpp:5:
.pio\libdeps\lolin32\AutoConnect\src/AutoConnectOTA.h:99:18: error: 'FS' in namespace 'AutoConnectFS' does not name a type
   AutoConnectFS::FS*  _fs;      /**< Filesystem for the native file uploading */
                  ^

@Hieromon Hieromon added the enhancement New feature or request label Mar 2, 2022
@Hieromon
Copy link
Owner Author

Hieromon commented Mar 2, 2022

How to avoid the problem for now:

You will need to employ one of the following two methods. The following workarounds have their limitations. Those limitations will be lifted in the next release as AutoConnect v1.3.4 and PageBuilder v 1.5.3.

  1. Modify the AutoConnectFS.h and PageBuilder.h

    If you apply this fix, you will not be able to build sketches with the ESP32 Core 2.0 component or ESP8266 Core applied in the Arudino IDE. This will cause a compile error.


    #define AUTOCONNECT_APPLIED_FILESYSTEM LittleFS

    Change to:

    #define AUTOCONNECT_APPLIED_FILESYSTEM    LITTLEFS

    #define AUTOCONNECT_APPLIED_FILECLASS fs::LittleFSFS

    Change to:

    #define AUTOCONNECT_APPLIED_FILECLASS     fs::LITTLEFSFS

    https://github.com/Hieromon/PageBuilder/blob/944b9535addc5d5a24a0d124687a4ddfb15e2d35/src/PageBuilder.h#L93

    Change to:

    #define PB_APPLIED_FILESYSTEM             LITTLEFS

    https://github.com/Hieromon/PageBuilder/blob/944b9535addc5d5a24a0d124687a4ddfb15e2d35/src/PageBuilder.h#L95

    Change to:

    #define PB_APPLIED_FILECLASS              fs::LITTLEFSFS
  2. Modify the LITTLEFS.h, LITTLEFS.cpp in LittleFS_esp32 library source

    If you apply this fix, you will no longer be able to build your legacy sketches with the LittleFS_esp32 library applied. This will cause a compile error.


    https://github.com/lorol/LITTLEFS/blob/f0817ca5264745acce697092de2bf218b3aa5b2e/src/LITTLEFS.h#L22

    Change to:

    class LittleFSFS : public FS

    https://github.com/lorol/LITTLEFS/blob/f0817ca5264745acce697092de2bf218b3aa5b2e/src/LITTLEFS.h#L25-L26

    Change to:

    LittleFSFS();
    ~LittleFSFS();

    https://github.com/lorol/LITTLEFS/blob/f0817ca5264745acce697092de2bf218b3aa5b2e/src/LITTLEFS.h#L39

    Change to:

    extern fs::LittleFSFS LittleFS;

    https://github.com/lorol/LITTLEFS/blob/f0817ca5264745acce697092de2bf218b3aa5b2e/src/LITTLEFS.cpp#L48

    Change to:

    LittleFSFS::LittleFSFS() : FS(FSImplPtr(new LITTLEFSImpl())), partitionLabel_(NULL)

    https://github.com/lorol/LITTLEFS/blob/f0817ca5264745acce697092de2bf218b3aa5b2e/src/LITTLEFS.cpp#L52

    Change to:

    LittleFSFS::~LittleFSFS()

    https://github.com/lorol/LITTLEFS/blob/f0817ca5264745acce697092de2bf218b3aa5b2e/src/LITTLEFS.cpp#L97

    Change to:

    void LittleFSFS::end()

    https://github.com/lorol/LITTLEFS/blob/f0817ca5264745acce697092de2bf218b3aa5b2e/src/LITTLEFS.cpp#L109

    Change to:

    bool LittleFSFS::format()

    https://github.com/lorol/LITTLEFS/blob/f0817ca5264745acce697092de2bf218b3aa5b2e/src/LITTLEFS.cpp#L121

    Change to:

    size_t LittleFSFS::totalBytes()

    https://github.com/lorol/LITTLEFS/blob/f0817ca5264745acce697092de2bf218b3aa5b2e/src/LITTLEFS.cpp#L130

    Change to:

    size_t LittleFSFS::usedBytes()

    https://github.com/lorol/LITTLEFS/blob/f0817ca5264745acce697092de2bf218b3aa5b2e/src/LITTLEFS.cpp#L139

    Change to:

    LittleFSFS LittleFS;

@Hieromon Hieromon mentioned this issue Mar 5, 2022
@Hieromon Hieromon added the fixed The issue has been resolved label Jul 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request fixed The issue has been resolved
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant