Kconfig 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374
  1. menuconfig RT_USING_LWP
  2. bool "lwP(light weight Process)"
  3. depends on RT_USING_SMART
  4. default y
  5. help
  6. LWP (Light Weight Process) provides user-space process support in RT-Smart mode.
  7. Features:
  8. - User-space and kernel-space separation
  9. - Process isolation with MMU/MPU
  10. - POSIX process APIs (fork, exec, waitpid, etc.)
  11. - Inter-process communication (IPC)
  12. - Signal handling
  13. - Dynamic linking and loading (LDSO)
  14. Benefits:
  15. - Memory protection between processes
  16. - Fault isolation (process crash doesn't affect kernel)
  17. - Multi-user application support
  18. - Better security and stability
  19. Requirements:
  20. - RT_USING_SMART must be enabled
  21. - CPU with MMU or MPU support
  22. - DFS v2.0 for file system access
  23. Use cases:
  24. - Running untrusted user applications
  25. - Mixed-criticality systems
  26. - Applications requiring process isolation
  27. - POSIX application porting
  28. Note: LWP is the foundation of RT-Smart user-space support.
  29. Required for running user-space applications.
  30. if RT_USING_LWP
  31. menuconfig LWP_DEBUG
  32. bool "Enable debugging features of LwP"
  33. default n
  34. help
  35. Enable debugging and tracing features for LWP processes.
  36. Debug features:
  37. - Process state transitions logging
  38. - Memory allocation tracking
  39. - IPC operation tracing
  40. - Signal delivery monitoring
  41. Useful for:
  42. - Development and debugging
  43. - Troubleshooting process issues
  44. - Performance analysis
  45. - System behavior understanding
  46. Overhead:
  47. - Increased log output
  48. - Slightly slower process operations
  49. - Additional ROM for debug strings (~2-4KB)
  50. Enable during development, disable in production for performance.
  51. if LWP_DEBUG
  52. config LWP_DEBUG_INIT
  53. select RT_USING_HOOKLIST
  54. bool "Enable debug mode of init process"
  55. depends on LWP_USING_RUNTIME
  56. default y
  57. help
  58. Enable detailed debugging for init process (PID 1).
  59. Traces init process activities:
  60. - Boot script execution
  61. - Child process spawning
  62. - Signal handling
  63. - Shutdown sequence
  64. Useful for debugging system startup and shutdown issues.
  65. Requires LWP_USING_RUNTIME enabled.
  66. endif
  67. config LWP_USING_RUNTIME
  68. bool "Using processes runtime environment (INIT process)"
  69. default y
  70. help
  71. Enable init process and runtime environment for user-space.
  72. Provides Linux-like init system (PID 1) that:
  73. - Starts as first user process
  74. - Executes boot scripts (/etc/rc.local, /etc/init.d/*)
  75. - Manages system lifecycle
  76. - Handles orphaned processes
  77. - Provides system commands (poweroff, reboot, shutdown)
  78. Features:
  79. - Boot script support for auto-starting applications
  80. - Graceful shutdown handling
  81. - Process reaping (zombie cleanup)
  82. - System service management
  83. Required for:
  84. - Complete RT-Smart user-space environment
  85. - Automatic application startup
  86. - System lifecycle management
  87. Disable only for minimal systems without init process.
  88. config RT_LWP_MAX_NR
  89. int "The max number of light-weight process"
  90. default 30
  91. help
  92. Maximum number of processes that can run simultaneously.
  93. Default: 30 processes
  94. Each process uses:
  95. - ~200-400 bytes for process control block
  96. - Separate page tables (MMU systems)
  97. - Individual memory spaces
  98. Total memory: RT_LWP_MAX_NR × ~300 bytes (minimum)
  99. Increase for:
  100. - Systems running many concurrent applications
  101. - Multi-user environments
  102. Decrease to save memory on constrained systems.
  103. Minimum recommended: 8-10 processes.
  104. config LWP_TASK_STACK_SIZE
  105. int "The lwp thread kernel stack size"
  106. default 16384
  107. help
  108. Kernel stack size for each LWP thread in bytes.
  109. Default: 16384 bytes (16KB)
  110. This is the kernel-mode stack used when process enters kernel via:
  111. - System calls
  112. - Exception handling
  113. - Interrupt processing
  114. Stack usage depends on:
  115. - System call complexity
  116. - Nested interrupt depth
  117. - Kernel function call chains
  118. Increase if:
  119. - Kernel stack overflow errors
  120. - Deep system call nesting
  121. - Complex device drivers
  122. Decrease to save RAM (minimum ~8KB for basic operations).
  123. Each LWP thread requires this much kernel stack.
  124. config RT_CH_MSG_MAX_NR
  125. int "The maximum number of channel messages"
  126. default 1024
  127. help
  128. Maximum number of messages in channel IPC message pool.
  129. Default: 1024 messages
  130. Channels provide RT-Thread's native IPC mechanism for LWP:
  131. - Higher performance than POSIX IPC
  132. - Direct memory-mapped communication
  133. - Zero-copy message passing
  134. Each message slot uses ~32-64 bytes depending on message size.
  135. Increase for:
  136. - High-frequency IPC between processes
  137. - Many concurrent channel communications
  138. Decrease to save memory if channel IPC not heavily used.
  139. config LWP_TID_MAX_NR
  140. int "The maximum number of lwp thread id"
  141. default 64
  142. help
  143. Maximum number of thread IDs available for LWP threads.
  144. Default: 64 thread IDs
  145. Each process can create multiple threads. This limits total
  146. thread IDs across all processes.
  147. Typical usage:
  148. - Single-threaded processes: 1 TID each
  149. - Multi-threaded processes: N TIDs per process
  150. Total threads = sum of threads in all processes
  151. Increase for:
  152. - Applications creating many threads
  153. - Many multi-threaded processes
  154. Decrease if applications mostly single-threaded.
  155. config LWP_ENABLE_ASID
  156. bool "The switch of ASID feature"
  157. depends on ARCH_ARM_CORTEX_A
  158. default y
  159. help
  160. Enable Address Space ID (ASID) for Cortex-A processors.
  161. ASID provides hardware-based process identification:
  162. - Tags TLB entries with process ID
  163. - Avoids TLB flush on context switch
  164. - Significantly faster process switching
  165. Performance impact:
  166. - 50-70% faster context switch between processes
  167. - Better TLB hit rate
  168. - Reduced MMU overhead
  169. Automatically enabled for Cortex-A (recommended).
  170. Only disable for debugging TLB-related issues.
  171. Note: Requires CPU with ASID support (ARMv7-A and above).
  172. if ARCH_MM_MMU
  173. config RT_LWP_SHM_MAX_NR
  174. int "The maximum number of shared memory"
  175. default 64
  176. help
  177. Maximum number of shared memory segments for inter-process communication.
  178. Default: 64 segments
  179. Shared memory provides:
  180. - Fastest IPC method (direct memory access)
  181. - POSIX shm_open()/shm_unlink() APIs
  182. - mmap() for memory-mapped sharing
  183. Each segment descriptor uses ~40-60 bytes.
  184. Increase for:
  185. - Applications using extensive shared memory
  186. - Multiple processes sharing data
  187. - High-performance IPC requirements
  188. Decrease to save memory if shared memory rarely used.
  189. config LWP_USING_MPROTECT
  190. bool
  191. default n
  192. help
  193. Architecture has mprotect() support for memory protection.
  194. mprotect() allows changing memory region permissions:
  195. - Read, write, execute permissions
  196. - Guard pages for stack overflow detection
  197. - Memory region isolation
  198. Automatically enabled by architecture support.
  199. User does not configure directly.
  200. endif
  201. if ARCH_MM_MPU
  202. config RT_LWP_MPU_MAX_NR
  203. int "The maximum number of mpu region"
  204. default 2
  205. help
  206. Maximum number of MPU regions per process.
  207. Default: 2 regions per process
  208. MPU provides memory protection without full MMU:
  209. - Limited number of protection regions
  210. - Simpler than MMU but less flexible
  211. Regions typically used for:
  212. - Code region (read-execute)
  213. - Data region (read-write)
  214. - Stack guard region
  215. Limited by hardware MPU region count.
  216. Check your CPU MPU capabilities.
  217. config RT_LWP_USING_SHM
  218. bool "Enable shared memory"
  219. default y
  220. help
  221. Enable shared memory support for MPU-based systems.
  222. Provides shared memory IPC even without MMU:
  223. - Processes can share memory regions
  224. - Requires careful MPU configuration
  225. - More limited than MMU-based sharing
  226. Enable for IPC in MPU-only systems (Cortex-M with MPU).
  227. Disable if not using shared memory to save ~1-2KB ROM.
  228. endif
  229. menuconfig RT_USING_LDSO
  230. bool "LDSO: dynamic load shared objects"
  231. depends on RT_USING_DFS_V2
  232. select RT_USING_PAGECACHE
  233. default y
  234. help
  235. Enable dynamic linker/loader for shared libraries and executables.
  236. LDSO (LD.SO - Link editor, Shared Object) provides:
  237. - Dynamic linking of shared libraries (.so files)
  238. - Runtime loading of executables (ELF files)
  239. - Symbol resolution and relocation
  240. - Lazy binding for faster startup
  241. Features:
  242. - Load executables from file system
  243. - Share library code between processes (saves RAM)
  244. - Update libraries without recompiling applications
  245. - Standard ELF binary support
  246. Requirements:
  247. - DFS v2.0 for file system access
  248. - Page cache for performance
  249. Use cases:
  250. - Running standard Linux binaries
  251. - Modular application architecture
  252. - Shared library usage
  253. - Dynamic plugin loading
  254. Essential for RT-Smart user-space applications.
  255. ROM overhead: ~10-15KB for LDSO implementation.
  256. if RT_USING_LDSO
  257. config ELF_DEBUG_ENABLE
  258. bool "Enable ldso debug"
  259. default n
  260. help
  261. Enable debugging output for dynamic linker/loader operations.
  262. Debug information includes:
  263. - Library loading and unloading
  264. - Symbol resolution process
  265. - Relocation details
  266. - Memory mapping operations
  267. Useful for:
  268. - Troubleshooting loading failures
  269. - Understanding dependency chains
  270. - Debugging symbol resolution issues
  271. Disable in production for reduced log output and smaller ROM.
  272. config ELF_LOAD_RANDOMIZE
  273. bool "Enable random load address"
  274. default n
  275. help
  276. Enable ASLR (Address Space Layout Randomization) for loaded binaries.
  277. Security feature that randomizes:
  278. - Executable base address
  279. - Shared library load addresses
  280. - Stack and heap positions
  281. Benefits:
  282. - Harder to exploit buffer overflows
  283. - Prevents return-to-libc attacks
  284. - Increases security against memory exploits
  285. Overhead:
  286. - Slightly slower loading
  287. - More complex debugging (non-deterministic addresses)
  288. Enable for security-critical applications.
  289. Disable for easier debugging or deterministic behavior.
  290. endif
  291. rsource "terminal/Kconfig"
  292. rsource "vdso/Kconfig"
  293. endif