Skip to content

Commit bcd7600

Browse files
modules: openthread: Allow building nrf5 networking backend
Prepared build environment to support building OpenThread without Zephyr's L2 and IEEE802.15.4 shim layers. To do it, some of Kconfigs must be cloned into the new Kconfig file (dedicated to nRF5-driver-based approach) to meet all OpenThread requirements while NET_L2_OPENTHREAD is disabled. - Created Kconfig.nrf5 and Kconfig.nrf5.defconfig files to define all Kconfig needed by OpenThread that were definied previously in Zephyr L2 layer's Kconfig file. - Added OPENTHREAD_NETWORKING_BACKEND choice to switch between legacy Zephyr Networking layer and new nRF5-driver-based solution - Disabled some dependency to Zephyr's L2 layer in the platform files - this will be fixed in the next phase. Signed-off-by: Arkadiusz Balys <[email protected]>
1 parent c95eaff commit bcd7600

File tree

13 files changed

+467
-68
lines changed

13 files changed

+467
-68
lines changed

modules/openthread/Kconfig

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,63 @@
11
# Copyright (c) 2022 Nordic Semiconductor ASA
22
# SPDX-License-Identifier: Apache-2.0
33

4+
choice OPENTHREAD_NETWORKING_BACKEND
5+
prompt "OpenThread networking backend"
6+
default OPENTHREAD_NETWORKING_BACKEND_ZEPHYR
7+
8+
config OPENTHREAD_NETWORKING_BACKEND_ZEPHYR
9+
bool "Zephyr networking backend"
10+
select NET_L2_OPENTHREAD
11+
select NETWORKING
12+
help
13+
Use Zephyr's networking, L2 and IEEE802.15.4 shim layers for OpenThread stack.
14+
15+
config OPENTHREAD_NETWORKING_BACKEND_NRF5
16+
bool "Direct nRF5 radio driver calls"
17+
depends on DT_HAS_NORDIC_NRF_IEEE802154_ENABLED
18+
select NRF_802154_RADIO_DRIVER if HAS_HW_NRF_RADIO_IEEE802154
19+
select NRF_802154_SER_HOST if !HAS_HW_NRF_RADIO_IEEE802154
20+
select NRF_802154_RADIO_CONFIG
21+
22+
select OPENTHREAD
23+
select OPENTHREAD_NRF_SECURITY_PSA
24+
25+
imply FLASH
26+
imply FLASH_MAP
27+
imply MPU_ALLOW_FLASH_WRITE
28+
29+
select SETTINGS if FLASH
30+
select OPENTHREAD_SETTINGS_RAM if !FLASH
31+
select CPP
32+
select REBOOT
33+
select ENTROPY_GENERATOR
34+
help
35+
Use Nordic Semiconductor radio driver directly for OpenThread stack.
36+
This approach does not use Zephyr's L2 networking and IEEE802.15.4 shim layers.
37+
This option simplifies the integration architecture between nRF5 radio driver
38+
and OpenThread stack, and saves RAM and ROM.
39+
40+
Use this option only if you do not need to use Zephyr's L2 networking features.
41+
42+
endchoice
43+
444
config OPENTHREAD
545
bool "OpenThread Support"
646
help
747
This option enables the OpenThread library
848

949
if OPENTHREAD
1050

51+
if OPENTHREAD_NETWORKING_BACKEND_NRF5
52+
53+
rsource "Kconfig.nrf5.defconfig"
54+
55+
menu "OpenThread nrf5"
56+
rsource "Kconfig.nrf5"
57+
endmenu
58+
59+
endif
60+
1161
menu "OpenThread stack features"
1262
rsource "Kconfig.features"
1363
endmenu

modules/openthread/Kconfig.features

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -405,11 +405,3 @@ config OPENTHREAD_VERHOEFF_CHECKSUM
405405

406406
config OPENTHREAD_CLI_VENDOR_EXTENSION
407407
string "Path to CMake file to define and link Openthread CLI vendor extension"
408-
409-
config OPENTHREAD_USE_NRF5_RADIO
410-
bool "Use Nordic Semiconductor radio driver directly"
411-
default y
412-
depends on HAS_HW_NRF_RADIO_IEEE802154
413-
help
414-
Use explicitly Nordic Semiconductor radio driver for OpenThread stack.
415-
This approach does not use Zephyr's net_pkt and net_time APIs.

