littlefs-integration
Skill36 starsChanged 5 months agoMITView on GitHub
Use when integrating, porting, configuring, or debugging littlefs on MCU flash, external NOR/NAND, SD-backed block devices, bare-metal, or RTOS projects
In this repository75 other files it gives its agents.
- 8051-mcu-debugSkill
- avem-integrationSkill
- battery-charger-fuel-gauge-integrationSkill
- ble-gatt-integrationSkill
- bootloader-debugSkill
- canbus-integrationSkill
- canopen-integrationSkill
- cellular-at-modem-integrationSkill
- cmbacktrace-integrationSkill
- cmsis-dsp-integrationSkill
- cortex-m-debugSkill
- cortex-r5-debugSkill
- crc-checksum-integrationSkill
- easylogger-integrationSkill
- embedded-app-example-libsSkill
- embedded-buffer-queue-libsSkill
- embedded-data-parsing-libsSkill
- embedded-debug-entrySkill
- embedded-fault-debugSkill
- embedded-framework-libsSkill
- embedded-input-libsSkill
- embedded-library-entrySkill
- embedded-linux-login-debugSkill
- embedded-peripheral-bringupSkill
- embedded-serial-log-debugSkill
- embedded-state-machine-libsSkill
- embedded-timing-libsSkill
- epd-integrationSkill
- esp-idf-integrationSkill
- fatfs-integrationSkill
- flashdb-integrationSkill
- freemodbus-integrationSkill
- freertos-kernel-debugSkill
- freertos-plus-tcp-integrationSkill
- gnss-gps-integrationSkill
- hardware-interface-debugSkill
- heatshrink-integrationSkill
- letter-shell-integrationSkill
- low-power-debugSkill
- lvgl-integrationSkill
- lwip-integrationSkill
- mbedtls-integrationSkill
- mcuboot-integrationSkill
- mcu-flashing-debugSkill
- micro-ecc-integrationSkill
- miniz-integrationSkill
- mqtt-embedded-integrationSkill
- nanopb-integrationSkill
- nrf-connect-sdk-integrationSkill
- nr-micro-shell-integrationSkill
- openocd-jlink-stlink-debugSkill
- openthread-integrationSkill
- ota-update-integrationSkill
- plooc-integrationSkill
- power-management-integrationSkill
- qspi-xip-flash-debugSkill
- readme-writingSkill
- riscv-mcu-debugSkill
- rtos-debugSkill
- rt-thread-integrationSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
8 rules. About 0 are common, 6 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈6
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 10
Use this skill to integrate littlefs safely on embedded block devices.
- Distinctive: line 14
Use this skill when:
- Very specific: line 20
Do not use this skill for generic flash programming failures before the block device driver works.
- Distinctive: line 47
Add locking if needed. Protect littlefs calls with a mutex if multiple tasks, interrupt contexts, or shell commands can access the …
- Distinctive: line 51
Write a file, close/sync it, unmount if possible, reset, remount, and read back.
- Distinctive: line 66
Verify/readback fails because program alignment is wrong.
- Distinctive: line 74
Before claiming littlefs works:
- Distinctive: line 80
If RTOS is used, confirm the locking policy.
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
littlefs Integration
Overview
Use this skill to integrate littlefs safely on embedded block devices. The core task is to make the lfs_config match the real storage geometry and prove mount, format, write, sync, power-loss, and remount behavior.
When To Use
Use this skill when:
- The user wants to add or debug littlefs on MCU internal flash, external SPI/QSPI NOR, NAND-like storage, EEPROM emulation, SD-backed block devices, or RTOS storage.
- The issue involves mount failures,
LFS_ERR_CORRUPT, read/write errors, wear leveling, block geometry, formatting, or data loss after reboot. - The project uses
lfs.h,lfs_file_*,lfs_dir_*, orstruct lfs_config.
Do not use this skill for generic flash programming failures before the block device driver works. Use mcu-flashing-debug first.
First Questions
Ask for:
- Storage type, size, erase block size, program size, read size, and erase value.
- Whether storage is internal flash, external NOR/NAND, SD card, RAM disk, or simulator.
- Existing
lfs_config, block device read/prog/erase/sync functions, and error codes. - RTOS or bare-metal environment, locking needs, and whether dynamic allocation is allowed.
- Whether formatting is allowed. Formatting can destroy existing data.
- Current symptom and exact littlefs error code.
Integration Checklist
- Confirm block geometry.
Set
read_size,prog_size,block_size,block_count,cache_size,lookahead_size, andblock_cyclesfrom the real storage device, not guesses. - Validate block operations.
read,prog,erase, andsyncmust use block-relative offsets correctly and return negative error codes on failure. - Respect flash rules. Programming can only change erased bits in the supported direction, writes must be aligned, and erase must cover whole erase blocks.
- Decide mount policy.
Try
lfs_mountfirst. Only calllfs_formatafter explicit user approval or when the product policy allows first-boot formatting. - Add locking if needed. Protect littlefs calls with a mutex if multiple tasks, interrupt contexts, or shell commands can access the filesystem.
- Prove persistence. Write a file, close/sync it, unmount if possible, reset, remount, and read back.
Porting Checks
contextpoints to the storage driver state if needed.- Block index and offset are translated to physical address correctly.
- Erase block size matches the physical erase granularity.
- Cache size is a multiple of read/prog sizes and fits RAM budget.
- Lookahead size is valid and large enough for block count.
- Bad-block behavior is understood if using NAND-like storage.
- Interrupts or power loss cannot interrupt a critical flash operation without product-level recovery handling.
Common Failures
- Mount fails because
block_sizeorblock_countdoes not match the actual partition. - Verify/readback fails because program alignment is wrong.
- Data disappears after reboot because file was not closed or synced.
- Filesystem corruption is caused by two tasks accessing littlefs without locking.
- Internal flash writes corrupt running code because the partition overlaps firmware.
- Formatting on every boot erases user data.
Verification
Before claiming littlefs works:
- State the storage geometry and
lfs_configvalues. - Confirm mount behavior and whether format was skipped, approved, or performed.
- Confirm create/write/close/readback succeeds.
- Confirm data survives reset or remount.
- If RTOS is used, confirm the locking policy.
- List any destructive operations avoided or approved.
Example
User:
littlefs 挂载总是 LFS_ERR_CORRUPT。Agent:
- Asks for storage geometry,
lfs_config, block driver functions, partition address, and whether format is allowed. - Checks block size/count and read/prog/erase alignment.
- Mounts before formatting, and asks before erasing existing data.
- Verifies write, sync, reboot, remount, and readback.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

