1# OpenThread driver configuration options
2
3# Copyright (c) 2018 Nordic Semiconductor ASA
4# SPDX-License-Identifier: Apache-2.0
5config OPENTHREAD_SECURITY_INTERNAL
6	bool
7	help
8	  OpenThread setting to signal that OpenThread security settings, such
9	  as the OPENTHREAD_MBEDTLS setting will be controlled through other
10	  Kconfig dependencies and should not be user configurable.
11
12menuconfig NET_L2_OPENTHREAD
13	bool "OpenThread L2"
14	depends on NETWORKING
15	select NET_L2_PHY_IEEE802154
16	select OPENTHREAD
17
18	imply FLASH
19	imply FLASH_MAP
20	imply MPU_ALLOW_FLASH_WRITE
21
22	select SETTINGS if FLASH
23	select OPENTHREAD_SETTINGS_RAM if !FLASH
24	select CPP
25	select REBOOT
26	select ENTROPY_GENERATOR
27
28	imply NET_UDP
29	imply NET_IPV6
30	imply NET_CONFIG_NEED_IPV6
31
32if NET_L2_OPENTHREAD
33
34choice OPENTHREAD_IMPLEMENTATION
35	prompt "OpenThread origin selection"
36	help
37	  Select OpenThread to use for build. Custom OpenThread implementations
38	  can be added to the application Kconfig.
39
40config OPENTHREAD_SOURCES
41	bool "OpenThread from sources"
42	help
43	  Build Zephyr's OpenThread port from sources.
44
45endchoice
46
47config OPENTHREAD_MANUAL_START
48	bool "Start OpenThread stack manually"
49	help
50	  If enabled, OpenThread stack will have to be configured and
51	  started manually, with respective API calls or CLI/NCP commands.
52	  Otherwise, OpenThread will configure the network parameters and try to
53	  join the Thread network automatically during initialization (using
54	  credentials stored in persistent storage, obtained during
55	  commissioning or pre-commissioned with other Kconfig options,
56	  depending on configuration used).
57
58menu "Logging"
59
60menuconfig OPENTHREAD_DEBUG
61	bool "OpenThread stack logging support"
62	depends on NET_L2_OPENTHREAD
63	help
64	  This option enables logging support for OpenThread.
65
66choice
67	prompt "OpenThread stack log level"
68	depends on OPENTHREAD_DEBUG
69	help
70	  This option selects log level for OpenThread stack.
71
72config OPENTHREAD_LOG_LEVEL_CRIT
73	bool "Critical"
74config OPENTHREAD_LOG_LEVEL_WARN
75	bool "Warning"
76config OPENTHREAD_LOG_LEVEL_NOTE
77	bool "Notice"
78config OPENTHREAD_LOG_LEVEL_INFO
79	bool "Informational"
80config OPENTHREAD_LOG_LEVEL_DEBG
81	bool "Debug"
82endchoice
83
84config OPENTHREAD_LOG_LEVEL
85	int
86	default 1 if OPENTHREAD_LOG_LEVEL_CRIT
87	default 2 if OPENTHREAD_LOG_LEVEL_WARN
88	default 3 if OPENTHREAD_LOG_LEVEL_NOTE
89	default 4 if OPENTHREAD_LOG_LEVEL_INFO
90	default 5 if OPENTHREAD_LOG_LEVEL_DEBG
91	default 0
92
93menuconfig OPENTHREAD_L2_DEBUG
94	bool "OpenThread L2 log support"
95	help
96	  This option enables log support for OpenThread.
97
98if OPENTHREAD_L2_DEBUG
99
100config OPENTHREAD_L2_DEBUG_DUMP_15_4
101	bool "Dump 802.15.4 packets"
102	help
103	  This option enables dumping of 802.15.4 packets.
104
105config OPENTHREAD_L2_DEBUG_DUMP_IPV6
106	bool "Dump IPv6 packets"
107	help
108	  This option enables dumping of IPv6 packets.
109
110endif # OPENTHREAD_L2_DEBUG
111
112module = OPENTHREAD_L2
113module-dep = NET_LOG
114module-str = Log level for OpenThread driver
115module-help = Enables OpenThread driver to output debug messages.
116source "subsys/net/Kconfig.template.log_config.net"
117
118endmenu # "Logging"
119
120menu "Zephyr optimizations"
121
122config OPENTHREAD_THREAD_PREEMPTIVE
123	bool "Set Openthread thread to be preemptive"
124
125config OPENTHREAD_THREAD_PRIORITY
126	int "OpenThread thread priority"
127	default 0 if OPENTHREAD_THREAD_PREEMPTIVE
128	default 8
129
130config OPENTHREAD_THREAD_STACK_SIZE
131	int "OpenThread thread stack size"
132	default 6144 if OPENTHREAD_COMMISSIONER || OPENTHREAD_JOINER
133	default 6240 if (OPENTHREAD_COMMISSIONER || OPENTHREAD_JOINER) && MPU_STACK_GUARD && FPU_SHARING && CPU_CORTEX_M
134	default 3168 if MPU_STACK_GUARD && FPU_SHARING && CPU_CORTEX_M
135	default 3072
136
137
138config OPENTHREAD_PKT_LIST_SIZE
139	int "List size for IPv6 packet buffering"
140	default 10
141
142config OPENTHREAD_RADIO_WORKQUEUE_STACK_SIZE
143	int "OpenThread radio transmit workqueue stack size"
144	default 608 if MPU_STACK_GUARD && FPU_SHARING && CPU_CORTEX_M
145	default 512
146
147endmenu # "Zephyr optimizations"
148
149config OPENTHREAD_SHELL
150	bool "OpenThread shell"
151	depends on SHELL
152
153config MBEDTLS_PROMPTLESS
154	bool
155	default y if !CUSTOM_OPENTHREAD_SECURITY
156
157choice OPENTHREAD_SECURITY
158	prompt "OpenThread security"
159	default OPENTHREAD_MBEDTLS_CHOICE
160	depends on !OPENTHREAD_SECURITY_INTERNAL
161
162config CUSTOM_OPENTHREAD_SECURITY
163	bool "Custom"
164	help
165	  Security settings will be controlled directly by the user.
166	  Enabling this setting will give access to full control of mbed TLS
167	  configuration.
168
169config OPENTHREAD_MBEDTLS_CHOICE
170	bool "mbed TLS built-in"
171	select OPENTHREAD_MBEDTLS
172	help
173	  Use the OpenThread mbed TLS configuration pre-defined security scheme.
174
175endchoice
176
177config OPENTHREAD_MBEDTLS
178	bool
179	select MBEDTLS
180	select MBEDTLS_ENABLE_HEAP
181	select MBEDTLS_CIPHER_AES_ENABLED
182	select MBEDTLS_CIPHER_CCM_ENABLED
183	select MBEDTLS_SHA256
184	select MBEDTLS_ENTROPY_C
185	select MBEDTLS_CMAC
186	select MBEDTLS_CIPHER
187	select MBEDTLS_MD
188	select MBEDTLS_TLS_VERSION_1_2 if OPENTHREAD_COMMISSIONER || OPENTHREAD_JOINER
189	select MBEDTLS_DTLS if OPENTHREAD_COMMISSIONER || OPENTHREAD_JOINER
190	select MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED if OPENTHREAD_COMMISSIONER || OPENTHREAD_JOINER
191	select MBEDTLS_ECJPAKE_C if OPENTHREAD_COMMISSIONER || OPENTHREAD_JOINER
192	select MBEDTLS_ECP_DP_SECP256R1_ENABLED if OPENTHREAD_COMMISSIONER || OPENTHREAD_JOINER || \
193	    OPENTHREAD_SRP_CLIENT || OPENTHREAD_SRP_SERVER
194	select MBEDTLS_ECP_NIST_OPTIM if OPENTHREAD_COMMISSIONER || OPENTHREAD_JOINER
195	select MBEDTLS_CTR_DRBG_ENABLED if OPENTHREAD_COMMISSIONER || OPENTHREAD_JOINER
196	select MBEDTLS_HMAC_DRBG_ENABLED if OPENTHREAD_COMMISSIONER || OPENTHREAD_JOINER || \
197	    OPENTHREAD_SRP_CLIENT || OPENTHREAD_SRP_SERVER
198	select MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED if OPENTHREAD_ECDSA
199	select MBEDTLS_ECDH_C if OPENTHREAD_ECDSA
200	select MBEDTLS_ECDSA_C if OPENTHREAD_ECDSA
201	select MBEDTLS_ECDSA_DETERMINISTIC if OPENTHREAD_ECDSA
202	select MBEDTLS_PK_WRITE_C if OPENTHREAD_ECDSA
203	select MBEDTLS_ECP_C if OPENTHREAD_COMMISSIONER || OPENTHREAD_JOINER || OPENTHREAD_ECDSA
204
205
206config OPENTHREAD_MBEDTLS_LIB_NAME
207	string "mbedtls lib name"
208	default "mbedTLS"
209	help
210	  This option allows to specify one or more mbedtls library files to be
211	  linked with OpenThread. Separate multiple values with space " ".
212
213config OPENTHREAD_COPROCESSOR
214	bool "OpenThread Co-Processor"
215	select OPENTHREAD_MANUAL_START
216	select RING_BUFFER
217	select UART_INTERRUPT_DRIVEN
218	help
219	  Enable Co-Processor in OpenThread stack.
220
221if OPENTHREAD_COPROCESSOR
222
223choice
224	prompt "OpenThread Co-Processor type"
225	help
226	  This option selects Thread network co-processor type
227
228config OPENTHREAD_COPROCESSOR_NCP
229	bool "NCP - Network Co-Processor"
230config OPENTHREAD_COPROCESSOR_RCP
231	bool "RCP - Radio Co-Processor"
232endchoice
233
234config OPENTHREAD_COPROCESSOR_UART_RING_BUFFER_SIZE
235	int "Set Co-Processor UART ring buffer size"
236	default 4096
237	help
238	  TX buffer size for the OpenThread Co-Processor UART.
239
240config OPENTHREAD_COPROCESSOR_VENDOR_HOOK_SOURCE
241	string "Path to vendor hook source file"
242	help
243	  Provides path to compile vendor hook file.
244
245endif # OPENTHREAD_COPROCESSOR
246
247config OPENTHREAD_PLATFORM_INFO
248	string "Platform information for OpenThread"
249	default "ZEPHYR"
250	help
251	  Platform information for OpenThread
252
253config OPENTHREAD_CUSTOM_PARAMETERS
254	string "Custom Parameters to pass to OpenThread build system"
255	default ""
256	help
257	  This option is intended for advanced users only.
258	  Pass additional parameters that do not have corresponding Kconfig
259	  options to the OpenThread build system. Separate multiple values with
260	  space " ", for example:
261	  "OPENTHREAD_CONFIG_JOINER_ENABLE=1 OPENTHREAD_CONFIG_JOINER_MAX_CANDIDATES=3"
262
263config OPENTHREAD_NUM_MESSAGE_BUFFERS
264	int "The number of message buffers in the buffer pool"
265	default 128
266	help
267	  "The number of message buffers in the buffer pool."
268
269config OPENTHREAD_MESSAGE_BUFFER_SIZE
270	int "The size of a message buffer in bytes"
271	default 128
272	help
273	  "The size of a message buffer in bytes"
274
275config OPENTHREAD_PLATFORM_MESSAGE_MANAGEMENT
276	bool "Use platform message management"
277	help
278	  The message pool is managed by platform defined logic.
279
280config OPENTHREAD_MAX_STATECHANGE_HANDLERS
281	int "The maximum number of state-changed callback handlers"
282	default 2
283	help
284	  The maximum number of state-changed callback handlers
285	  set using otSetStateChangedCallback.
286
287config OPENTHREAD_TMF_ADDRESS_CACHE_ENTRIES
288	int "The number of EID-to-RLOC cache entries"
289	default 20
290	help
291	  The number of EID-to-RLOC cache entries.
292
293config OPENTHREAD_TMF_ADDRESS_CACHE_MAX_SNOOP_ENTRIES
294	int "The maximum number of EID-to-RLOC cache entries"
295	default 2
296	help
297	  The maximum number of EID-to-RLOC cache entries that can be used for
298	  "snoop optimization" where an entry is created by inspecting a received
299	  message.
300
301config OPENTHREAD_LOG_PREPEND_LEVEL_ENABLE
302	bool "Prepending the log level to all OpenThread log messages"
303	help
304	  When enabled the OpenThread logs will be prepended with the appropriate
305	  log level prefix i.e. [CRIT], [WARN], [NOTE], [INFO], [DEBG].
306
307config OPENTHREAD_MAC_SOFTWARE_ACK_TIMEOUT_ENABLE
308	bool "Software ACK timeout logic"
309	default y
310	help
311	  Set y if the radio supports AckTime event
312
313config OPENTHREAD_MAC_SOFTWARE_RETRANSMIT_ENABLE
314	bool "Software retransmission logic"
315	default y
316	help
317	  Set y if the radio supports tx retry logic with collision avoidance (CSMA)
318
319config OPENTHREAD_MAC_SOFTWARE_CSMA_BACKOFF_ENABLE
320	bool "Software CSMA backoff logic"
321	default y
322	help
323	  Set y to enable software CSMA backoff. The option can be disabled if
324	  the radio has hardware support for this feature (IEEE802154_HW_CSMA).
325
326config OPENTHREAD_CRYPTO_PSA
327	bool "ARM PSA crypto API"
328	depends on MBEDTLS_PSA_CRYPTO_CLIENT
329	select OPENTHREAD_PLATFORM_KEY_REF if !OPENTHREAD_COPROCESSOR_RCP
330	imply OPENTHREAD_PLATFORM_KEYS_EXPORTABLE_ENABLE
331	help
332	  Enable crypto backend library implementation based on ARM PSA crypto
333	  API instead of the default, using mbedTLS.
334
335config OPENTHREAD_PLATFORM_KEYS_EXPORTABLE_ENABLE
336	bool "Make MAC keys exportable"
337	depends on OPENTHREAD_PLATFORM_KEY_REF
338	help
339	  Enable the creation of exportable MAC keys in the OpenThread Key Manager.
340
341endif # NET_L2_OPENTHREAD
342