Skip to content

Commit 0978768

Browse files
CopilotRbb666
andcommitted
Enhance Kconfig help for finsh and dfs components
Co-authored-by: Rbb666 <[email protected]>
1 parent 922236c commit 0978768

File tree

2 files changed

+516
-4
lines changed

2 files changed

+516
-4
lines changed

components/dfs/Kconfig

Lines changed: 285 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,72 @@ config RT_USING_DFS
55
select RT_USING_MUTEX
66
default y
77
help
8-
The device file system is a light weight virtual file system.
8+
DFS (Device File System) is RT-Thread's lightweight virtual file system.
9+
10+
Provides unified file system abstraction layer supporting:
11+
- Multiple file system types (FAT, ROM-FS, RAM-FS, NFS, etc.)
12+
- POSIX-like file operations (open, read, write, close)
13+
- Device file access (/dev/uart1, /dev/spi0, etc.)
14+
- Mount points for different file systems
15+
- Working directory support
16+
17+
Features:
18+
- Small footprint (~5-10KB depending on configuration)
19+
- POSIX API compatibility for easier porting
20+
- Multiple file systems can coexist
21+
- Thread-safe operations with mutex protection
22+
23+
Typical use cases:
24+
- File logging and data storage
25+
- Configuration file management
26+
- Device access abstraction
27+
- Network file systems (NFS)
28+
29+
Enable for applications requiring file system support.
30+
Disable for simple applications to save ~10-15KB ROM.
931

1032
if RT_USING_DFS
1133
config DFS_USING_POSIX
1234
bool "Using posix-like functions, open/read/write/close"
1335
default y
36+
help
37+
Enable POSIX-compliant file I/O API functions.
38+
39+
Provides standard POSIX file operations:
40+
- open(), close(), read(), write()
41+
- lseek(), stat(), fstat()
42+
- opendir(), readdir(), closedir()
43+
- mkdir(), rmdir(), unlink(), rename()
44+
45+
Benefits:
46+
- Easier code porting from Linux/POSIX systems
47+
- Familiar API for developers
48+
- Better compatibility with third-party libraries
49+
50+
Required for most applications using file operations.
51+
Disable only if using custom file I/O API.
1452

1553
config DFS_USING_WORKDIR
1654
bool "Using working directory"
1755
default y
56+
help
57+
Enable working directory (current directory) support.
58+
59+
Features:
60+
- Each thread can have its own working directory
61+
- chdir() to change current directory
62+
- Relative paths resolved from working directory
63+
- getcwd() to get current directory path
64+
65+
Essential for:
66+
- Shell commands (cd, pwd)
67+
- Relative path operations
68+
- Multi-threaded file access with different contexts
69+
70+
Memory cost: ~256 bytes per thread for path storage
71+
72+
Recommended to keep enabled for convenience.
73+
Disable to save minimal RAM if only using absolute paths.
1874

1975
if RT_USING_DFS_V1
2076
config RT_USING_DFS_MNTTABLE
@@ -33,36 +89,138 @@ endif
3389
config DFS_FD_MAX
3490
int "The maximal number of opened files"
3591
default 16
92+
help
93+
Maximum number of file descriptors that can be opened simultaneously
94+
across all threads in the system.
95+
96+
Default: 16
97+
98+
Each open file descriptor uses ~40-60 bytes of RAM.
99+
Total memory: DFS_FD_MAX × ~50 bytes
100+
101+
Increase if:
102+
- Application opens many files concurrently
103+
- Multiple threads access files simultaneously
104+
- Getting "too many open files" errors
105+
106+
Decrease to save RAM on memory-constrained systems (minimum ~4).
107+
108+
Note: This is system-wide limit, not per-thread.
36109

37110
choice RT_USING_DFS_VERSION
38111
prompt "The version of DFS"
39112
default RT_USING_DFS_V1
40113
default RT_USING_DFS_V2 if RT_USING_SMART
114+
help
115+
Select DFS version for your system.
116+
117+
DFS v1.0:
118+
- Traditional DFS implementation
119+
- Stable and well-tested
120+
- Suitable for most embedded applications
121+
- Lower memory overhead
122+
123+
DFS v2.0:
124+
- Enhanced for RT-Smart user-space applications
125+
- Page cache support for better performance
126+
- Memory-mapped file support (mmap)
127+
- Required for RT-Smart mode
128+
129+
Choose v1.0 for standard RT-Thread applications.
130+
Choose v2.0 for RT-Smart with user-space processes.
41131

