espressif / arduino-esp32

Arduino core for the ESP32
GNU Lesser General Public License v2.1
13.34k stars 7.36k forks source link

Embed littleFS #3765

Closed laercionit closed 4 years ago

laercionit commented 4 years ago

Hello .. Good night. I've been designing an aquarium controller for a few years. I currently use ESP8266, the code has already been ported and adapted to run on ESP32. Fantastic speed and differences between MCUs.

I'm still using SPIFFS in ESP32, because I didn't see anything native to LITTLEFS. By my studies it is more reliable and I have been using it for some time on ESP8266.

Any chance of LITTLEFS being incorporated into the CORE ARDUINO ESP32?

beegee-tokyo commented 4 years ago

Not sure if anybody works on that. You can try the esp32_littleflash But I didn't try that yet.

laercionit commented 4 years ago

LittleFS is much more robust than SPIFFS, does not lose formatting due to power failure. Currently it is already incorporated in ESP8266, as it is something far superior and I see that the ESP32 CORE has advanced, I found it coherent to know if there were plans to develop native Data Upload by IDE and even partition with this type of configuration.

zekageri commented 4 years ago

It would be cool if someone would port it to esp32. SPIFFS is limited if we use 16mb esp32s. I have to use a 7mb ota 7mb app and 1mb flash because the slowness of the spiffs. :(

stale[bot] commented 4 years ago

[STALE_SET] This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.

JohnMacrae commented 4 years ago

It would be very welcome - not least for code portability reasons. :)

stale[bot] commented 4 years ago

[STALE_CLR] This issue has been removed from the stale queue. Please ensure activity to keep it openin the future.

sblantipodi commented 4 years ago

since SPIFFS has been deprecated on ESP8266, LittleFS should be integrated in ESP32. there is no reason to deprecate something on ESP8266 and leave it live on ESP32.

lbernstone commented 4 years ago

While it would be nice to have a port, littleFS is not supported in esp-idf, so is unlikely to become canon here, and it is not part of Arduino compatibility (the purpose of this project). The beauty of the Arduino model is that 3rd party libraries can come and go without putting the onus of maintenance on the chip manufacturers.

sblantipodi commented 4 years ago

and what is the sense of deprecating SPIFFS on ESP8266 and not on ESP32?

lbernstone commented 4 years ago

You will need to ask them. It may be deprecated on esp-idf eventually and replaced with LittleFS. At that point, it will be trivial to add to arduino. The ESP32 and ESP8266 projects are not welded together.

me-no-dev commented 4 years ago

wait... why should we care that 8266 crew deprecated SPIFFS and somehow follow them? I am really confused by such way of thinking. They did not bother to ask or discuss this with us. SPIFFS is supported in IDF and is supported here. LittleFS has nothing to do with it.

sblantipodi commented 4 years ago

are esp8266 and esp32 two separate products? aren't both espressif products? why do they have different support? thanks

me-no-dev commented 4 years ago

8266 Arduino is community supported. Everything else is Espressif. So, 8266 has and does it's own things when we talk Arduino. They do not sync with us and we do not with them. They run NonOS and we run FreeRTOS.

lorol commented 4 years ago

Hi, I managed to make it as a lib, please see this and comment your thoughts:

https://github.com/lorol/arduino-esp32littlefs-plugin https://github.com/lorol/LITTLEFS

Thank you

luc-github commented 4 years ago

@lorol so littleFS is slower than SPIFFS per your tests ?

lorol commented 4 years ago

@luc-github Writing to LITTLEFS is 4 times faster. Reading is slower. (on my simple test)

luc-github commented 4 years ago

Sorry I just noted the last number, the reading ones I will give a try - thank you

luc-github commented 4 years ago

@lorol I have tested with latest ESP32 git - I used the sample and adding time test and size display it works very well - thank you

.WiFi connected
IP address: 
192.168.1.30
Contacting Time Server

Now is : 2020-06-17 20:01:42

Listing directory: /
  FILE: /hello.txt  SIZE: 6  LAST WRITE: 2020-06-17 20:00:53
  FILE: /hello2.txt SIZE: 6  LAST WRITE: 2020-06-17 20:00:38
Writing file: /hello.txt
- file written
Appending to file: /hello.txt
- message appended
Reading file: /hello.txt
- read from file:
Hello World!
Renaming file /hello.txt to /foo.txt
- file renamed
Reading file: /foo.txt
- read from file:
Hello World!
Testing file I/O with /test.txt
- writing................................................................
 - 1048576 bytes written in 14731 ms
- reading................................................................
- 1048576 bytes read in 885 ms
Writing file: /hello.txt
- file written
Listing directory: /
  FILE: /foo.txt    SIZE: 14  LAST WRITE: 2020-06-17 20:01:42
  FILE: /hello.txt  SIZE: 6  LAST WRITE: 2020-06-17 20:01:58
  FILE: /hello2.txt SIZE: 6  LAST WRITE: 2020-06-17 20:00:38
  FILE: /test.txt   SIZE: 1048576  LAST WRITE: 2020-06-17 20:01:42
Deleting file: /foo.txt
- file deleted
Deleting file: /test.txt
- file deleted
Total: 1507328, Used: 8192
Test complete
lorol commented 4 years ago

Yes, you can compare the "feel" of running to SPIFFS. LITTLEFS looks faster overall. At least I like to be this way ... after so much time spent to make it working :)

luc-github commented 4 years ago

FYI to compare speed with ESP32 FAT also

Testing file I/O with /test.txt
- writing................................................................
 - 1048576 bytes written in 13057 ms
- reading................................................................
- 1048576 bytes read in 276 ms

Writing is pretty close = but for reading FatFS is still 1rst, may be LittleFS need some tunning to get better reading

lorol commented 4 years ago

@luc-github
See if your tests give similar results match these: https://github.com/joltwallet/esp_littlefs#performance My LITTLEFS implementation is basically a simple hack of joltwallet one, just an Arduino style :) I started with long painful way of recompiling through ESP-IDF (specific commit of v3.3, used the last time for Arduino esp32 core got ESP-IDF updated) then components ... but with source-only, just rearranged a bit, it works as well.

luc-github commented 4 years ago

the partition was not same size, I will redo tomorrow to compare properly

lorol commented 4 years ago

I don't expect FAT to be beaten on speed, anyway.

sblantipodi commented 4 years ago

once the job is finished and all works ok, why don't you open a pull request to ask espressif to insert this patch in the official SDK?

lorol commented 4 years ago

@ because I never made a PR yet :) and also as @me-no-dev said, ESP-IDF is not a community thing ... Code esp_littlefs project I used is actually an ESP-IDF component. The Arduino core can be plugged to the ESP-IDF as component too. It is a tricky combination between commercial and community effort and priorities. If it works as library - use it. I don't see problems.

lorol commented 4 years ago

@sblantipodi here you go: https://github.com/espressif/arduino-esp32/pull/4096

sblantipodi commented 4 years ago

@lorol congrats man

stale[bot] commented 4 years ago

[STALE_SET] This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.

stale[bot] commented 4 years ago

[STALE_DEL] This stale issue has been automatically closed. Thank you for your contributions.