modules/openthread/Kconfig.nrf5

Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
# Copyright (c) 2021 Nordic Semiconductor
2+
#
3+
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
4+
#
5+
6+
# The purpose of this file is to define configuration options specific to the
7+
# Nordic Semiconductor radio driver.
8+
9+
if OPENTHREAD_NETWORKING_BACKEND_NRF5
10+
11+
choice OPENTHREAD_IMPLEMENTATION
12+
prompt "OpenThread origin selection"
13+
default OPENTHREAD_LIBRARY if OPENTHREAD_LIBRARY_AVAILABLE
14+
help
15+
Select OpenThread to use for build. Custom OpenThread implementations
16+
can be added to the application Kconfig.
17+
18+
config OPENTHREAD_SOURCES
19+
bool "OpenThread from sources"
20+
help
21+
Build Zephyr's OpenThread port from sources.
22+
23+
endchoice
24+
25+
config OPENTHREAD_MANUAL_START
26+
bool "Start OpenThread stack manually"
27+
help
28+
If enabled, OpenThread stack will have to be configured and
29+
started manually, with respective API calls or CLI/NCP commands.
30+
Otherwise, OpenThread will configure the network parameters and try to
31+
join the Thread network automatically during initialization (using
32+
credentials stored in persistent storage, obtained during
33+
commissioning or pre-commissioned with other Kconfig options,
34+
depending on configuration used).
35+
36+
config OPENTHREAD_SHELL
37+
bool "OpenThread shell"
38+
depends on SHELL
39+
40+
config OPENTHREAD_CRYPTO_PSA
41+
bool "ARM PSA crypto API"
42+
depends on MBEDTLS_PSA_CRYPTO_CLIENT
43+
select OPENTHREAD_PLATFORM_KEY_REF if !OPENTHREAD_COPROCESSOR_RCP
44+
imply OPENTHREAD_PLATFORM_KEYS_EXPORTABLE_ENABLE
45+
help
46+
Enable crypto backend library implementation based on ARM PSA crypto
47+
API instead of the default, using mbedTLS.
48+
49+
menuconfig OPENTHREAD_DEBUG
50+
bool "OpenThread stack logging support"
51+
help
52+
This option enables logging support for OpenThread.
53+
54+
config OPENTHREAD_PLATFORM_INFO
55+
string "Platform information for OpenThread"
56+
default "NRF"
57+
help
58+
Platform information for OpenThread
59+
60+
config OPENTHREAD_CUSTOM_PARAMETERS
61+
string "Custom Parameters to pass to OpenThread build system"
62+
default ""
63+
help
64+
This option is intended for advanced users only.
65+
Pass additional parameters that do not have corresponding Kconfig
66+
options to the OpenThread build system. Separate multiple values with
67+
space " ", for example:
68+
"OPENTHREAD_CONFIG_JOINER_ENABLE=1 OPENTHREAD_CONFIG_JOINER_MAX_CANDIDATES=3"
69+
70+
config OPENTHREAD_NUM_MESSAGE_BUFFERS
71+
int "The number of message buffers in the buffer pool"
72+
default 128
73+
help
74+
"The number of message buffers in the buffer pool."
75+
76+
config OPENTHREAD_MESSAGE_BUFFER_SIZE
77+
int "The size of a message buffer in bytes"
78+
default 128
79+
help
80+
"The size of a message buffer in bytes"
81+
82+
config OPENTHREAD_PLATFORM_MESSAGE_MANAGEMENT
83+
bool "Use platform message management"
84+
help
85+
The message pool is managed by platform defined logic.
86+
87+
config OPENTHREAD_MAX_STATECHANGE_HANDLERS
88+
int "The maximum number of state-changed callback handlers"
89+
default 2
90+
help
91+
The maximum number of state-changed callback handlers
92+
set using otSetStateChangedCallback.
93+
94+
config OPENTHREAD_TMF_ADDRESS_CACHE_ENTRIES
95+
int "The number of EID-to-RLOC cache entries"
96+
default 20
97+
help
98+
The number of EID-to-RLOC cache entries.
99+
100+
config OPENTHREAD_TMF_ADDRESS_CACHE_MAX_SNOOP_ENTRIES
101+
int "The maximum number of EID-to-RLOC cache entries"
102+
default 2
103+
help
104+
The maximum number of EID-to-RLOC cache entries that can be used for
105+
"snoop optimization" where an entry is created by inspecting a received
106+
message.
107+
108+
config OPENTHREAD_LOG_PREPEND_LEVEL_ENABLE
109+
bool "Prepending the log level to all OpenThread log messages"
110+
help
111+
When enabled the OpenThread logs will be prepended with the appropriate
112+
log level prefix i.e. [CRIT], [WARN], [NOTE], [INFO], [DEBG].
113+
114+
config OPENTHREAD_MAC_SOFTWARE_ACK_TIMEOUT_ENABLE
115+
bool "Software ACK timeout logic"
116+
default y
117+
help
118+
Set y if the radio supports AckTime event
119+
120+
config OPENTHREAD_MAC_SOFTWARE_RETRANSMIT_ENABLE
121+
bool "Software retransmission logic"
122+
default y
123+
help
124+
Set y if the radio supports tx retry logic with collision avoidance (CSMA)
125+
126+
config OPENTHREAD_MAC_SOFTWARE_CSMA_BACKOFF_ENABLE
127+
bool "Software CSMA backoff logic"
128+
default y
129+
help
130+
Set y to enable software CSMA backoff. The option can be disabled if
131+
the radio has hardware support for this feature (IEEE802154_HW_CSMA).
132+
133+
config OPENTHREAD_PLATFORM_KEYS_EXPORTABLE_ENABLE
134+
bool "Make MAC keys exportable"
135+
depends on OPENTHREAD_PLATFORM_KEY_REF
136+
help
137+
Enable the creation of exportable MAC keys in the OpenThread Key Manager.
138+
139+
endif # OPENTHREAD_USE_NRF5_RADIO

0 commit comments

Comments
 (0)