Fatfs integration
Use when integrating, porting, configuring, or debugging FatFs FAT/exFAT filesystems, diskio drivers, SD cards, SPI flash disks, or embedded file I/O failuresFrom its SKILL.md
npx -y skills add easyzoom/aix-skills --skill fatfs-integrationAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 24 stars24 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
3.2 KB, 733 tokens by cl100k_base, as published. Nobody here has run it
FatFs Integration
Overview
Use this skill to integrate FatFs by proving the disk I/O layer before trusting filesystem behavior. FatFs is portable C, but the target-specific diskio functions, sector geometry, mount policy, and media timing decide whether it works reliably.
When To Use
Use this skill when:
- The user wants to add or debug FatFs on SD card, eMMC, USB MSC, RAM disk, SPI flash, or block devices.
- The issue involves
f_mount,f_open,f_read,f_write,FR_DISK_ERR,FR_NOT_READY,FR_NO_FILESYSTEM, long filenames, Unicode, or exFAT. - The project uses
ff.c,ffconf.h,diskio.c, orFATFS.
Do not use this skill when the raw block device cannot read/write sectors yet; debug the storage driver first.
First Questions
Ask for:
- Media type and transport: SDIO, SPI SD, eMMC, USB MSC, RAM disk, or flash translation layer.
- Sector size, sector count, erase/block size, and whether writes are cached.
ffconf.h,diskio.c, and current FatFs return code.- RTOS or bare-metal runtime and whether reentrancy is enabled.
- Whether formatting is allowed. Formatting can destroy user data.
- Long filename, Unicode, exFAT, timestamp, and multi-volume requirements.
Integration Checklist
-
Prove disk I/O.
disk_initialize,disk_status,disk_read,disk_write, anddisk_ioctlmust work independently. -
Match sector geometry. FatFs expects logical sectors and correct sector count.
GET_SECTOR_COUNT,GET_SECTOR_SIZE, andCTRL_SYNCmatter. -
Mount before formatting. Try
f_mountfirst. Ask beforef_mkfsor any operation that can erase media. -
Configure
ffconf.hintentionally. Reentrancy, LFN buffers, exFAT, code page, relative paths, and timestamp support affect RAM and behavior. -
Add locking if shared. Enable and implement synchronization when multiple tasks can access the same volume.
-
Verify persistence. Write,
f_sync/f_close, unmount/reset, remount, and read back.
Common Failures
FR_DISK_ERRfrom incompletedisk_ioctlor badCTRL_SYNC.FR_NO_FILESYSTEMfrom wrong sector offset or unformatted media.- Data loss because files are not closed or synced before power loss.
- LFN stack/heap buffers exceed MCU memory.
- SD card init works at low speed but data transfer fails after clock switch.
- Multi-task access corrupts files without FatFs reentrancy support.
Verification
Before claiming FatFs works:
- State media, sector size/count,
ffconf.hoptions, and mount path. - Confirm disk read/write/ioctl tests.
- Confirm mount behavior and whether format was skipped, approved, or performed.
- Confirm create/write/sync/readback after reset or remount.
- Confirm locking policy when RTOS is used.
Example
User:
FatFs f_mount 返回 FR_NO_FILESYSTEM。
Agent:
- Asks for media type, sector offset, diskio implementation, and whether formatting is allowed.
- Tests raw sector read and
GET_SECTOR_COUNT. - Mounts before formatting and asks before
f_mkfs.
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.