Skip to content

Commit 66e78e0

Browse files
ArekBalysNordickartben
authored andcommitted
openthread: Separate OpenThread Kconfigs from L2 layer
Moved OpenThread-related Kconfigs from L2 layer to modules/openthread. All of those configs were not strictly related to the L2 layer, so they fits better to OpenThread module. This operation allows using OpenThread Kconfigs even if L2 layer is disabled. Enabling NET_L2_OPENTHREAD also configures those configs by selecting the OPENTHREAD kconfig, so there is no change regarding backwards compatibility. The only change is that the Kconfigs related to Thread were moved to the modules space, so their location in the menuconfig also changed. Once it is done, a choice for setting different L2 implementations seems to be redundant. Signed-off-by: Arkadiusz Balys <[email protected]>
1 parent a07b656 commit 66e78e0

File tree

3 files changed

+317
-322
lines changed

3 files changed

+317
-322
lines changed

modules/openthread/Kconfig

+312
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,323 @@
33

44
config OPENTHREAD
55
bool "OpenThread Support"
6+
imply FLASH
7+
imply FLASH_MAP
8+
imply MPU_ALLOW_FLASH_WRITE
9+
10+
select SETTINGS if FLASH
11+
select OPENTHREAD_SETTINGS_RAM if !FLASH
12+
select CPP
13+
select REBOOT
14+
select ENTROPY_GENERATOR
615
help
716
This option enables the OpenThread library
817

918
if OPENTHREAD
1019

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

subsys/net/l2/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ if(CONFIG_NET_L2_IEEE802154)
2424
add_subdirectory(ieee802154)
2525
endif()
2626

27-
if(CONFIG_NET_L2_OPENTHREAD_IMPLEMENTATION_ZEPHYR)
27+
if(CONFIG_NET_L2_OPENTHREAD)
2828
add_subdirectory(openthread)
2929
endif()
3030

0 commit comments

Comments
 (0)