Kconfig 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326
  1. menuconfig RT_USING_MSH
  2. bool "MSH: command shell"
  3. default n if RT_USING_NANO
  4. default y
  5. select RT_USING_SEMAPHORE
  6. help
  7. MSH (Module SHell) is RT-Thread's command-line interface (CLI) shell.
  8. Provides interactive command execution for:
  9. - System debugging and monitoring
  10. - Runtime configuration and testing
  11. - File system operations
  12. - Network diagnostics
  13. - Custom application commands
  14. Features:
  15. - Tab completion for commands and file paths
  16. - Command history with arrow keys
  17. - Built-in commands (ls, ps, free, etc.)
  18. - Custom command registration via MSH_CMD_EXPORT()
  19. - Authentication support for secure access
  20. Typical use cases:
  21. - Development and debugging
  22. - Production diagnostics
  23. - Interactive testing
  24. - System administration
  25. Note: Disable for headless embedded systems to save ~8-16KB ROM.
  26. Automatically disabled in RT_USING_NANO configuration.
  27. if RT_USING_MSH
  28. config RT_USING_FINSH
  29. bool
  30. default y
  31. help
  32. Internal configuration for finsh shell support.
  33. Automatically enabled when RT_USING_MSH is selected.
  34. Do not modify directly.
  35. config FINSH_USING_MSH
  36. bool
  37. default y
  38. help
  39. Use MSH (Module SHell) mode instead of traditional C-expression shell.
  40. MSH provides a more familiar POSIX-like command interface.
  41. Automatically enabled when RT_USING_MSH is selected.
  42. Do not modify directly.
  43. config FINSH_THREAD_NAME
  44. string "The msh thread name"
  45. default "tshell"
  46. help
  47. Name of the MSH shell thread visible in thread list.
  48. Default: "tshell"
  49. Change this to avoid name conflicts or for identification purposes.
  50. Thread name length limited by RT_NAME_MAX (default 8 chars).
  51. config FINSH_THREAD_PRIORITY
  52. int "The priority level value of thread"
  53. default 20
  54. help
  55. Priority of MSH shell thread (lower number = higher priority).
  56. Default: 20 (low priority)
  57. Recommendations:
  58. - Keep at low priority (15-25) to avoid blocking real-time tasks
  59. - Increase priority if shell responsiveness is critical
  60. - Must be less than RT_THREAD_PRIORITY_MAX
  61. Note: Shell executes user commands which may have high CPU usage.
  62. config FINSH_THREAD_STACK_SIZE
  63. int "The stack size for thread"
  64. default 4096
  65. help
  66. Stack size in bytes for the MSH shell thread.
  67. Default: 4096 bytes (4KB)
  68. Increase if:
  69. - Shell commands use deep recursion or large local variables
  70. - Running complex scripts
  71. - Stack overflow errors occur
  72. Decrease to save RAM on memory-constrained systems (minimum ~2KB).
  73. Note: Each command execution may require additional stack space.
  74. config FINSH_USING_HISTORY
  75. bool "Enable command history feature"
  76. default y
  77. help
  78. Enable command history buffer with up/down arrow key navigation.
  79. Features:
  80. - Recall previous commands with up arrow
  81. - Navigate forward with down arrow
  82. - Configurable number of history lines
  83. Memory cost: ~80 bytes × FINSH_HISTORY_LINES
  84. Enable for improved user experience during interactive sessions.
  85. Disable to save minimal RAM (~400 bytes with default 5 lines).
  86. if FINSH_USING_HISTORY
  87. config FINSH_HISTORY_LINES
  88. int "The command history line number"
  89. default 5
  90. help
  91. Number of command lines stored in history buffer.
  92. Default: 5 lines
  93. Each line uses ~80 bytes (FINSH_CMD_SIZE).
  94. Total memory: FINSH_HISTORY_LINES × FINSH_CMD_SIZE
  95. Increase for longer history (up to ~10-20 lines reasonable).
  96. Decrease to save RAM on constrained systems.
  97. endif
  98. config FINSH_USING_WORD_OPERATION
  99. bool "Enable word-based cursor operations"
  100. default n
  101. help
  102. Enable Ctrl+Backspace to delete words and Ctrl+Arrow to move cursor by word.
  103. Provides enhanced editing with word-boundary operations:
  104. - Ctrl+Backspace: Delete word before cursor
  105. - Ctrl+Left/Right Arrow: Move cursor by word
  106. Improves command-line editing efficiency for long commands.
  107. Minimal memory overhead (~100 bytes).
  108. config FINSH_USING_FUNC_EXT
  109. bool "Enable function extension home end ins del"
  110. default n
  111. help
  112. Enable extended function keys for cursor movement and editing.
  113. Supported keys:
  114. - Home: Move cursor to start of line
  115. - End: Move cursor to end of line
  116. - Insert: Toggle insert/overwrite mode
  117. - Delete: Delete character at cursor
  118. Provides familiar editing experience from standard terminals.
  119. Minimal memory overhead (~100 bytes).
  120. config FINSH_USING_SYMTAB
  121. bool "Using symbol table for commands"
  122. default y
  123. help
  124. Use symbol table to store and lookup shell commands.
  125. When enabled:
  126. - Commands registered via MSH_CMD_EXPORT() are stored in symbol table
  127. - Supports command name lookup and auto-completion
  128. - Enables help command to list all available commands
  129. Required for most shell functionality. Only disable for minimal
  130. configurations where commands are hard-coded.
  131. Disabling saves ~1-2KB depending on number of commands.
  132. config FINSH_CMD_SIZE
  133. int "The command line size for shell"
  134. default 80
  135. help
  136. Maximum length of a single command line including arguments.
  137. Default: 80 characters
  138. Increase if you need to:
  139. - Enter long file paths
  140. - Pass many arguments to commands
  141. - Use complex command pipelines
  142. Decrease to save RAM (minimum ~40 chars recommended).
  143. Memory impact: FINSH_CMD_SIZE bytes per command buffer +
  144. FINSH_CMD_SIZE × FINSH_HISTORY_LINES for history
  145. config MSH_USING_BUILT_IN_COMMANDS
  146. bool "Enable built-in commands, such as list_thread"
  147. default y
  148. help
  149. Include standard built-in shell commands.
  150. Built-in commands include:
  151. - System: help, version, reboot
  152. - Threads: list_thread (ps), list_sem, list_mutex, list_timer
  153. - Memory: free, memcheck, memtrace
  154. - File system: ls, cd, pwd, cat, rm, mkdir, etc.
  155. Disabling removes these commands but allows custom implementations.
  156. Saves ~4-8KB ROM depending on enabled features.
  157. Recommended to keep enabled unless implementing custom command set.
  158. config FINSH_USING_DESCRIPTION
  159. bool "Keeping description in symbol table"
  160. default y
  161. help
  162. Store command descriptions in symbol table for help text.
  163. When enabled:
  164. - 'help' command shows detailed description for each command
  165. - MSH_CMD_EXPORT() macro can include description parameter
  166. Cost: ~20-50 bytes per command for description strings
  167. Disable to save ROM if help text not needed in production.
  168. Keep enabled during development for better usability.
  169. config FINSH_ECHO_DISABLE_DEFAULT
  170. bool "Disable the echo mode in default"
  171. default n
  172. help
  173. Disable character echo by default when shell starts.
  174. When disabled (echo off):
  175. - Typed characters not displayed (useful for password input)
  176. - Can be toggled at runtime with 'echo' command
  177. Normal configuration: Keep disabled (echo enabled by default)
  178. Enable this option to start with echo off, useful for:
  179. - Security-sensitive applications
  180. - Non-interactive serial protocols
  181. - Automated test scripts
  182. config FINSH_USING_AUTH
  183. bool "shell support authentication"
  184. default n
  185. help
  186. Enable password authentication for shell access.
  187. Security features:
  188. - Password prompt on shell connection
  189. - Configurable password and length requirements
  190. - Locks shell until correct password entered
  191. Use cases:
  192. - Production systems with console access
  193. - Security-critical applications
  194. - Preventing unauthorized access via UART/Telnet
  195. Note: Password stored in plain text in firmware.
  196. For strong security, combine with encrypted communication.
  197. if FINSH_USING_AUTH
  198. config FINSH_DEFAULT_PASSWORD
  199. string "The default password for shell authentication"
  200. default "rtthread"
  201. help
  202. Default password required to access the shell.
  203. Default: "rtthread"
  204. Security recommendations:
  205. - Change from default in production systems
  206. - Use strong passwords (mix of letters, numbers, symbols)
  207. - Length between FINSH_PASSWORD_MIN and FINSH_PASSWORD_MAX
  208. Note: Password stored as plain text in firmware binary.
  209. Anyone with firmware access can extract the password.
  210. config FINSH_PASSWORD_MIN
  211. int "The password min length"
  212. default 6
  213. help
  214. Minimum password length in characters.
  215. Default: 6 characters
  216. Enforces minimum password strength. Increase for better security
  217. (recommended: 8+ characters for production).
  218. config FINSH_PASSWORD_MAX
  219. int "The password max length"
  220. default RT_NAME_MAX
  221. help
  222. Maximum password length in characters.
  223. Default: RT_NAME_MAX (typically 8)
  224. Limited by password buffer size. Increase RT_NAME_MAX if you
  225. need longer passwords, but consider memory constraints.
  226. endif
  227. config FINSH_ARG_MAX
  228. int "The number of arguments for a shell command"
  229. default 10
  230. help
  231. Maximum number of arguments (including command name) that can be
  232. passed to a single shell command.
  233. Default: 10 arguments
  234. Increase if you have commands that need many parameters.
  235. Each argument slot uses ~4 bytes (pointer size).
  236. Total memory: FINSH_ARG_MAX × sizeof(char*)
  237. config FINSH_USING_OPTION_COMPLETION
  238. bool "command option completion enable"
  239. default y
  240. help
  241. Enable tab completion for command options and arguments.
  242. Features:
  243. - Press Tab to auto-complete command names
  244. - Complete file paths when using file system commands
  245. - Show list of matches if multiple options available
  246. Greatly improves usability and reduces typing errors.
  247. Minimal memory overhead (~200 bytes).
  248. Recommended to keep enabled for interactive shells.
  249. endif