littlefs-project / littlefs

A little fail-safe filesystem designed for microcontrollers
BSD 3-Clause "New" or "Revised" License
4.9k stars 770 forks source link

Is the lfs file generated using the littlefs Python library somewhat different from the lfs file running on the device? #1001

Open pine-fish opened 3 days ago

pine-fish commented 3 days ago

I want to directly generate LFS files on the computer and write them into the device's flash to add files to the device's LFS, as the network download speed of the device is slow and inconvenient for debugging. I use the littlefs Python library to generate LFS files, and this is the link to this library https://github.com/jrast/littlefs-python After testing, it was found that there were a few successful attempts to mount and read the files inside. Most of the time, after writing to the lfs file, the device will mount fail, or the mount will succeed but the file cannot be read. I noticed that the LFS file generated by the library starts recording directly from Super Block 3, while the device's LFS starts recording from Super Block 2, which should be the biggest difference. Then I first perform repeated write operations on the device, and wait until the operation record starts using Super Block 3 before writing the library generated LFS file to flash. However, it has no effect and still fails. What is the difference that caused the mounting failure? Or what should I do? Attached below are the LFS files generated by the library and the device, hoping to be helpful bin.zip