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

Changes from SPIFFS to FS #2482

Closed
wants to merge 1 commit into from
Closed

Changes from SPIFFS to FS #2482

wants to merge 1 commit into from

Conversation

clumsy-stefan
Copy link
Contributor

Small change for people that want to use the esp8266 GIT core where they changed from SPIFFS to LittleFS. Still uses SPIFFS format though but some variables changed.
SPIFFS* => FS*
See also: esp8266/Arduino@a389a99

Small change for people that want to use the esp8266 GIT core where they changed from SPIFFS to LittleFS. Still uses SPIFFS format though but some variables changed. 
_SPIFFS_* => _FS_*
See also: esp8266/Arduino@a389a99
@clumsy-stefan
Copy link
Contributor Author

Sorry, I just saw, that @TD-er already has a PR for this... which is more sophisticated...;)

@TD-er
Copy link
Member

TD-er commented May 30, 2019

Could you also test my PR?
The LittleFS stuff should now be merged to the main branch (choose staging as platform), so it should be a lot easier to build now.

I did find some strange timing issues while appending to a file. See esp8266/Arduino#5932 (comment)

@clumsy-stefan
Copy link
Contributor Author

Just included the changes to be able to use GIT version, but never changed to the actual LitteFS format.
I tried to compile with your PR, but this seems only to work if you define LITTE_FS and therefore use LittleFS as storage format.
I guess the problem is if you want to use the new API but still keep SPIFFS format the #ifdef in ESPEasy-Globals.h are wrong (as there is no SPIFFS.* anymore)...
to keep backward compatibility I think you need to #define FILESYSTEMTYPE SPIFFS in define_plugin_sets.h no matter if LittleFS is included or not.... otherwise everybody would need to reformat their flash's as the FS'es are not compatible!
Still testing though..

@TD-er
Copy link
Member

TD-er commented May 30, 2019

Yep, that's why it hasn't been merged.
It was a quick test, but we should remain backwards compatibility for sure to be able to build using SPIFFS

@TD-er
Copy link
Member

TD-er commented May 30, 2019

Hmm, I could not imagine I did not think about that and looked at my PR.

#ifdef LITTLE_FS
#include "LittleFS.h"
extern "C" uint32_t _FS_start;
extern "C" uint32_t _FS_end;
extern "C" uint32_t _FS_page;
extern "C" uint32_t _FS_block;
#else
extern "C" uint32_t _SPIFFS_start;
extern "C" uint32_t _SPIFFS_end;
extern "C" uint32_t _SPIFFS_page;
extern "C" uint32_t _SPIFFS_block;
#endif

#ifdef LITTLE_FS
#define FILESYSTEMTYPE LittleFS
#else
#define FILESYSTEMTYPE SPIFFS
#endif

So it is possible to swap it by using simply a define to force using LittleFS.
Or did I miss something else?

@clumsy-stefan
Copy link
Contributor Author