42132
config RT_USING_DFS_V1
43133
bool "DFS v1.0"
44134
depends on !RT_USING_SMART
135+
help
136+
DFS version 1.0 - traditional implementation.
137+
138+
Stable version for standard RT-Thread applications without
139+
user-space process support.
45140

46141
config RT_USING_DFS_V2
47142
bool "DFS v2.0"
48143
select RT_USING_DEVICE_OPS
144+
help
145+
DFS version 2.0 - enhanced for RT-Smart.
146+
147+
Advanced features:
148+
- Page cache for improved performance
149+
- Memory-mapped files (mmap)
150+
- Better integration with RT-Smart processes
151+
- Enhanced POSIX compliance
152+
153+
Required for RT-Smart mode.
49154
endchoice
50155

51156
if RT_USING_DFS_V1
52157
config DFS_FILESYSTEMS_MAX
53158
int "The maximal number of mounted file system"
54159
default 4
160+
help
161+
Maximum number of file systems that can be mounted simultaneously.
162+
163+
Default: 4 mount points
164+
165+
Each mount point uses ~40-60 bytes.
166+
Examples:
167+
- "/" - root file system (FAT/ROM/RAM)
168+
- "/sdcard" - SD card FAT
169+
- "/dev" - device file system
170+
- "/tmp" - temporary file system
171+
172+
Increase if you need more mount points.
173+
Decrease to save RAM on simple systems (minimum 1).
55174

56175
config DFS_FILESYSTEM_TYPES_MAX
57176
int "The maximal number of file system type"
58177
default 4
178+
help
179+
Maximum number of different file system types registered.
180+
181+
Default: 4 types
182+
183+
Common file system types:
184+
- elm (FAT/exFAT)
185+
- romfs (Read-Only Memory FS)
186+
- ramfs (RAM FS)
187+
- devfs (Device FS)
188+
- nfs (Network FS)
189+
- tmpfs (Temporary FS)
190+
191+
Each type registration uses ~20-30 bytes.
192+
Set based on number of file system types you plan to use.
59193
endif
60194

61195
config RT_USING_DFS_ELMFAT
62196
bool "Enable elm-chan fatfs"
63197
default n
64198
help
65-
FatFs is a generic FAT/exFAT file system module for small embedded systems.
199+
Enable elm-chan's FAT file system implementation.
200+
201+
FatFs is a generic FAT/exFAT file system module designed for
202+
embedded systems with limited resources.
203+
204+
Supported file systems:
205+
- FAT12, FAT16, FAT32
206+
- exFAT (with RT_DFS_ELM_USE_EXFAT enabled)
207+
208+
Features:
209+
- Long File Name (LFN) support
210+
- Unicode file names (UTF-8/UTF-16/UTF-32)
211+
- Thread-safe operations
212+
- Multiple volumes
213+
214+
Use cases:
215+
- SD card file storage
216+
- USB flash drives
217+
- Internal flash storage
218+
- Data logging
219+
220+
ROM overhead: ~15-25KB depending on features enabled.
221+
222+
Enable for FAT-formatted storage devices.
223+
Disable if not using FAT file systems.
66224

67225
if RT_USING_DFS_ELMFAT
68226
menu "elm-chan's FatFs, Generic FAT Filesystem Module"
@@ -161,6 +319,29 @@ endif
161319
config RT_USING_DFS_DEVFS
162320
bool "Using devfs for device objects"
163321
default y
322+
help
323+
Enable device file system (devfs) for accessing devices as files.
324+
325+
Devfs provides /dev directory containing device nodes:
326+
- /dev/uart1, /dev/uart2 - Serial ports
327+
- /dev/spi0, /dev/i2c0 - Bus devices
328+
- /dev/sd0, /dev/sd1 - Block devices
329+
- /dev/rtc - Real-time clock
330+
331+
Benefits:
332+
- Unified device access via open/read/write
333+
- POSIX-compliant device operations
334+
- Better abstraction and portability
335+
- Required for many device drivers
336+
337+
Essential for:
338+
- Device access from user applications
339+
- RT-Smart user-space processes
340+
- Shell device operations
341+
342+
Minimal overhead (~1-2KB ROM, ~100 bytes RAM).
343+
344+
Recommended to keep enabled for device access convenience.
164345

