Kconfig 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. menuconfig RT_USING_SAL
  2. bool "SAL: socket abstraction layer"
  3. select RT_USING_NETDEV
  4. default n
  5. help
  6. SAL (Socket Abstraction Layer) provides unified BSD socket API for multiple network stacks.
  7. Features:
  8. - Standard BSD socket API (socket, bind, connect, send, recv, etc.)
  9. - Support multiple protocol stacks simultaneously
  10. - Network stack independence for applications
  11. - Automatic routing between different network interfaces
  12. Supported protocol stacks:
  13. - LwIP (full TCP/IP stack)
  14. - AT commands (for cellular/WiFi modules)
  15. - TLS/SSL (via MbedTLS)
  16. - Custom protocol stacks
  17. Benefits:
  18. - Write once, run on any supported network stack
  19. - Easy switching between WiFi, Ethernet, cellular
  20. - Multiple network connections concurrently
  21. - Standard POSIX socket compatibility
  22. Use cases:
  23. - Applications requiring network connectivity
  24. - Multi-interface systems (WiFi + Ethernet)
  25. - IoT devices with multiple network options
  26. - Network stack abstraction
  27. Enable for any application using network sockets.
  28. Overhead: ~4-6KB ROM, ~1KB RAM + socket buffers.
  29. if RT_USING_SAL
  30. config SAL_INTERNET_CHECK
  31. bool "Enable the ability that check internet status"
  32. select RT_USING_SYSTEM_WORKQUEUE
  33. default y
  34. help
  35. The ability that check internet status is provided by RT-Thread.
  36. config SOCKET_TABLE_STEP_LEN
  37. int "Configure socket table step length"
  38. default 4
  39. help
  40. Growth step size for dynamic socket table expansion.
  41. Default: 4 sockets
  42. When socket table is full, it grows by this many entries:
  43. - Initial size: SAL_SOCKETS_NUM
  44. - Grows by: SOCKET_TABLE_STEP_LEN when full
  45. Smaller values:
  46. + Less wasted memory
  47. - More frequent reallocations
  48. Larger values:
  49. + Fewer reallocations
  50. - More unused memory
  51. Recommended: 4-8 for most applications.
  52. menu "Docking with protocol stacks"
  53. config SAL_USING_LWIP
  54. bool "Docking with lwIP stack"
  55. default n
  56. help
  57. Integrate LwIP (Lightweight IP) TCP/IP stack with SAL.
  58. LwIP provides full-featured TCP/IP protocol stack:
  59. - TCP, UDP, ICMP, IGMP protocols
  60. - IPv4 and IPv6 support
  61. - DHCP client and server
  62. - DNS resolution
  63. - Raw socket support
  64. When enabled, applications can use BSD sockets backed by LwIP.
  65. Required for:
  66. - Ethernet networking
  67. - WiFi with full TCP/IP
  68. - Complex network protocols
  69. Enable if using LwIP as network stack.
  70. config SAL_USING_AT
  71. bool "Docking with AT commands stack"
  72. default n
  73. help
  74. Integrate AT command-based network modules with SAL.
  75. AT commands provide network connectivity through:
  76. - Cellular modules (2G/3G/4G/5G/NB-IoT)
  77. - WiFi modules (ESP8266, ESP32, etc.)
  78. - Bluetooth modules
  79. Features:
  80. - BSD socket API over AT commands
  81. - Transparent to applications
  82. - Supports multiple AT devices
  83. - Hardware offload (module handles TCP/IP)
  84. Advantages:
  85. - Lower MCU resource usage
  86. - Faster time-to-market
  87. - Leverages module's TCP/IP stack
  88. Use cases:
  89. - IoT devices with cellular connectivity
  90. - Low-power WiFi applications
  91. - Systems with network co-processors
  92. Enable for AT command-based network modules.
  93. config SAL_USING_TLS
  94. bool "Docking with MbedTLS protocol"
  95. default n
  96. help
  97. Integrate MbedTLS for SSL/TLS secure communication.
  98. MbedTLS provides:
  99. - SSL/TLS encryption (TLS 1.0-1.3)
  100. - X.509 certificate handling
  101. - Secure sockets (HTTPS, MQTTS, etc.)
  102. - Cryptographic primitives
  103. Features:
  104. - Transparent SSL/TLS layer over SAL
  105. - Certificate verification
  106. - Multiple cipher suites
  107. - Session resumption
  108. Use cases:
  109. - HTTPS web clients/servers
  110. - Secure MQTT (MQTTS)
  111. - Encrypted data transmission
  112. - Cloud service connections (AWS, Azure, etc.)
  113. Requirements:
  114. - MbedTLS package
  115. - Network stack (LwIP or AT)
  116. - Sufficient RAM for TLS buffers (~20-40KB)
  117. Enable for secure network communications.
  118. endmenu
  119. config SAL_USING_POSIX
  120. bool
  121. depends on DFS_USING_POSIX
  122. default y
  123. help
  124. Enable BSD socket operations via file system API.
  125. When enabled, sockets can be used like files:
  126. - open/close for socket creation/destruction
  127. - read/write for send/receive
  128. - select/poll for I/O multiplexing
  129. - File descriptor sharing with regular files
  130. Benefits:
  131. - Unified I/O model (files + sockets)
  132. - Compatible with POSIX I/O functions
  133. - Works with select/poll
  134. - Easier application porting from Linux
  135. Automatically enabled when DFS with POSIX is available.
  136. Required for RT-Smart user-space socket access.
  137. config SAL_SOCKETS_NUM
  138. int "the maximum number of sockets"
  139. depends on !SAL_USING_POSIX
  140. default 16
  141. help
  142. Maximum number of sockets that can be created simultaneously.
  143. Default: 16 sockets
  144. Each socket uses:
  145. - ~100-200 bytes for socket structure
  146. - Send/receive buffers (protocol stack dependent)
  147. Increase for:
  148. - Server applications with many concurrent connections
  149. - Applications opening multiple sockets
  150. Decrease to save memory on constrained systems.
  151. Note: Not used when SAL_USING_POSIX enabled (uses DFS_FD_MAX instead).
  152. endif