Skip to content

Update FatFS to use R0.16#3281

Open
networkfusion wants to merge 23 commits intomainfrom
update-fatfs-r16
Open

Update FatFS to use R0.16#3281
networkfusion wants to merge 23 commits intomainfrom
update-fatfs-r16

Conversation

@networkfusion
Copy link
Copy Markdown
Member

@networkfusion networkfusion commented Apr 3, 2026

Description

Update FatFS to use R0.16.patch_1

Included (as needed for smoke test success), but possibily needs seperation:

  • Use python dev containers
  • Add pip install for kconfig (this "should" be handled in the cmake, but obviously not).

Motivation and Context

FatFS has a new and improved version,
ESP modules on latest suppored IDF actually require it!
Release notes:

https://elm-chan.org/fsw/ff/updates.html and patch:


August 3, 2025

The Unicode conversion module, ffunicode.c, linked at LFN configuration occupies
a large amount of memory when it is configured for DBCS.
From a suggestion in user forum, I have found that there is much room for improvement
of the compression ratio of 6 out of 8 conversion tables. This is the result in
table size by modification of compression algorithm.

Japanese (932)               59k  ==>   47k (-12k)
Simplified Chinese (936)    174k  ==>   97k (-77k)
Korean (949)                136k  ==>  103k (-33k)
Traditional Chinese (950)   108k  ==>   78k (-30k)
All CP (0)                  482k  ==>  329k (-153k)

How Has This Been Tested?

Untested (yet).

Screenshots

Types of changes

  • Improvement (non-breaking change that improves a feature, code or algorithm)
  • Bug fix (non-breaking change which fixes an issue with code or algorithm)
  • New feature (non-breaking change which adds functionality to code)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Config and build (change in the configuration and build system, has no impact on code or features)
  • Dev Containers (changes related with Dev Containers, has no impact on code or features)
  • Dependencies/declarations (update dependencies or assembly declarations and changes associated, has no impact on code or features)
  • Documentation (changes or updates in the documentation, has no impact on code or features)

Checklist

  • My code follows the code style of this project (only if there are changes in source code).
  • My changes require an update to the documentation (there are changes that require the docs website to be updated).
  • I have updated the documentation accordingly (the changes require an update on the docs in this repo).
  • I have read the CONTRIBUTING document.
  • I have tested everything locally and all new and existing tests passed (only if there are changes in source code).

Summary by CodeRabbit

  • Chores

    • Updated FatFS dependency from R0.15a to R0.16 across container builds, pull scripts, and build defaults; compatibility notes updated to R0.16.
  • Configuration

    • Filesystem defaults adjusted: added a max path depth, lowered GPT minimum threshold, enabled created-file timestamps in file info, and clarified option documentation/wording.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 3, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

Bumped FatFs reference from R0.15a to R0.16 across multiple devcontainer Dockerfiles, a git-pull script, and CMake FetchContent defaults; updated FatFs compatibility comments. Several ChibiOS/ThreadX ffconf.h files were modified: new macros, adjusted numeric config values, and multiple comment/documentation edits. No runtime control-flow code added.

Changes

Cohort / File(s) Summary
Devcontainer Dockerfiles
.devcontainer/All/Dockerfile.All.SRC, .devcontainer/ChibiOS/Dockerfile.ChibiOS.SRC, .devcontainer/ESP32/Dockerfile.ESP32.SRC, .devcontainer/FreeRTOS-NXP/Dockerfile.FreeRTOS-NXP.SRC, .devcontainer/ThreadX/Dockerfile.ThreadX.SRC
Replaced FatFs git branch/tag R0.15a with R0.16 in clone commands; repo URL and shallow clone options unchanged.
Devcontainer git script
.devcontainer/All/scripts/git-pull-repos.sh
Changed fatfs update from git pull origin R0.15a to a tag-based shallow fetch/checkout for R0.16 (git fetch --depth=1 origin tag R0.16 + git checkout tags/R0.16).
CMake build defaults
targets/ChibiOS/CMakeLists.txt, targets/FreeRTOS/NXP/CMakeLists.txt
Default FATFS_VERSION_TAG updated from "R0.15a" to "R0.16" when FATFS_VERSION is empty; affects FetchContent GIT_TAG usage.
FatFs source headers/comments
targets/ChibiOS/_FatFs/fatfs_syscall.c, targets/FreeRTOS/NXP/_FatFs/ffsystem.c
Header/comment compatibility text updated to indicate FatFs R0.16+; no code or logic changes.
ffconf.h — ChibiOS / ThreadX targets
targets/ChibiOS/ORGPAL_PALTHREE/ffconf.h, targets/ChibiOS/ORGPAL_PALX/ffconf.h, targets/ChibiOS/ST_STM32F769I_DISCOVERY/ffconf.h, targets/ThreadX/ST/ORGPAL_PALTHREE/ffconf.h
Configuration header edits: #define FFCONF_DEF 538080386; added #define FF_PATH_DEPTH 10 and #define FF_FS_CRTIME 1; FF_MIN_GPT changed from 0x1000000000x10000000; numerous comment/documentation wording fixes and minor formatting tweaks — verify intended macro semantics.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The pull request title clearly and concisely summarizes the main change: updating the FatFS dependency to version R0.16. All file modifications across Dockerfiles, CMakeLists.txt, and configuration headers are directly related to this version upgrade.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch update-fatfs-r16

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.devcontainer/All/scripts/git-pull-repos.sh:
- Line 22: The script currently runs a `git pull origin R0.16` which is
incorrect for a tag; replace that pull with explicit fetch and checkout steps
similar to the mbedtls pattern: fetch the `R0.16` tag from `origin` (e.g., `git
fetch origin tag R0.16 --no-tags` or similar) and then `git checkout` the
fetched `R0.16` tag (ensuring detached HEAD if desired), updating the commands
around the existing `R0.16` reference so the script explicitly fetches the tag
and checks it out instead of using `git pull`.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 5184044b-9afe-40bc-a0e0-d64f5f5668b1

📥 Commits

Reviewing files that changed from the base of the PR and between 0a2e53d and c374969.

📒 Files selected for processing (10)
  • .devcontainer/All/Dockerfile.All.SRC
  • .devcontainer/All/scripts/git-pull-repos.sh
  • .devcontainer/ChibiOS/Dockerfile.ChibiOS.SRC
  • .devcontainer/ESP32/Dockerfile.ESP32.SRC
  • .devcontainer/FreeRTOS-NXP/Dockerfile.FreeRTOS-NXP.SRC
  • .devcontainer/ThreadX/Dockerfile.ThreadX.SRC
  • targets/ChibiOS/CMakeLists.txt
  • targets/ChibiOS/_FatFs/fatfs_syscall.c
  • targets/FreeRTOS/NXP/CMakeLists.txt
  • targets/FreeRTOS/NXP/_FatFs/ffsystem.c

Use git fetch, rather than git pull.
Further improvement to ensure checkout.
@networkfusion
Copy link
Copy Markdown
Member Author

networkfusion commented Apr 3, 2026

@josesimoes this must be related to a recent change, but I am new to kconfig, so needs your input...

Edit: the devcontainer All target works because it uses IDF which consumes it, but now we also need it for all other dev containers with something like # Creating static link python for pyhton3 RUN ln -fs /usr/bin/python3 /usr/bin/python \ && python -m pip install --quiet -r "$(Agent.BuildDirectory)\s\nf-interpreter\requirements.txt"

image

mainly adding #define FF_FS_CRTIME 1
and updates FFCONF_DEF 80386
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@targets/ChibiOS/ORGPAL_PALTHREE/ffconf.h`:
- Line 12: The FFCONF_DEF value and new FatFs macros are out of sync across
ChibiOS targets: update the older ffconf.h copies so they match the new R0.16
contract by setting FFCONF_DEF to 80386 and adding the new macros (e.g.,
FF_PATH_DEPTH and FF_FS_CRTIME) and any other R0.16-specific defines introduced
in ORGPAL_PALTHREE/ffconf.h; ensure the same macro names and values are applied
to the other ChibiOS target ffconf.h files so all targets use the same FatFs
revision and configuration.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 9d4163d3-702c-4120-b35d-4108b29fa69e

📥 Commits

Reviewing files that changed from the base of the PR and between d581d10 and 05c972e.

📒 Files selected for processing (2)
  • .devcontainer/All/scripts/git-pull-repos.sh
  • targets/ChibiOS/ORGPAL_PALTHREE/ffconf.h
🚧 Files skipped from review as they are similar to previous changes (1)
  • .devcontainer/All/scripts/git-pull-repos.sh

@networkfusion networkfusion requested a review from josesimoes April 3, 2026 22:03
# Creating static link python for pyhton3
RUN ln -fs /usr/bin/python3 /usr/bin/python

# Installing python dependencies for the container
RUN pip3 install pyserial \
    && pip3 install --quiet "kconfiglib>=14.1.0"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants