Giter VIP home page Giter VIP logo

Comments (8)

lorol avatar lorol commented on July 19, 2024

Hi,
I will consider for future.
For your needs, you can keep the settings in different place, see:
https://github.com/espressif/arduino-esp32/tree/master/libraries/Preferences

from littlefs.

robcazzaro avatar robcazzaro commented on July 19, 2024

Thanks for considering the suggestion. And thanks for the pointer to the preferences nvs, which I had long forgotten about. I might be able to partition my data and save the portion of data that doesn't change frequently into nvs. I still believe that for things like logs, having dual SPIFFS partitions would be a nice-to-have for the future.

from littlefs.

lorol avatar lorol commented on July 19, 2024

For multiple data partitions, it should be worked at the core (FS) side. Especially for Arduino it will need some changes to work with more data partitions at same time. Have you seen similar projects with SPIFFS or FAT?

from littlefs.

robcazzaro avatar robcazzaro commented on July 19, 2024

There's an ESP32 Arduino library for multiple SPIFFS partitions https://github.com/lukaswagner/SPIFFS. Plus some information floating on how to do it using the Espressif SDK, e.g. https://esp32.com/viewtopic.php?t=12331.

It requires changing partitions.csv for the device, based on the size of flash memory (in that library, the needed partitions.csv is in the examples folder). It's also simplifying things by only allowing one mounted partition at a time which, if needed, is an acceptable tradeoff.

And I know it's going to sound hopelessly naive, but "it doesn't look like a lot of work" to make it work (says the clueless manager to the developer :). Just kidding... what I mean is that it doesn't seem to require a lot of changes at the system level, outside of having to change partitions.csv, which can be tricky. I think that asking the user to figure out partitions.csv based on their needs is an acceptable tradeoff: the people who need multiple partitions will have to figure out how to partition the SPIFFS portion of flash.

from littlefs.

lorol avatar lorol commented on July 19, 2024

@robcazzaro you can try yourself, this should be very similar to:
espressif/arduino-esp32@3cbfa2f#diff-d033864b5ea50ef1ee43c07dfc1ec7c828f4eff57dee791348fd66e6d588ac78

Just instead of NULL, use LFS_NAME as default name.
Also since LittleFS cannot work with NULL (the name is mandatory) you may skip few if's to check.

This way you should be able to pass different name so different partition.
In your sketch, keep the begin - end fs for only one "active" partition at a time.

If you succeed, just test it and do a PR :)

from littlefs.

robcazzaro avatar robcazzaro commented on July 19, 2024

Thanks! I'm finishing another part of the code right now, but as soon as I'm done, I'll definitely look into this and do a full writeup

from littlefs.

lorol avatar lorol commented on July 19, 2024

@robcazzaro and @tsctrl - Done (multiple partitions, custom name of partition)
Please test and let me know your thoughts.
For now, closing ...

from littlefs.

robcazzaro avatar robcazzaro commented on July 19, 2024

EDIT: I re-run the test with the previous version of LittleFS, and I get the same behavior, I'll open a new issue #27

First of all, thanks for adding this!
Second, apologies for taking this long to test it...

Good news is that it works very well!

I'm running a test, with a ESPAsyncWebserver on the main partition and data/logs on the second. I noticed a problem which I'm not sure it's caused by the new code

After resizing the partitions, the following code

// initalize second partition
  if (!LITTLEFS.begin(true, "/lfs2", 5, "part2"))
  {
    Serial.println("part2 failed! AutoFormatting.");
    return;
  }

results in an error message for both partitions

lib\LittleFS_esp32\lfs.c:1076:error: Corrupted dir pair at {0x0, 0x1}
E (234) esp_littlefs: mount failed,  (-84)
E (238) esp_littlefs: Failed to initialize LittleFS

I expected to see "part2 failed! AutoFormatting." instead (and the same for partition 1). When executing that code again without changing anything, it works as expected, since the partitions are now valid. It looks as if the code correctly formats an un-intialized partition, but doesn't return the correct error code

for what it's worth, here's my partition file

# Name,   Type, SubType, Offset,  Size, Flags
nvs,      data, nvs,     0x9000,  0x5000,
otadata,  data, ota,     0xe000,  0x2000,
app0,     app,  ota_0,   0x10000, 0x120000,
app1,     app,  ota_1,           ,0x120000,
spiffs,   data, spiffs,          ,0xD6000,
part2,    data, spiffs,          ,0xD6000,
#1179648

(yes, I know, the number after # on the last line is wrong, but doesn't seem to be used. And that I'm wasting some flash space, that was just a test)

from littlefs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.