Skip to content

extmod/vfs_lfsx: Allow overriding the LFS2 on-disk version format. #17565

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

andrewleech
Copy link
Contributor

Summary

Back in LFS2 version 2.6 they updated the on-disk version from 2.0 to 2.1 which broke back compatibility (aka older versions could no long read new version disk format) https://github.com/littlefs-project/littlefs/releases/tag/v2.6.0

Then in LFS2 v2.7 an optional config->disk_version was added to force the library to use an older disk format instead: https://github.com/littlefs-project/littlefs/releases/tag/v2.7.0

I've got an stm32wb55 application where I'm using current micropython, however units are already in the field with a mboot bootloader from an older version with v2.5 LFS2, so can only read the older disk format when using fsload.

This PR simply exposes config->disk_version as a compile time option if LFS2_MULTIVERSION is set, otherwise there is no change in behavior.

Note: LFS2_MULTIVERSION needs to be defined at the make / CFLAGS level, setting it in mpconfigboard.h doesn't work as it's not included in the lfs2.c file in any way.

Testing

This has been tested with and stm32wb55 build using mboot from a much older version. The on-disk format change can be seen by changing the LFS2_MULTIVERSION setting, once it's set to 0x00020000 any existing partitions cannot be mounted and need to be reformatted.

After it was reformatted and a dfu file was copied on, I was able to use mboot fsload again to flash it.

Useful for compatibility with older LFS versions.

Signed-off-by: Andrew Leech <[email protected]>
Copy link

codecov bot commented Jun 26, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.57%. Comparing base (0815b45) to head (95f9526).
Report is 9 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #17565   +/-   ##
=======================================
  Coverage   98.57%   98.57%           
=======================================
  Files         169      169           
  Lines       21968    21968           
=======================================
  Hits        21654    21654           
  Misses        314      314           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link

Code size report:

   bare-arm:    +0 +0.000% 
minimal x86:    +0 +0.000% 
   unix x64:    +0 +0.000% standard
      stm32:    +0 +0.000% PYBV10
     mimxrt:    +0 +0.000% TEENSY40
        rp2:    +0 +0.000% RPI_PICO_W
       samd:    +0 +0.000% ADAFRUIT_ITSYBITSY_M4_EXPRESS
  qemu rv32:    +0 +0.000% VIRT_RV32

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants