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