Welcome to the Pycom forum Forum
    • \[\[global:header.categories\]\]
    • \[\[global:header.recent\]\]
    • \[\[global:header.tags\]\]
    • \[\[global:header.popular\]\]
    • Login

    Explore Pybytes | Official Documentation | Report a Firmware Bug/Issue | GitHub

    littleFS disadvantages?

    Scheduled Pinned Locked Moved Discussion
    9 Posts 5 Posters 178 Views 5 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • D Offline
      dgerman
      last edited by

      After reading https://forum.pycom.io/topic/5922/an-alternative-to-nvram_save-restore-using-the-sd-card
      I got concerned about FileSystem wearing since I have been writing a log file for debugging to FATFS /flash.
      Reading https://github.com/ARMmbed/littlefs make me think I (we all) should be using littleFS.

      1. Is there any reason not to use littleFS?
      2. Is there a way to inhibit updating the file timestamp? Since I include the time in the log entries the timestamp on the file uses unnecessary writes.
      3. Is there a way to tell the level of wear?
      4. Is changing the FIleSYstem as simple as "pycom.bootmgr(fs_type=pycom.LittleFS)"

      os.uname()
      (sysname='GPy', nodename='GPy', release='1.20.2.rc2', version='v1.11-605f40f on 2020-02-04', machine='GPy with ESP32', pybytes='1.3.1')

      robert-hhR 1 Reply Last reply Reply Quote 0
      • robert-hhR Offline
        robert-hh @dgerman
        last edited by

        @dgerman After changing the FStype in bootmgr, it's best to reinstall the firmware with the option to erase the file system first. That way you have a clean start. Just changing the type & restart may also be possible. I tested that once, but I forgot the result.
        From personal experience I cannot recommend using LittleFs, at least not in combination with ftp. I had quite a few system crashes and file corruptions with that. As far as I could tell, there are still memory allocation problems in LittleFs. FAT is rock solid.

        1 Reply Last reply Reply Quote 0
        • K Offline
          kjm
          last edited by

          Amazing that individual experiences can be so different Robert. My gpy was forever defaulting my deepsleeping boot.py back to the factory default null program till I swapped to LittleFS @ release 1.20.1.r1

          1 Reply Last reply Reply Quote 0
          • A Offline
            andreas
            last edited by

            Dear @dgerman,

            FatFS is known to corrupt the filesystem in brownout conditions [1], please use LittleFS. However, the LittleFS implementation of the official releases has some bugs, so we want to humbly direct you to our Squirrel firmware builds [2], which mitigate some important issues.

            Running that on our devices, we are pretty much satisified regarding overall runtime stability and robustness and have already been able to help others in this matter.

            With kind regards,
            Andreas.

            [1] https://community.hiveeyes.org/t/fipy-verliert-programm-nach-power-off-durch-leeren-lipo-file-system-corruption-through-brownout-conditions/2057
            [2] https://community.hiveeyes.org/t/squirrel-firmware-for-pycom-esp32/2960


            P.S.: Regarding your other questions:

            2. Is there a way to inhibit updating the file timestamp? Since I include the time in the log entries the timestamp on the file uses unnecessary writes.

            Not that I am aware of. You would have to change the baseline firmware on the C-Level.

            3. Is there a way to tell the level of wear?

            I don't believe so. However, others might have more insights on this matter.

            4. Is changing the FIleSYstem as simple as "pycom.bootmgr(fs_type=pycom.LittleFS)"

            We are using a make target like make format-flash, which essentially boils down to

            import uos, pycom
            pycom.bootmgr(fs_type=pycom.LittleFS, reset=True)
            uos.fsformat("/flash")
            
            D 1 Reply Last reply Reply Quote 0
            • D Offline
              dgerman @andreas
              last edited by

              @Andreas Thanks for your detailed and informative reply.
              Might my idea regarding suppressing timestamp updating be included somewhere as a new feature?

              A 1 Reply Last reply Reply Quote 0
              • A Offline
                andreas @dgerman
                last edited by andreas

                Dear @dgerman,

                Is there a way to inhibit updating the file timestamp [to prevent unnecessary writes]?

                Not that I am aware of. You would have to change the baseline firmware on the C-Level.

                Following [1], you might want to update (comment out) some code within [2] to see if this gives you any performance gains on that topic. I don't believe it will be made optional by any means through an official release, so you will have to bake a custom firmware image.

                However, as [3] shows it is essentially just a matter of invoking memcpy on the file configuration struct on ordinary write operations, it seems to be different to what we know from regular Linux systems that updating mtime will have any performance overhead.

                With kind regards,
                Andreas.

                [1] https://github.com/pycom/pycom-micropython-sigfox/pull/413
                [2] https://github.com/pycom/pycom-micropython-sigfox/blob/6d01270/esp32/littlefs/vfs_littlefs.c#L280-L334
                [3] https://github.com/pycom/pycom-micropython-sigfox/blob/6d01270/esp32/littlefs/vfs_littlefs.c#L385-L398

                1 Reply Last reply Reply Quote 0
                • techykermitT Offline
                  techykermit
                  last edited by

                  Hi there!

                  We're thinking about eventually changing our production units to LittleFS since we have had multiple issues with devices losing code after a brownout. One year later, what does the stability with LittleFS with PyCom look like? We're building our firmware from source (cloning pycom-micropython-sigfox). From what I can see, the HiveEyes improvement related to LittleFS instability that @andreas mentioned has been merged into source? Our tests so far with LittleFS have not shown any issues.

                  robert-hhR 1 Reply Last reply Reply Quote 2
                  • robert-hhR Offline
                    robert-hh @techykermit
                    last edited by

                    @techykermit I made an endurance test with littlefs, writing a file 5 Million times. That worked well. The last version of the Firmware enabled protection against flash wearing. So take care to use the recent version.

                    techykermitT 1 Reply Last reply Reply Quote 0
                    • techykermitT Offline
                      techykermit @robert-hh
                      last edited by

                      @robert-hh Sounds great, thanks for the help!

                      1 Reply Last reply Reply Quote 0

                      Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                      Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                      With your input, this post could be even better 💗

                      Register Login
                      • 1 / 1
                      • First post
                        Last post

                      Pycom on Twitter

                      Pycom