RAM File System
Header: claw_ramfs.hcomponents/claw_modules/claw_ramfs/include/claw_ramfs.h
Overview
Section titled “Overview”claw_ramfs is a RAM-backed file system implementation in ESP-Claw. It registers through the ESP-IDF VFS interface, allowing applications to read and write in-memory files like ordinary files.
Compared with FATFS (Flash storage), RAMFS provides faster reads and writes and reduces Flash wear, making it suitable for temporary files, caches, and runtime-generated data.
Main uses
Section titled “Main uses”- Temporary file cache: intermediate data during LLM inference
- Fast exchange area: temporary files produced by Lua scripts at runtime
- Cross-component data sharing: pass data between components through file paths
- Multi-level read/write: support syncing RAMFS content to FATFS or loading it from FATFS
Mount and unmount
Section titled “Mount and unmount”| Config item | Description |
|---|---|
base_path | VFS mount point such as /ram; must start with / and not end with / |
max_files | Maximum number of simultaneously open files, not total stored files |
max_bytes | Maximum total bytes available for file content, excluding directory metadata |
caps | Heap allocation flags; must include MALLOC_CAP_8BIT |
Unmount:
Capacity query
Section titled “Capacity query”FATFS sync
Section titled “FATFS sync”RAMFS supports bidirectional file/directory sync with FATFS:
Relationship to other components
Section titled “Relationship to other components”cap_files: file operation tools can manage files under both FATFS and RAMFS pathscap_lua: Lua scripts can read and write RAMFS paths for high-speed temporary storageclaw_memory: some runtime memory data can be cached in RAMFS
Memory selection suggestions
Section titled “Memory selection suggestions”| Scenario | Recommended caps |
|---|---|
| Small temporary files (< 32KB) | MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT |
| Large cache files | MALLOC_CAP_SPIRAM | MALLOC_CAP_8BIT |