GithubHelp home page GithubHelp logo

Comments (2)

a-pushkin avatar a-pushkin commented on August 15, 2024

I'm trying to make exactly the same scenario work: prepare filesystem on a Linux host, flash it to Raspberry PI Pico and use it there in read-write mode.

Hitting exactly the same issue as OP with erase function not being called before prog. My guess is that littlefs consideres these blocks "erased" since bits in the filesystem control structures tell it that it is so. These bits are set by the FUSE implementation same as they would have been in the embedded one, when FS image is flashed into the Pico, all sectors are written to after erase and therefore are not really erased on the device.

Simple solution I'm going to try later today is just set block size to the same value as prog size and always erase 4k chunks before prog. This is going to be highly inefficient but should work.

A better solution would be to add a capability for LFS binary to set all 'erased' flags to false via a command line switch. I'll see if I can put together a pull request.

from littlefs-fuse.

a-pushkin avatar a-pushkin commented on August 15, 2024

After reading littlefs documentation and some experiments I retract my previous comment.

  1. littlefs doesn't store information about erased blocks in the metadata. It infers which blocks are unused by scanning the filesystem to find all the used ones. So there are no bits to set.
  2. my problems with writing to the filesystem were due to flash_range_erase and flash_range_prog being unsafe to use when interrupts are enabled (namely USB interrupts when USB stdio is enabled). See this for details: raspberrypi/pico-examples#34

After fixing the interrupt issue I was able to create littlefs image via littlefs-fuse, flash this image to Raspberry PI Pico, read files in the image and modify them. This worked as well when prog and read sizes were set to 256 bytes and block size to 4k.

from littlefs-fuse.

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.