Kconfig 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555
  1. menu "DFS: device virtual file system"
  2. config RT_USING_DFS
  3. bool "DFS: device virtual file system"
  4. select RT_USING_MUTEX
  5. default y
  6. help
  7. DFS (Device File System) is RT-Thread's lightweight virtual file system.
  8. Provides unified file system abstraction layer supporting:
  9. - Multiple file system types (FAT, ROM-FS, RAM-FS, NFS, etc.)
  10. - POSIX-like file operations (open, read, write, close)
  11. - Device file access (/dev/uart1, /dev/spi0, etc.)
  12. - Mount points for different file systems
  13. - Working directory support
  14. Features:
  15. - Small footprint (~5-10KB depending on configuration)
  16. - POSIX API compatibility for easier porting
  17. - Multiple file systems can coexist
  18. - Thread-safe operations with mutex protection
  19. Typical use cases:
  20. - File logging and data storage
  21. - Configuration file management
  22. - Device access abstraction
  23. - Network file systems (NFS)
  24. Enable for applications requiring file system support.
  25. Disable for simple applications to save ~10-15KB ROM.
  26. if RT_USING_DFS
  27. config DFS_USING_POSIX
  28. bool "Using posix-like functions, open/read/write/close"
  29. default y
  30. help
  31. Enable POSIX-compliant file I/O API functions.
  32. Provides standard POSIX file operations:
  33. - open(), close(), read(), write()
  34. - lseek(), stat(), fstat()
  35. - opendir(), readdir(), closedir()
  36. - mkdir(), rmdir(), unlink(), rename()
  37. Benefits:
  38. - Easier code porting from Linux/POSIX systems
  39. - Familiar API for developers
  40. - Better compatibility with third-party libraries
  41. Required for most applications using file operations.
  42. Disable only if using custom file I/O API.
  43. config DFS_USING_WORKDIR
  44. bool "Using working directory"
  45. default y
  46. help
  47. Enable working directory (current directory) support.
  48. Features:
  49. - Each thread can have its own working directory
  50. - chdir() to change current directory
  51. - Relative paths resolved from working directory
  52. - getcwd() to get current directory path
  53. Essential for:
  54. - Shell commands (cd, pwd)
  55. - Relative path operations
  56. - Multi-threaded file access with different contexts
  57. Memory cost: ~256 bytes per thread for path storage
  58. Recommended to keep enabled for convenience.
  59. Disable to save minimal RAM if only using absolute paths.
  60. if RT_USING_DFS_V1
  61. config RT_USING_DFS_MNTTABLE
  62. bool "Using mount table for file system"
  63. default n
  64. help
  65. User can use mount table for automatically mount, for example:
  66. const struct dfs_mount_tbl mount_table[] =
  67. {
  68. {"flash0", "/", "elm", 0, 0},
  69. {0}
  70. };
  71. The mount_table must be terminated with NULL.
  72. endif
  73. config DFS_FD_MAX
  74. int "The maximal number of opened files"
  75. default 16
  76. help
  77. Maximum number of file descriptors that can be opened simultaneously
  78. across all threads in the system.
  79. Default: 16
  80. Each open file descriptor uses ~40-60 bytes of RAM.
  81. Total memory: DFS_FD_MAX × ~50 bytes
  82. Increase if:
  83. - Application opens many files concurrently
  84. - Multiple threads access files simultaneously
  85. - Getting "too many open files" errors
  86. Decrease to save RAM on memory-constrained systems (minimum ~4).
  87. Note: This is system-wide limit, not per-thread.
  88. choice RT_USING_DFS_VERSION
  89. prompt "The version of DFS"
  90. default RT_USING_DFS_V1
  91. default RT_USING_DFS_V2 if RT_USING_SMART
  92. help
  93. Select DFS version for your system.
  94. DFS v1.0:
  95. - Traditional DFS implementation
  96. - Stable and well-tested
  97. - Suitable for most embedded applications
  98. - Lower memory overhead
  99. DFS v2.0:
  100. - Enhanced for RT-Smart user-space applications
  101. - Page cache support for better performance
  102. - Memory-mapped file support (mmap)
  103. - Required for RT-Smart mode
  104. Choose v1.0 for standard RT-Thread applications.
  105. Choose v2.0 for RT-Smart with user-space processes.
  106. config RT_USING_DFS_V1
  107. bool "DFS v1.0"
  108. depends on !RT_USING_SMART
  109. help
  110. DFS version 1.0 - traditional implementation.
  111. Stable version for standard RT-Thread applications without
  112. user-space process support.
  113. config RT_USING_DFS_V2
  114. bool "DFS v2.0"
  115. select RT_USING_DEVICE_OPS
  116. help
  117. DFS version 2.0 - enhanced for RT-Smart.
  118. Advanced features:
  119. - Page cache for improved performance
  120. - Memory-mapped files (mmap)
  121. - Better integration with RT-Smart processes
  122. - Enhanced POSIX compliance
  123. Required for RT-Smart mode.
  124. endchoice
  125. if RT_USING_DFS_V1
  126. config DFS_FILESYSTEMS_MAX
  127. int "The maximal number of mounted file system"
  128. default 4
  129. help
  130. Maximum number of file systems that can be mounted simultaneously.
  131. Default: 4 mount points
  132. Each mount point uses ~40-60 bytes.
  133. Examples:
  134. - "/" - root file system (FAT/ROM/RAM)
  135. - "/sdcard" - SD card FAT
  136. - "/dev" - device file system
  137. - "/tmp" - temporary file system
  138. Increase if you need more mount points.
  139. Decrease to save RAM on simple systems (minimum 1).
  140. config DFS_FILESYSTEM_TYPES_MAX
  141. int "The maximal number of file system type"
  142. default 4
  143. help
  144. Maximum number of different file system types registered.
  145. Default: 4 types
  146. Common file system types:
  147. - elm (FAT/exFAT)
  148. - romfs (Read-Only Memory FS)
  149. - ramfs (RAM FS)
  150. - devfs (Device FS)
  151. - nfs (Network FS)
  152. - tmpfs (Temporary FS)
  153. Each type registration uses ~20-30 bytes.
  154. Set based on number of file system types you plan to use.
  155. endif
  156. config RT_USING_DFS_ELMFAT
  157. bool "Enable elm-chan fatfs"
  158. default n
  159. help
  160. Enable elm-chan's FAT file system implementation.
  161. FatFs is a generic FAT/exFAT file system module designed for
  162. embedded systems with limited resources.
  163. Supported file systems:
  164. - FAT12, FAT16, FAT32
  165. - exFAT (with RT_DFS_ELM_USE_EXFAT enabled)
  166. Features:
  167. - Long File Name (LFN) support
  168. - Unicode file names (UTF-8/UTF-16/UTF-32)
  169. - Thread-safe operations
  170. - Multiple volumes
  171. Use cases:
  172. - SD card file storage
  173. - USB flash drives
  174. - Internal flash storage
  175. - Data logging
  176. ROM overhead: ~15-25KB depending on features enabled.
  177. Enable for FAT-formatted storage devices.
  178. Disable if not using FAT file systems.
  179. if RT_USING_DFS_ELMFAT
  180. menu "elm-chan's FatFs, Generic FAT Filesystem Module"
  181. config RT_DFS_ELM_CODE_PAGE
  182. int "OEM code page"
  183. default 437
  184. config RT_DFS_ELM_WORD_ACCESS
  185. bool "Using RT_DFS_ELM_WORD_ACCESS"
  186. default y
  187. choice RT_DFS_ELM_USE_LFN_NAME
  188. prompt "Support long file name"
  189. default RT_DFS_ELM_USE_LFN_3
  190. config RT_DFS_ELM_USE_LFN_0
  191. bool "0: LFN disable"
  192. config RT_DFS_ELM_USE_LFN_1
  193. bool "1: LFN with static LFN working buffer"
  194. config RT_DFS_ELM_USE_LFN_2
  195. bool "2: LFN with dynamic LFN working buffer on the stack"
  196. config RT_DFS_ELM_USE_LFN_3
  197. bool "3: LFN with dynamic LFN working buffer on the heap"
  198. endchoice
  199. config RT_DFS_ELM_USE_LFN
  200. int
  201. default 0 if RT_DFS_ELM_USE_LFN_0
  202. default 1 if RT_DFS_ELM_USE_LFN_1
  203. default 2 if RT_DFS_ELM_USE_LFN_2
  204. default 3 if RT_DFS_ELM_USE_LFN_3
  205. choice RT_DFS_ELM_LFN_UNICODE_NAME
  206. prompt "Support unicode for long file name"
  207. default RT_DFS_ELM_LFN_UNICODE_0
  208. config RT_DFS_ELM_LFN_UNICODE_0
  209. bool "0: ANSI/OEM in current CP (TCHAR = char)"
  210. config RT_DFS_ELM_LFN_UNICODE_1
  211. bool "1: Unicode in UTF-16 (TCHAR = WCHAR)"
  212. config RT_DFS_ELM_LFN_UNICODE_2
  213. bool "2: Unicode in UTF-8 (TCHAR = char)"
  214. config RT_DFS_ELM_LFN_UNICODE_3
  215. bool "3: Unicode in UTF-32 (TCHAR = DWORD)"
  216. endchoice
  217. config RT_DFS_ELM_LFN_UNICODE
  218. int
  219. default 0 if RT_DFS_ELM_LFN_UNICODE_0
  220. default 1 if RT_DFS_ELM_LFN_UNICODE_1
  221. default 2 if RT_DFS_ELM_LFN_UNICODE_2
  222. default 3 if RT_DFS_ELM_LFN_UNICODE_3
  223. config RT_DFS_ELM_MAX_LFN
  224. int "Maximal size of file name length"
  225. range 12 255
  226. default 255
  227. config RT_DFS_ELM_DRIVES
  228. int "Number of volumes (logical drives) to be used."
  229. default 2
  230. config RT_DFS_ELM_MAX_SECTOR_SIZE
  231. int "Maximum sector size to be handled."
  232. default 512
  233. help
  234. If you use some spi nor flash for fatfs, please set this the erase sector size, for example 4096.
  235. config RT_DFS_ELM_USE_ERASE
  236. bool "Enable sector erase feature"
  237. default n
  238. config RT_DFS_ELM_REENTRANT
  239. bool "Enable the reentrancy (thread safe) of the FatFs module"
  240. default y
  241. config RT_DFS_ELM_MUTEX_TIMEOUT
  242. int "Timeout of thread-safe protection mutex"
  243. range 0 1000000
  244. default 3000
  245. depends on RT_DFS_ELM_REENTRANT
  246. config RT_DFS_ELM_USE_EXFAT
  247. bool "Enable RT_DFS_ELM_USE_EXFAT"
  248. default n
  249. depends on RT_DFS_ELM_USE_LFN >= 1
  250. endmenu
  251. endif
  252. config RT_USING_DFS_DEVFS
  253. bool "Using devfs for device objects"
  254. default y
  255. help
  256. Enable device file system (devfs) for accessing devices as files.
  257. Devfs provides /dev directory containing device nodes:
  258. - /dev/uart1, /dev/uart2 - Serial ports
  259. - /dev/spi0, /dev/i2c0 - Bus devices
  260. - /dev/sd0, /dev/sd1 - Block devices
  261. - /dev/rtc - Real-time clock
  262. Benefits:
  263. - Unified device access via open/read/write
  264. - POSIX-compliant device operations
  265. - Better abstraction and portability
  266. - Required for many device drivers
  267. Essential for:
  268. - Device access from user applications
  269. - RT-Smart user-space processes
  270. - Shell device operations
  271. Minimal overhead (~1-2KB ROM, ~100 bytes RAM).
  272. Recommended to keep enabled for device access convenience.
  273. if RT_USING_DFS_V1
  274. config RT_USING_DFS_9PFS
  275. bool "Using Plan 9 remote filesystem"
  276. select RT_USING_ADT_BITMAP
  277. depends on RT_USING_MEMHEAP
  278. default n
  279. config RT_USING_DFS_ISO9660
  280. bool "Using ISO9660 filesystem"
  281. depends on RT_USING_MEMHEAP
  282. default n
  283. endif
  284. menuconfig RT_USING_DFS_ROMFS
  285. bool "Enable ReadOnly file system on flash"
  286. default n
  287. help
  288. Enable ROM File System for read-only data stored in flash memory.
  289. ROMFS stores read-only files directly in program flash, useful for:
  290. - Static web pages for web servers
  291. - Configuration files
  292. - Font files and graphics resources
  293. - Help files and documentation
  294. - Initial file system bootstrap
  295. Features:
  296. - Very small footprint (~2-3KB)
  297. - No RAM required for file data (executes from flash)
  298. - Files embedded in firmware binary
  299. - Fast access (no erase/write delays)
  300. Files included at compile time using romfs generator tool.
  301. Use cases:
  302. - Web server static content
  303. - Resource files for GUI applications
  304. - Read-only configuration defaults
  305. Enable if you need embedded read-only files.
  306. Disable to save ~2-3KB ROM if not needed.
  307. if RT_USING_DFS_ROMFS
  308. config RT_USING_DFS_ROMFS_USER_ROOT
  309. bool "Use user's romfs root"
  310. depends on RT_USING_DFS_V1
  311. default n
  312. endif
  313. if RT_USING_SMART
  314. config RT_USING_DFS_PTYFS
  315. bool "Using Pseudo-Teletype Filesystem (UNIX98 PTY)"
  316. depends on RT_USING_DFS_DEVFS
  317. default y
  318. config RT_USING_DFS_PROCFS
  319. bool "Enable proc file system"
  320. default y
  321. endif
  322. config RT_USING_DFS_CROMFS
  323. bool "Enable ReadOnly compressed file system on flash"
  324. default n
  325. # select PKG_USING_ZLIB
  326. help
  327. Enable Compressed ROM File System for compressed read-only data.
  328. CROMFS is similar to ROMFS but with compression, providing:
  329. - Reduced flash usage (typically 30-70% compression)
  330. - Read-only access to compressed files
  331. - Automatic decompression on read
  332. - Files embedded in firmware binary
  333. Trade-offs:
  334. + Saves flash space (important for large resource files)
  335. - Higher CPU usage for decompression
  336. - Slower file access than ROMFS
  337. - Requires ZLIB for decompression
  338. Best for:
  339. - Large resource files (fonts, graphics, web content)
  340. - Flash-constrained systems
  341. - Files accessed infrequently
  342. Not recommended for:
  343. - Frequently accessed files
  344. - CPU-constrained systems
  345. - Files already compressed (JPEG, PNG, MP3)
  346. Note: Requires ZLIB package for decompression support.
  347. if RT_USING_DFS_V1
  348. config RT_USING_DFS_RAMFS
  349. bool "Enable RAM file system"
  350. select RT_USING_MEMHEAP
  351. default n
  352. endif
  353. config RT_USING_DFS_TMPFS
  354. bool "Enable TMP file system"
  355. default y if RT_USING_SMART
  356. default n
  357. help
  358. Enable temporary file system (tmpfs) in RAM.
  359. Tmpfs provides a RAM-based file system for temporary files:
  360. - Files stored entirely in RAM
  361. - Very fast read/write performance
  362. - Files lost on reboot/power-off
  363. - Dynamic size (grows/shrinks with usage)
  364. Typical mount point: /tmp
  365. Use cases:
  366. - Temporary file storage during runtime
  367. - Fast cache for processed data
  368. - Inter-process communication via temp files
  369. - Build/compile temporary files
  370. - RT-Smart /tmp directory
  371. Memory usage:
  372. - Grows with file content
  373. - Files consume RAM directly
  374. Automatically enabled for RT-Smart (required for POSIX /tmp).
  375. Enable if you need fast temporary file storage.
  376. Disable to save RAM if temporary files not needed.
  377. config RT_USING_DFS_MQUEUE
  378. bool "Enable MQUEUE file system"
  379. select RT_USING_DEV_BUS
  380. default y if RT_USING_SMART
  381. default n
  382. help
  383. Enable POSIX message queue file system.
  384. Provides POSIX message queues as files in /dev/mqueue:
  385. - mq_open(), mq_send(), mq_receive()
  386. - Named message queues
  387. - File descriptor based operations
  388. - Process-safe IPC mechanism
  389. Features:
  390. - POSIX-compliant message queue API
  391. - Multiple processes can communicate
  392. - Priority-based message delivery
  393. - Blocking and non-blocking modes
  394. Use cases:
  395. - Inter-process communication in RT-Smart
  396. - POSIX application porting
  397. - Priority message passing
  398. Required for RT-Smart POSIX message queues.
  399. Automatically enabled in RT-Smart mode.
  400. Enable for POSIX message queue support.
  401. Disable if not using POSIX IPC (~2-3KB ROM savings).
  402. if RT_USING_DFS_V1
  403. config RT_USING_DFS_NFS
  404. bool "Using NFS v3 client file system"
  405. depends on RT_USING_LWIP
  406. default n
  407. if RT_USING_DFS_NFS
  408. config RT_NFS_HOST_EXPORT
  409. string "NFSv3 host export"
  410. default "192.168.1.5:/"
  411. endif
  412. endif
  413. if RT_USING_DFS_V2
  414. config RT_USING_PAGECACHE
  415. bool "Enable page cache"
  416. default y if RT_USING_SMART
  417. depends on RT_USING_SMART
  418. if RT_USING_PAGECACHE
  419. menu "page cache config"
  420. config RT_PAGECACHE_COUNT
  421. int "page cache max total pages."
  422. default 4096
  423. config RT_PAGECACHE_ASPACE_COUNT
  424. int "aspace max active pages."
  425. default 1024
  426. config RT_PAGECACHE_PRELOAD
  427. int "max pre load pages."
  428. default 4
  429. config RT_PAGECACHE_HASH_NR
  430. int "page cache hash size."
  431. default 1024
  432. config RT_PAGECACHE_GC_WORK_LEVEL
  433. int "page cache gc work trigger min percentage, default 90%."
  434. default 90
  435. config RT_PAGECACHE_GC_STOP_LEVEL
  436. int "page cache gc to min percentage, default 70%."
  437. default 70
  438. endmenu
  439. endif
  440. endif
  441. endif
  442. endmenu