1# Copyright (c) 2022 Nordic Semiconductor ASA
2# Copyright 2025 NXP
3# SPDX-License-Identifier: Apache-2.0
4
5config OPENTHREAD
6	bool "OpenThread Support"
7	imply FLASH
8	imply FLASH_MAP
9	imply MPU_ALLOW_FLASH_WRITE
10	select SETTINGS if FLASH
11	select OPENTHREAD_SETTINGS_RAM if !FLASH
12	select CPP
13	select REBOOT
14	select ENTROPY_GENERATOR
15	help
16	  This option enables the OpenThread library
17
18if OPENTHREAD
19
20config OPENTHREAD_SYS_INIT
21	bool "Initialize OpenThread stack during system initialization"
22	default y
23	depends on !NET_L2_OPENTHREAD
24	help
25	  This option initializes the OpenThread automatically by calling the openthread_init()
26	  function during system initialization.
27
28config OPENTHREAD_SYS_INIT_PRIORITY
29	int "OpenThread system initialization priority"
30	default 40
31	depends on OPENTHREAD_SYS_INIT
32	help
33	  This option sets the priority of the OpenThread system initialization.
34
35choice OPENTHREAD_IMPLEMENTATION
36	prompt "OpenThread origin selection"
37	help
38	  Select OpenThread stack 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	help
64	  This option enables logging support for OpenThread.
65
66choice OPENTHREAD_LOG_LEVEL_CHOICE
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"
74
75config OPENTHREAD_LOG_LEVEL_WARN
76	bool "Warning"
77
78config OPENTHREAD_LOG_LEVEL_NOTE
79	bool "Notice"
80
81config OPENTHREAD_LOG_LEVEL_INFO
82	bool "Informational"
83
84config OPENTHREAD_LOG_LEVEL_DEBG
85	bool "Debug"
86
87endchoice # OPENTHREAD_LOG_LEVEL_CHOICE
88
89config OPENTHREAD_LOG_LEVEL
90	int
91	default 1 if OPENTHREAD_LOG_LEVEL_CRIT
92	default 2 if OPENTHREAD_LOG_LEVEL_WARN
93	default 3 if OPENTHREAD_LOG_LEVEL_NOTE
94	default 4 if OPENTHREAD_LOG_LEVEL_INFO
95	default 5 if OPENTHREAD_LOG_LEVEL_DEBG
96	default 0
97	help
98	  Log level for OpenThread stack.
99
100config OPENTHREAD_PLATFORM_LOG_LEVEL
101	int
102	default 1 if OPENTHREAD_LOG_LEVEL_CRIT
103	default 2 if OPENTHREAD_LOG_LEVEL_WARN
104	default 3 if OPENTHREAD_LOG_LEVEL_NOTE || OPENTHREAD_LOG_LEVEL_INFO
105	default 4 if OPENTHREAD_LOG_LEVEL_DEBG
106	default 0
107	help
108	  Log level for OpenThread Zephyr platform.
109
110endmenu # "Logging"
111
112menu "Zephyr optimizations"
113
114config OPENTHREAD_THREAD_PREEMPTIVE
115	bool "Set Openthread thread to be preemptive"
116
117config OPENTHREAD_THREAD_PRIORITY
118	int "OpenThread thread priority"
119	default 0 if OPENTHREAD_THREAD_PREEMPTIVE
120	default 8
121
122config OPENTHREAD_THREAD_STACK_SIZE
123	int "OpenThread thread stack size"
124	default 6144 if OPENTHREAD_COMMISSIONER || OPENTHREAD_JOINER
125	default 6240 if (OPENTHREAD_COMMISSIONER || OPENTHREAD_JOINER) && MPU_STACK_GUARD && FPU_SHARING && CPU_CORTEX_M
126	default 3168 if MPU_STACK_GUARD && FPU_SHARING && CPU_CORTEX_M
127	default 3072
128
129config OPENTHREAD_PKT_LIST_SIZE
130	int "List size for IPv6 packet buffering"
131	default 10
132
133config OPENTHREAD_RADIO_WORKQUEUE_STACK_SIZE
134	int "OpenThread radio transmit workqueue stack size"
135	default 608 if MPU_STACK_GUARD && FPU_SHARING && CPU_CORTEX_M
136	default 512
137
138config OPENTHREAD_RADIO_WORKQUEUE_PRIORITY
139	int "OpenThread radio transmit workqueue priority"
140	default 0 if OPENTHREAD_THREAD_PREEMPTIVE
141	default 7
142
143endmenu # "Zephyr optimizations"
144
145config OPENTHREAD_SHELL
146	bool "OpenThread shell"
147	depends on SHELL
148
149config MBEDTLS_PROMPTLESS
150	default y if !CUSTOM_OPENTHREAD_SECURITY
151
152choice OPENTHREAD_SECURITY
153	prompt "OpenThread security"
154	default OPENTHREAD_MBEDTLS_CHOICE
155
156config CUSTOM_OPENTHREAD_SECURITY
157	bool "Custom"
158	help
159	  Security settings will be controlled directly by the user.
160	  Enabling this setting will give access to full control of mbed TLS
161	  configuration.
162
163config OPENTHREAD_MBEDTLS_CHOICE
164	bool "mbed TLS built-in"
165	select OPENTHREAD_MBEDTLS
166	help
167	  Use the OpenThread mbed TLS configuration pre-defined security scheme.
168
169endchoice
170
171config OPENTHREAD_MBEDTLS
172	bool
173	select MBEDTLS
174	select MBEDTLS_ENABLE_HEAP
175	select MBEDTLS_CIPHER_AES_ENABLED
176	select MBEDTLS_CIPHER_CCM_ENABLED
177	select MBEDTLS_SHA256
178	select MBEDTLS_ENTROPY_C
179	select MBEDTLS_CMAC
180	select MBEDTLS_CIPHER
181	select MBEDTLS_MD
182	select MBEDTLS_TLS_VERSION_1_2 if OPENTHREAD_COMMISSIONER || OPENTHREAD_JOINER
183	select MBEDTLS_DTLS if OPENTHREAD_COMMISSIONER || OPENTHREAD_JOINER
184	select MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED if OPENTHREAD_COMMISSIONER || OPENTHREAD_JOINER
185	select MBEDTLS_ECJPAKE_C if OPENTHREAD_COMMISSIONER || OPENTHREAD_JOINER
186	select MBEDTLS_ECP_DP_SECP256R1_ENABLED if OPENTHREAD_COMMISSIONER || OPENTHREAD_JOINER || \
187	    OPENTHREAD_SRP_CLIENT || OPENTHREAD_SRP_SERVER
188	select MBEDTLS_ECP_NIST_OPTIM if OPENTHREAD_COMMISSIONER || OPENTHREAD_JOINER
189	select MBEDTLS_CTR_DRBG_ENABLED if OPENTHREAD_COMMISSIONER || OPENTHREAD_JOINER
190	select MBEDTLS_HMAC_DRBG_ENABLED if OPENTHREAD_COMMISSIONER || OPENTHREAD_JOINER || \
191	    OPENTHREAD_SRP_CLIENT || OPENTHREAD_SRP_SERVER
192	select MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED if OPENTHREAD_ECDSA
193	select MBEDTLS_ECDH_C if OPENTHREAD_ECDSA
194	select MBEDTLS_ECDSA_C if OPENTHREAD_ECDSA
195	select MBEDTLS_ECDSA_DETERMINISTIC if OPENTHREAD_ECDSA
196	select MBEDTLS_PK_WRITE_C if OPENTHREAD_ECDSA
197	select MBEDTLS_ECP_C if OPENTHREAD_COMMISSIONER || OPENTHREAD_JOINER || OPENTHREAD_ECDSA
198
199config OPENTHREAD_MBEDTLS_LIB_NAME
200	string "mbedtls lib name"
201	default "mbedTLS"
202	help
203	  This option allows to specify one or more mbedtls library files to be
204	  linked with OpenThread. Separate multiple values with space " ".
205
206config OPENTHREAD_COPROCESSOR
207	bool "OpenThread Co-Processor"
208	select OPENTHREAD_MANUAL_START
209	select RING_BUFFER
210	select UART_INTERRUPT_DRIVEN
211	help
212	  Enable Co-Processor in OpenThread stack.
213
214if OPENTHREAD_COPROCESSOR
215
216choice OPENTHREAD_COPROCESSOR_CHOICE
217	prompt "OpenThread Co-Processor type"
218	help
219	  This option selects Thread network co-processor type
220
221config OPENTHREAD_COPROCESSOR_NCP
222	bool "NCP - Network Co-Processor"
223
224config OPENTHREAD_COPROCESSOR_RCP
225	bool "RCP - Radio Co-Processor"
226
227endchoice # OPENTHREAD_COPROCESSOR_CHOICE
228
229config OPENTHREAD_COPROCESSOR_UART_RING_BUFFER_SIZE
230	int "Set Co-Processor UART ring buffer size"
231	default 4096
232	help
233	  TX buffer size for the OpenThread Co-Processor UART.
234
235config OPENTHREAD_COPROCESSOR_VENDOR_HOOK_SOURCE
236	string "Path to vendor hook source file"
237	help
238	  Provides path to compile vendor hook file.
239
240endif # OPENTHREAD_COPROCESSOR
241
242config OPENTHREAD_PLATFORM_INFO
243	string "Platform information for OpenThread"
244	default "ZEPHYR"
245	help
246	  Platform information for OpenThread
247
248config OPENTHREAD_CUSTOM_PARAMETERS
249	string "Custom Parameters to pass to OpenThread build system"
250	default ""
251	help
252	  This option is intended for advanced users only.
253	  Pass additional parameters that do not have corresponding Kconfig
254	  options to the OpenThread build system. Separate multiple values with
255	  space " ", for example:
256	  "OPENTHREAD_CONFIG_JOINER_ENABLE=1 OPENTHREAD_CONFIG_JOINER_MAX_CANDIDATES=3"
257
258config OPENTHREAD_NUM_MESSAGE_BUFFERS
259	int "The number of message buffers in the buffer pool"
260	default 128
261	help
262	  "The number of message buffers in the buffer pool."
263
264config OPENTHREAD_MESSAGE_BUFFER_SIZE
265	int "The size of a message buffer in bytes"
266	default 128
267	help
268	  "The size of a message buffer in bytes"
269
270config OPENTHREAD_PLATFORM_MESSAGE_MANAGEMENT
271	bool "Use platform message management"
272	help
273	  The message pool is managed by platform defined logic.
274
275config OPENTHREAD_MAX_STATECHANGE_HANDLERS
276	int "The maximum number of state-changed callback handlers"
277	default 2
278	help
279	  The maximum number of state-changed callback handlers
280	  set using otSetStateChangedCallback.
281
282config OPENTHREAD_TMF_ADDRESS_CACHE_ENTRIES
283	int "The number of EID-to-RLOC cache entries"
284	default 20
285	help
286	  The number of EID-to-RLOC cache entries.
287
288config OPENTHREAD_TMF_ADDRESS_CACHE_MAX_SNOOP_ENTRIES
289	int "The maximum number of EID-to-RLOC cache entries"
290	default 2
291	help
292	  The maximum number of EID-to-RLOC cache entries that can be used for
293	  "snoop optimization" where an entry is created by inspecting a received
294	  message.
295
296config OPENTHREAD_LOG_PREPEND_LEVEL_ENABLE
297	bool "Prepending the log level to all OpenThread log messages"
298	help
299	  When enabled the OpenThread logs will be prepended with the appropriate
300	  log level prefix i.e. [CRIT], [WARN], [NOTE], [INFO], [DEBG].
301
302config OPENTHREAD_MAC_SOFTWARE_ACK_TIMEOUT_ENABLE
303	bool "Software ACK timeout logic"
304	default y
305	help
306	  Set y if the radio supports AckTime event
307
308config OPENTHREAD_MAC_SOFTWARE_RETRANSMIT_ENABLE
309	bool "Software retransmission logic"
310	default y
311	help
312	  Set y if the radio supports tx retry logic with collision avoidance (CSMA)
313
314config OPENTHREAD_MAC_SOFTWARE_CSMA_BACKOFF_ENABLE
315	bool "Software CSMA backoff logic"
316	default y
317	help
318	  Set y to enable software CSMA backoff. The option can be disabled if
319	  the radio has hardware support for this feature (IEEE802154_HW_CSMA).
320
321config OPENTHREAD_CRYPTO_PSA
322	bool "ARM PSA crypto API"
323	depends on MBEDTLS_PSA_CRYPTO_CLIENT
324	select OPENTHREAD_PLATFORM_KEY_REF if !OPENTHREAD_COPROCESSOR_RCP
325	imply OPENTHREAD_PLATFORM_KEYS_EXPORTABLE_ENABLE
326	help
327	  Enable crypto backend library implementation based on ARM PSA crypto
328	  API instead of the default, using mbedTLS.
329
330config OPENTHREAD_PLATFORM_KEYS_EXPORTABLE_ENABLE
331	bool "Make MAC keys exportable"
332	depends on OPENTHREAD_PLATFORM_KEY_REF
333	help
334	  Enable the creation of exportable MAC keys in the OpenThread Key Manager.
335
336config OPENTHREAD_INTERFACE_EARLY_UP
337	bool "Make OpenThread interface ready as soon as Thread is enabled"
338	help
339	  When enabled, OpenThread interface will be marked ready (operational
340	  UP) as soon as Thread has been enabled. This means the interface will
341	  be ready to transmit application packets during the Mesh Link
342	  Establishment phase.
343	  Otherwise, OpenThread interface will be marked operational UP only
344	  after the device joins a Thread network.
345
346config OPENTHREAD_PLATFORM_PKT_TXTIME
347	bool
348	default y if NET_PKT_TXTIME
349	help
350	  Enable packet TX time support. This is needed for when the application
351	  wants to set the exact time when the packet should be sent.
352
353config OPENTHREAD_PLATFORM_CARRIER_FUNCTIONS
354	bool
355	default y if OPENTHREAD_DIAG && IEEE802154_CARRIER_FUNCTIONS
356	help
357	  Enable support for functions such as modulated carrier and continuous carrier.
358
359config OPENTHREAD_ZEPHYR_BORDER_ROUTER
360	bool "Adds support for Border Router functionality [EXPERIMENTAL]"
361	select EXPERIMENTAL
362	imply NET_ROUTING
363	help
364	  Enable support for Border Router using Openthread's implementation.
365
366menu "OpenThread stack features"
367rsource "Kconfig.features"
368endmenu
369
370menu "Thread Network configuration"
371rsource "Kconfig.thread"
372endmenu
373
374endif # OPENTHREAD
375