165346
if RT_USING_DFS_V1
166347
config RT_USING_DFS_ISO9660
@@ -172,6 +353,31 @@ endif
172353
menuconfig RT_USING_DFS_ROMFS
173354
bool "Enable ReadOnly file system on flash"
174355
default n
356+
help
357+
Enable ROM File System for read-only data stored in flash memory.
358+
359+
ROMFS stores read-only files directly in program flash, useful for:
360+
- Static web pages for web servers
361+
- Configuration files
362+
- Font files and graphics resources
363+
- Help files and documentation
364+
- Initial file system bootstrap
365+
366+
Features:
367+
- Very small footprint (~2-3KB)
368+
- No RAM required for file data (executes from flash)
369+
- Files embedded in firmware binary
370+
- Fast access (no erase/write delays)
371+
372+
Files included at compile time using romfs generator tool.
373+
374+
Use cases:
375+
- Web server static content
376+
- Resource files for GUI applications
377+
- Read-only configuration defaults
378+
379+
Enable if you need embedded read-only files.
380+
Disable to save ~2-3KB ROM if not needed.
175381

176382
if RT_USING_DFS_ROMFS
177383
config RT_USING_DFS_ROMFS_USER_ROOT
@@ -194,6 +400,32 @@ endif
194400
bool "Enable ReadOnly compressed file system on flash"
195401
default n
196402
# select PKG_USING_ZLIB
403+
help
404+
Enable Compressed ROM File System for compressed read-only data.
405+
406+
CROMFS is similar to ROMFS but with compression, providing:
407+
- Reduced flash usage (typically 30-70% compression)
408+
- Read-only access to compressed files
409+
- Automatic decompression on read
410+
- Files embedded in firmware binary
411+
412+
Trade-offs:
413+
+ Saves flash space (important for large resource files)
414+
- Higher CPU usage for decompression
415+
- Slower file access than ROMFS
416+
- Requires ZLIB for decompression
417+
418+
Best for:
419+
- Large resource files (fonts, graphics, web content)
420+
- Flash-constrained systems
421+
- Files accessed infrequently
422+
423+
Not recommended for:
424+
- Frequently accessed files
425+
- CPU-constrained systems
426+
- Files already compressed (JPEG, PNG, MP3)
427+
428+
Note: Requires ZLIB package for decompression support.
197429

198430
if RT_USING_DFS_V1
199431
config RT_USING_DFS_RAMFS
@@ -206,12 +438,63 @@ endif
206438
bool "Enable TMP file system"
207439
default y if RT_USING_SMART
208440
default n
441+
help
442+
Enable temporary file system (tmpfs) in RAM.
443+
444+
Tmpfs provides a RAM-based file system for temporary files:
445+
- Files stored entirely in RAM
446+
- Very fast read/write performance
447+
- Files lost on reboot/power-off
448+
- Dynamic size (grows/shrinks with usage)
449+
450+
Typical mount point: /tmp
451+
452+
Use cases:
453+
- Temporary file storage during runtime
454+
- Fast cache for processed data
455+
- Inter-process communication via temp files
456+
- Build/compile temporary files
457+
- RT-Smart /tmp directory
458+
459+
Memory usage:
460+
- Grows with file content
461+
- Files consume RAM directly
462+
463+
Automatically enabled for RT-Smart (required for POSIX /tmp).
464+
465+
Enable if you need fast temporary file storage.
466+
Disable to save RAM if temporary files not needed.
209467

210468
config RT_USING_DFS_MQUEUE
211469
bool "Enable MQUEUE file system"
212470
select RT_USING_DEV_BUS
213471
default y if RT_USING_SMART
214472
default n
473+
help
474+
Enable POSIX message queue file system.
475+
476+
Provides POSIX message queues as files in /dev/mqueue:
477+
- mq_open(), mq_send(), mq_receive()
478+
- Named message queues
479+
- File descriptor based operations
480+
- Process-safe IPC mechanism
481+
482+
Features:
483+
- POSIX-compliant message queue API
484+
- Multiple processes can communicate
485+
- Priority-based message delivery
486+
- Blocking and non-blocking modes
487+
488+
Use cases:
489+
- Inter-process communication in RT-Smart
490+
- POSIX application porting
491+
- Priority message passing
492+
493+
Required for RT-Smart POSIX message queues.
494+
Automatically enabled in RT-Smart mode.
495+
496+
Enable for POSIX message queue support.
497+
Disable if not using POSIX IPC (~2-3KB ROM savings).
215498

216499
if RT_USING_DFS_V1
217500
config RT_USING_DFS_NFS

0 commit comments

Comments
 (0)