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