yes to swap between the libraries, but as soon as LITTLE_FSis defined in define_plugin_sets.hit secelcs also LittleFS as filesysten (and not SPIFFS anymore (lines 59-64)...

However somethign does not seem to work, after installing this PR I get an exception:

INIT : Booting version: SMY_4.3 May 30 2019 10:39:26 (ESP82xx Core 455583b4, NONOS SDK 2.2.1(cfd48f3), LWIP: 2.1.2)
69 : INIT : Free RAM:32280
70 : INIT : Warm boot #38 - Restart Reason: Exception
72 : FS   : Mounting...
74 : FS   : Mount successful, used 16384 bytes of 1028096
RESET: Resetting factory defaults... using default settings
RESET: Warm boot, reset count: 3
RESET: Too many resets, protecting your flash memory (powercycle to solve this)
1391 : CRC  : program checksum       ...OK
1395 : FS   : Error while reading/writing config.dat in 785
PID:0
Version:0
INIT : Incorrect PID or version!
RESET: Resetting factory defaults... using default settings
RESET: Warm boot, reset count: 3
RESET: Too many resets, protecting your flash memory (powercycle to solve this)
Exception (0):
epc1=0x4000e25d epc2=0x00000000 epc3=0x40000f68 excvaddr=0x00000000 depc=0x00000000
>>>stack>>>
ctx: cont
sp: 3ffffd60 end: 3fffffc0 offset: 01a0
3fffff00:  4026522e 00000001 3fff447c 40265339
3fffff10:  00000000 0000001c 00000000 00000003
3fffff20:  3fff1279 00000001 3fff2854 3fff2854
3fffff30:  3fff1279 00000001 3fff2854 402609f0
3fffff40:  00000000 0000001c 00000000 402650ce
3fffff50:  4026424a 3fff1214 3fff1588 40206129
3fffff60:  3fff1279 3fff1214 3fff1588 402516b4
3fffff70:  00000000 00000000 ff260000 40265adc
3fffff80:  3fff4184 0030007f ffefeffe feefeffe
3fffff90:  feefeffe feefeffe feefeffe 3fff2978
3fffffa0:  3fffdad0 00000000 3fff2944 4026347c
3fffffb0:  feefeffe feefeffe 3ffe8748 401018d5
<<<stack<<<
 ets Jan  8 2013,rst cause:2, boot mode:(3,7)

@clumsy-stefan
Copy link
Contributor Author

I think you assume in your code changes that if LITTLE_FSis defined one is also using LittleFS as filesystem type... what I did is just using the new library from LittleFS but still keeping everything else at SPIFFS.... that's also why my changes only affected 5 lines in 2 files ;)

I guess we would need to adapt this to

  1. use old SPIFFS library
  2. use new library but old SPIFFS format
  3. use new library and new LittleFS format

IMHO

@TD-er
Copy link
Member

TD-er commented May 30, 2019

I don't see why option 2 should be a useful use case
The LittleFS wrapper is written as such to resemble the SPIFFS programming interface to make it an easy replacement.
But you should use only one type of filesystem on the SPI flash, so either SPIFFS or LittleFS.
You should decide at compile time and not at run time.

Or do you see a useful use case for option 2?

@clumsy-stefan
Copy link
Contributor Author

clumsy-stefan commented May 30, 2019

yes, if you switch FS type, you need to reformat (and therefore reconfigure) all your units... with case 2 you just stay with the old FS, keep all your configs but use the new library and new ESP core...

for me that's a point, as I have some 50 nodes running ;)

EDIT: but yes, only 1 should be used and decided at compile time!! absolutely agree on that!!
but starting with 2.6.0_dev only the new library and functions are available....

@TD-er
Copy link
Member

TD-er commented May 30, 2019

My idea was to only use LittleFS for builds which need a filesystem > 1 MB.
All current present builds have a filesystem of <= 1 MB
The only exception is the highly experimental 16 MB flash build, which is essentially useless because of the slow speed of SPIFFS on 14 MB filesystem.

@clumsy-stefan
Copy link
Contributor Author

this still does not solve backwards compatibility ;) and I think you should not force people to reformat their unit if not absolutely necessary.. IMHO..

I do have a number of 16MB Builds with 14MB SPIFFS, which is ok, for what I need.... I think no one will use such an arduino as a file-server ;)

@TD-er
Copy link
Member

TD-er commented May 30, 2019

The builds will have proper indicators showing the LittleFS filesystem, so I will not force people to format stuff.
Does that take away your worries?

@clumsy-stefan
Copy link
Contributor Author

clumsy-stefan commented May 30, 2019

I'm not too worried, I do my own builds anyways ;)

but how will you do that when the core is upgraded to the new version? then you can't use it as it is anymore as _SPIFFS_.* is not defined anymore... so eitehr you force the new LITTLE_FS define (for all new builds) and therefore LittleFS or you need to do other changes to make it compile again!

@TD-er
Copy link
Member

TD-er commented May 30, 2019

Oh, I didn't notice the SPIFFS part was removed from the core.
I just thought it was switched using a define, similar to what I was doing in the PR.

@clumsy-stefan
Copy link
Contributor Author

clumsy-stefan commented May 30, 2019

nope, it seems that the old SPIFFS part has completely vanished... That's why I did this PR in the first place, these 6 or so lines are the minimal change it needs to compile (and run/work) with esp core since commit esp8266/Arduino@a389a99

@clumsy-stefan
Copy link
Contributor Author

on a side note: since using core 2.5.2 or even the latest pre 2.6.0 git-version I have nearly no reboots/wd resets anymore! With my 20 or so "productive" nodes I'm down to a reboot of one individual node every few hours from once every half hour or so... uptimes are mostly a few days.... so I think there is a real advantage moving afap to the latest core...

@TD-er
Copy link
Member

TD-er commented May 31, 2019

Yep, the core 2.5.2 is really good.
I think we should move all builds (except for the 2.4.1 ones) to that core version and consider it the new main core

TD-er added a commit to TD-er/ESPEasy that referenced this pull request Jun 6, 2019
Core 2.6.x has changed _SPIFFS_* to _FS_*
See letscontrolit#2482
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants