Skip to content

Update FatFS to R0.16#3581

Merged
hathach merged 1 commit intohathach:masterfrom
non-bin:master
Apr 5, 2026
Merged

Update FatFS to R0.16#3581
hathach merged 1 commit intohathach:masterfrom
non-bin:master

Conversation

@non-bin
Copy link
Copy Markdown

@non-bin non-bin commented Apr 1, 2026

It's strange that FatFS, being so popular and awesome, doesn't have an official public git repo.

Anyway, we were 3 years out of date: https://elm-chan.org/fsw/ff/updates.html

Copilot AI review requested due to automatic review settings April 1, 2026 08:56
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates the vendored FatFS library under lib/fatfs/source to ChaN FatFS R0.16 (2025), bringing in upstream fixes and feature work (notably exFAT getcwd / .. path handling and directory iteration fixes).

Changes:

  • Sync core FatFS sources (ff.c, ff.h) and documentation (00history.txt, 00readme.txt) to R0.16.
  • Update FatFS configuration template (ffconf.h) to the new revision ID and option set.
  • Refresh disk I/O skeleton headers/sources (diskio.h, diskio.c) to the 2025 upstream template.

Reviewed changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
lib/fatfs/source/ffconf.h Updates FatFS configuration header to R0.16 and changes several default config values.
lib/fatfs/source/ff.h Updates public FatFS API/types to R0.16 (new structs/fields and config include logic).
lib/fatfs/source/ff.c Updates FatFS implementation to R0.16 (upstream fixes/features and internal refactors).
lib/fatfs/source/diskio.h Updates low-level disk I/O interface header comments and annotations.
lib/fatfs/source/diskio.c Updates the disk I/O “skeleton” glue example template.
lib/fatfs/source/00readme.txt Bumps readme version label to R0.16.
lib/fatfs/source/00history.txt Appends upstream history entries for R0.15a/R0.15b/R0.16.
Comments suppressed due to low confidence (1)

lib/fatfs/source/ffconf.h:186

  • FF_VOLUMES was reduced to 1. However, the host MSC file explorer mounts devices using drive numbers derived from dev_addr (e.g., "0:", "1:", ...), so only supporting a single logical drive will make additional devices fail with FR_INVALID_DRIVE. Consider keeping FF_VOLUMES at its previous value (e.g., 4) or setting it to match CFG_TUH_DEVICE_MAX for that example.
#define FF_VOLUMES		1
/* Number of volumes (logical drives) to be used. (1-10) */


#define FF_STR_VOLUME_ID	0
#define FF_VOLUME_STRS		"RAM","NAND","CF","SD","SD2","USB","USB2","USB3"

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

- Add lib/fatfs to deps_mandatory in get_deps.py, pinned to R0.16
  (commit 30ca13c6) from github.com/abbrev/fatfs mirror
- Move TinyUSB custom ffconf.h to examples/host/msc_file_explorer/src/
  with project-specific settings: FF_CODE_PAGE=437, FF_USE_LFN=1,
  FF_FS_RPATH=2, FF_VOLUMES=4, FF_FS_NORTC=1
- get_deps.py removes stock ffconf.h after clone to avoid conflict
- Remove vendored fatfs source files from git tracking

FatFS R0.16 includes important fixes since R0.15:
- Fixed FAT32 FsInfo regression (forced full FAT scan on f_getfree)
- Fixed f_readdir infinite loop (from R0.15b)
- f_getcwd/.. now works on exFAT
- Added FF_FS_CRTIME support
Copy link
Copy Markdown
Owner

@hathach hathach left a comment

Choose a reason for hiding this comment

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

thank you for the PR. Yeah, there is no official fatfs repo, but there is a mirror abbrev/fatfs, which seems to be regular updated. Let use that as dependency, I also move the customize ffconf.h to the example. That would make updating fatfs easier in the future.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 2, 2026

MemBrowse Memory Report

Top 10 targets by memory change (%) (out of 2156 targets) View Project Dashboard →

target .text .rodata .data .bss total % diff
msp_exp432e401y/msc_file_explorer 37,228 → 37,252 (+24) 37,760 → 37,784 (+24) +0.1%
ch32v203c_r0_1v0/msc_file_explorer 39,928 → 39,948 (+20) 40,184 → 40,204 (+20) +0.0%
hpm6750evk2/msc_file_explorer 48,552 → 48,576 (+24) 48,704 → 48,728 (+24) +0.0%
ea4088_quickstart/msc_file_explorer 32,296 → 32,312 (+16) 32,732 → 32,748 (+16) +0.0%
lpcxpresso1769/msc_file_explorer 32,492 → 32,508 (+16) 32,872 → 32,888 (+16) +0.0%
metro_m4_express/msc_file_explorer 32,944 → 32,960 (+16) 32,952 → 32,968 (+16) +0.0%
lpcxpresso18s37/msc_file_explorer 34,724 → 34,740 (+16) 35,170 → 35,186 (+16) +0.0%
portenta_c33/msc_file_explorer 35,417 → 35,433 (+16) 35,417 → 35,433 (+16) +0.0%
ea4357/msc_file_explorer 35,972 → 35,988 (+16) 36,418 → 36,434 (+16) +0.0%
metro_m7_1011/msc_file_explorer 37,352 → 37,368 (+16) 37,360 → 37,376 (+16) +0.0%

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 5, 2026

Size Difference Report

Because TinyUSB code size varies by port and configuration, the metrics below represent the averaged totals across all example builds.

Note: If there is no change, only one value is shown.

Changes >1% in size

No entries.

Changes <1% in size

No entries.

No changes
file .text .rodata .data .bss size % diff
audio_device.c 2897 0 1260 1627 4518 +0.0%
cdc_device.c 1252 16 1106 684 1935 +0.0%
cdc_host.c 6381 487 15 985 7579 +0.0%
dcd_ch32_usbfs.c 1473 0 0 2444 3917 +0.0%
dcd_ch32_usbhs.c 1469 0 0 448 1917 +0.0%
dcd_ci_fs.c 1925 0 0 1290 3215 +0.0%
dcd_ci_hs.c 1759 0 0 1344 2538 +0.0%
dcd_da146xx.c 3067 0 0 144 3211 +0.0%
dcd_dwc2.c 4210 25 0 265 4500 +0.0%
dcd_eptri.c 2271 0 0 259 2530 +0.0%
dcd_ft9xx.c 3276 0 0 172 3448 +0.0%
dcd_khci.c 1953 0 0 1290 3243 +0.0%
dcd_lpc17_40.c 1474 0 0 648 1798 +0.0%
dcd_lpc_ip3511.c 1463 0 0 264 1683 +0.0%
dcd_mm32f327x_otg.c 1478 0 0 1290 2768 +0.0%
dcd_msp430x5xx.c 1798 0 0 176 1974 +0.0%
dcd_musb.c 2445 0 0 160 2605 +0.0%
dcd_nrf5x.c 2918 0 0 292 3210 +0.0%
dcd_nuc120.c 1094 0 0 78 1172 +0.0%
dcd_nuc121.c 1168 0 0 101 1269 +0.0%
dcd_nuc505.c 0 0 1531 157 1688 +0.0%
dcd_rp2040.c 838 0 764 655 2257 +0.0%
dcd_rusb2.c 2919 0 0 156 3075 +0.0%
dcd_samd.c 1034 0 0 266 1300 +0.0%
dcd_samg.c 1320 0 0 72 1392 +0.0%
dcd_stm32_fsdev.c 2558 0 0 291 2849 +0.0%
dfu_device.c 777 28 712 140 916 +0.0%
dfu_rt_device.c 157 0 134 0 157 +0.0%
dwc2_common.c 602 30 0 0 618 +0.0%
ecm_rndis_device.c 1037 0 1 2858 3896 +0.0%
ehci.c 2763 0 0 6043 7597 +0.0%
fsdev_common.c 180 0 0 0 180 +0.0%
hcd_ch32_usbfs.c 2485 0 0 498 2983 +0.0%
hcd_ci_hs.c 184 0 0 0 184 +0.0%
hcd_dwc2.c 4994 33 1 513 5540 +0.0%
hcd_khci.c 2442 0 0 449 2891 +0.0%
hcd_musb.c 3073 0 0 157 3230 +0.0%
hcd_pio_usb.c 262 0 240 0 502 +0.0%
hcd_rp2040.c 2000 17 4 321 2342 +0.0%
hcd_rusb2.c 2923 0 0 245 3168 +0.0%
hcd_samd.c 2220 0 0 324 2544 +0.0%
hcd_stm32_fsdev.c 3287 0 1 420 3708 +0.0%
hid_device.c 1125 44 997 119 1244 +0.0%
hid_host.c 1240 0 0 1251 2491 +0.0%
hub.c 1384 8 8 30 1418 +0.0%
midi_device.c 1151 0 1007 623 1772 +0.0%
midi_host.c 1341 7 7 3635 4979 +0.0%
msc_device.c 2525 108 2286 547 3071 +0.0%
msc_host.c 1587 0 0 394 1982 +0.0%
mtp_device.c 1696 22 735 588 2292 +0.0%
ncm_device.c 1538 28 718 5843 7395 +0.0%
ohci.c 1940 0 0 2414 4353 +0.0%
printer_device.c 830 0 706 566 1394 +0.0%
rp2040_usb.c 382 35 625 11 1053 +0.0%
rusb2_common.c 160 0 16 0 176 +0.0%
tusb.c 451 0 383 3 453 +0.0%
tusb_fifo.c 846 0 480 0 841 +0.0%
typec_stm32.c 820 8 2 12 842 +0.0%
usbc.c 420 2 20 166 608 +0.0%
usbd.c 3224 57 88 275 3564 +0.0%
usbd_control.c 538 0 484 79 616 +0.0%
usbh.c 4652 55 99 1034 5807 +0.0%
usbtmc_device.c 2196 24 68 316 2544 +0.0%
vendor_device.c 641 0 534 565 1204 +0.0%
video_device.c 4443 5 1235 479 4914 +0.0%
TOTAL 118956 1039 16267 46476 167060 +0.0%

@hathach hathach merged commit 751f465 into hathach:master Apr 5, 2026
638 of 642 checks passed
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.

3 participants