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

Add LittleFS as an optional filesystem, API compatible w/SPIFFS (but not on-flash-format compatible) #5511

Merged
merged 40 commits into from
May 25, 2019

Commits on Dec 26, 2018

  1. Add LittleFS as internal flash filesystem

    Adds a LittleFS object which uses the ARMmbed littlefs embedded filesystem,
    https://github.com/ARMmbed/littlefs, to enable a new filesystem for onboard
    flash utilizing the exact same API as the existing SPIFFS filesystem.
    
    LittleFS is built for low memory systems that are subject to random power
    losses, is actively supported by the ARMmbed community, supports directories,
    and seems to be much faster in the large-ish read-mostly applications I use.
    
    LittleFS, however, has a larger minimum file allocation unit and does not do
    static wear levelling.  This means that for systems that need many little
    files (<4K), have small SPIFFS areas (64K), or which have a large static
    set of files covering the majority of flash coupled with a frequently
    updated set of other files, it may not perform as well.
    
    Simply replace SPIFFS.begin() with LittleFS.begin() in your sketch,
    use LittleFS.open in place of SPIFFS.open to open files, and everything
    else just works thanks to the magic of @igrr's File base class.
    
    **LITTLEFS FLASH LAYOUT IS INCOMPATIBLE WITH SPIFFS**
    Since it is a completely different filesystem, you will need to reformat
    your flash (and lose any data therein) to use it. Tools to build the
    flash filesystem and upload are at
    https://github.com/earlephilhower/arduino-esp8266littlefs-plugin and
    https://github.com/earlephilhower/mklittlefs/ .  The mklittlefs tool
    is installed as part of the Arduino platform installation, automatically.
    
    The included example shows a contrived read-mostly example and
    demonstrates how the same calls work on either SPIFFS.* or LittleFS.*
    Host tests are also included as part of CI.
    
    Directories are fully supported in LittleFS. This means that LittleFS
    will have a slight difference vs. SPIFFS when you use
    LittleFS.openDir()/Dir.next().  On SPIFFS dir.next()
    will return all filesystem entries, including ones in "subdirs"
    (because in SPIFFS there are no subdirs and "/" is the same as any
    other character in a filename).
    
    On LittleFS, dir.next() will only return entries in the directory
    specified, not subdirs.  So to list files in "/subdir/..." you need
    to actually openDir("/subdir") and use Dir.next() to parse through
    just those elements.  The returned filenames also only have the
    filename returned, not full paths.  So on a FS with "/a/1", "/a/2"
    when you do openDir("/a"); dir.next().getName(); you get "1" and "2"
    and not "/a/1" and "/a/2" like in SPIFFS.  This is consistent with
    POSIX ideas about reading directories and more natural for a FS.
    
    Most code will not be affected by this, but if you depend on
    openDir/Dir.next() you need to be aware of it.
    
    Corresponding ::mkdir, ::rmdir, ::isDirectory, ::isFile,
    ::openNextFile, and ::rewind methods added to Filesystem objects.
    Documentation has been updated with this and other LittleFS information.
    
    Subdirectories are made silently when they do not exist when you
    try and create a file in a subdir.  They are silently removed when
    the last file in them is deleted.  This is consistent with what
    SPIFFS does but is obviously not normal POSIX behavior.  Since there
    has never been a "FS.mkdir()" method this is the only way to be
    compatible with legacy SPIFFS code.
    
    SPIFFS code has been refactored to pull out common flash_hal_* ops
    and placed in its own namespace, like LittleFS.
    earlephilhower committed Dec 26, 2018
    Configuration menu
    Copy the full SHA
    cd03a6f View commit details
    Browse the repository at this point in the history

Commits on Jan 7, 2019

  1. Configuration menu
    Copy the full SHA
    3d24167 View commit details
    Browse the repository at this point in the history
  2. Fix up merge blank line issue

    Earle F. Philhower, III authored and Earle F. Philhower, III committed Jan 7, 2019
    Configuration menu
    Copy the full SHA
    c22b9d4 View commit details
    Browse the repository at this point in the history
  3. Merge in the FSConfig changs from SDFS PR

    Enable setConfig for LittleFS as well plys merge the SPIFFS changes
    done in the SDFS PR.
    Earle F. Philhower, III authored and Earle F. Philhower, III committed Jan 7, 2019
    Configuration menu
    Copy the full SHA
    a42bc48 View commit details
    Browse the repository at this point in the history

Commits on Jan 9, 2019

  1. Configuration menu
    Copy the full SHA
    8016386 View commit details
    Browse the repository at this point in the history

Commits on Feb 27, 2019

  1. Configuration menu
    Copy the full SHA
    4acc649 View commit details
    Browse the repository at this point in the history
  2. Fix merge errors

    earlephilhower committed Feb 27, 2019
    Configuration menu
    Copy the full SHA
    e3e8de3 View commit details
    Browse the repository at this point in the history

Commits on Mar 1, 2019

  1. Update to use v2-alpha branch

    The V2-alpha branch supports small file optimizations which can help
    increase the utilization of flash when small files are prevalent.
    It also adds support for metadata, which means we can start adding
    things like file creation times, if desired (not yet).
    earlephilhower committed Mar 1, 2019
    Configuration menu
    Copy the full SHA
    13e985c View commit details
    Browse the repository at this point in the history

Commits on Apr 11, 2019

  1. Configuration menu
    Copy the full SHA
    3340b95 View commit details
    Browse the repository at this point in the history
  2. Update test to support non-creation-ordered files

    In a directory, the order in which "readNextFile()" will return a name
    is undefined.  SPIFFS may return it in order, but LittleFS does not as
    of V2.  Update the test to look for files by name when doing
    readNextFile() testing.
    earlephilhower committed Apr 11, 2019
    Configuration menu
    Copy the full SHA
    31e925a View commit details
    Browse the repository at this point in the history
  3. Merge branch 'master' of https://github.com/esp8266/Arduino into litt…

    …lefs
    
    Everything compiles, but host tests do not yet pass.
    
    Add LittleFS.truncate() method.
    
    Add SDFS test to cover all SPIFFS/LittleFS ones.
    earlephilhower committed Apr 11, 2019
    Configuration menu
    Copy the full SHA
    49f4618 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    ddafe05 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    da1383c View commit details
    Browse the repository at this point in the history

Commits on Apr 12, 2019

  1. Fix SDFS tests

    SDFS, SPIFFS, and LittleFS now all share the same common set of tests,
    greatly increasing the SDFS test coverage.
    earlephilhower committed Apr 12, 2019
    Configuration menu
    Copy the full SHA
    d7fe68d View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    90ea0ba View commit details
    Browse the repository at this point in the history
  3. Update to point to mklittlefs v2

    Upgrade mklittlefs to V2 format support
    earlephilhower committed Apr 12, 2019
    Configuration menu
    Copy the full SHA
    c3ac058 View commit details
    Browse the repository at this point in the history
  4. Remove extra FS::write(const char *s) method

    This was removed in esp8266#5861 and erroneously re-introduced here.
    earlephilhower committed Apr 12, 2019
    Configuration menu
    Copy the full SHA
    e3e6860 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    4a827a5 View commit details
    Browse the repository at this point in the history

Commits on Apr 14, 2019

  1. Dramatically reduce memory usage

    Reduce the program and read chunk sizes which impacts performance
    minimally but reduces per-file RAM usage of 16KB to <1KB.
    earlephilhower committed Apr 14, 2019
    Configuration menu
    Copy the full SHA
    0874498 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    6b33dcf View commit details
    Browse the repository at this point in the history

Commits on Apr 15, 2019

  1. Configuration menu
    Copy the full SHA
    dc3e14a View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    7435409 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    6f9ac16 View commit details
    Browse the repository at this point in the history

Commits on Apr 18, 2019

  1. Configuration menu
    Copy the full SHA
    9d2ffed View commit details
    Browse the repository at this point in the history
  2. Fix free space reporting

    Thanks to @TD-er for discovering the issue
    earlephilhower committed Apr 18, 2019
    Configuration menu
    Copy the full SHA
    78fbb64 View commit details
    Browse the repository at this point in the history

Commits on Apr 23, 2019

  1. Configuration menu
    Copy the full SHA
    88a9cf6 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    c0594ef View commit details
    Browse the repository at this point in the history

Commits on May 1, 2019

  1. Configuration menu
    Copy the full SHA
    7bdfaf0 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    fbe1d48 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    f0fb051 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    d1666e5 View commit details
    Browse the repository at this point in the history

Commits on May 2, 2019

  1. Configuration menu
    Copy the full SHA
    8e732d2 View commit details
    Browse the repository at this point in the history

Commits on May 12, 2019

  1. Configuration menu
    Copy the full SHA
    e7d5a45 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    a70facc View commit details
    Browse the repository at this point in the history

Commits on May 13, 2019

  1. Configuration menu
    Copy the full SHA
    a6d17e3 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    3ab6d76 View commit details
    Browse the repository at this point in the history

Commits on May 17, 2019

  1. Configuration menu
    Copy the full SHA
    e016613 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    edbd1ba View commit details
    Browse the repository at this point in the history

Commits on May 20, 2019

  1. Configuration menu
    Copy the full SHA
    bd57b00 View commit details
    Browse the repository at this point in the history

Commits on May 24, 2019

  1. Configuration menu
    Copy the full SHA
    bf06492 View commit details
    Browse the repository at this point in the history