Pre-built libraries
The nRF Connect SDK provides a set of OpenThread pre-built libraries. These pre-built libraries are available in nrfxlib and provide features and optional functionalities from the OpenThread stack. You can use these libraries for building applications with support for the complete Thread Specification.
To use a pre-built library, configure OpenThread to use pre-built libraries by setting the CONFIG_OPENTHREAD_LIBRARY
Kconfig option and select one of the provided Feature sets.
Feature sets
A feature set defines a combination of OpenThread features for a specific use case.
These feature sets are mainly used for pre-built libraries, but you can also use them when you build your application libraries from source. The nRF Connect SDK provides the following feature sets:
CONFIG_OPENTHREAD_NORDIC_LIBRARY_MASTER
- Enable the complete set of OpenThread features for the Thread Specification.CONFIG_OPENTHREAD_NORDIC_LIBRARY_FTD
- Enable optimized OpenThread features for FTD.CONFIG_OPENTHREAD_NORDIC_LIBRARY_MTD
- Enable optimized OpenThread features for MTD.CONFIG_OPENTHREAD_NORDIC_LIBRARY_RCP
- Enable optimized feature set for RCP.CONFIG_OPENTHREAD_USER_CUSTOM_LIBRARY
- Create a custom feature set for compilation when building OpenThread libraries from source. This option is the default. If you use pre-built libraries, you must choose a different feature set.Note
When building OpenThread libraries from source, you can select another feature set as base to select several configuration options at once. You can then manually enable additional features, but you cannot disable features that are enabled by the chosen feature set.
The following table lists the supported features for each of these sets.
No tick indicates that there is no support for the given feature in the related configuration, while the tick signifies that the feature is selected (=1
value).
Features introduced with the Thread 1.2 Specification are at the bottom of the table and have “Thread 1.2” in parenthesis after the feature name.
For more information about Thread 1.2 features, see the Thread 1.2 Base Features document.
OpenThread feature |
Master |
FTD |
MTD |
RCP |
Custom |
---|---|---|---|---|---|
BORDER_AGENT |
|||||
BORDER_ROUTER |
|||||
CHILD_SUPERVISION |
✔ |
✔ |
✔ |
||
COAP |
✔ |
✔ |
✔ |
||
COAPS |
✔ |
||||
COMMISSIONER |
✔ |
||||
DIAGNOSTIC |
✔ |
||||
DNS_CLIENT |
✔ |
✔ |
✔ |
||
DHCP6_SERVER |
✔ |
||||
DHCP6_CLIENT |
✔ |
||||
ECDSA |
✔ |
✔ |
✔ |
||
IP6_FRAGM |
✔ |
✔ |
✔ |
||
JAM_DETECTION |
✔ |
||||
JOINER |
✔ |
||||
LINK_RAW |
✔ |
||||
MAC_FILTER |
✔ |
||||
MTD_NETDIAG |
✔ |
||||
SERVICE |
✔ |
||||
SLAAC |
✔ |
✔ |
✔ |
||
SNTP_CLIENT |
✔ |
||||
SRP_CLIENT |
✔ |
✔ |
✔ |
||
UDP_FORWARD |
✔ |
||||
BACKBONE_ROUTER (Thread 1.2) |
|||||
CSL_RECEIVER (Thread 1.2) |
✔ |
✔ |
✔ |
||
DUA (Thread 1.2) |
✔ |
✔ |
✔ |
||
LINK_METRICS_INITIATOR (Thread 1.2) |
✔ |
✔ |
|||
LINK_METRICS_SUBJECT (Thread 1.2) |
✔ |
✔ |
✔ |
||
MLR (Thread 1.2) |
✔ |
✔ |
✔ |
For the full list of configuration options that were used during compilation, including their default values, see the openthread_lib_configuration.txt
file within each library folder in the nrfxlib repository.
The library folders are inside openthread/lib
.
Customizing pre-built libraries
Selecting a feature set allows you to use the respective OpenThread features in your application. You might need to customize some configuration options to fit your use case though.
Be aware of the following limitations when customizing the configuration of a pre-built library:
You can only update configuration options that are configurable at run time. If you change any options that are compiled into the library, your changes will be ignored.
Changes to the configuration might impact the certification status of the pre-built libraries. See Thread certification options for more information.
The following list shows some of the configuration options that you might want to customize:
CONFIG_OPENTHREAD_FTD
orCONFIG_OPENTHREAD_MTD
- Select the device type. TheCONFIG_OPENTHREAD_NORDIC_LIBRARY_MTD
feature set supports only the MTD device type. The other feature sets support both device types.CONFIG_OPENTHREAD_COPROCESSOR
andCONFIG_OPENTHREAD_COPROCESSOR_RCP
- Select the OpenThread architecture to use. See Co-processor designs.CONFIG_OPENTHREAD_MANUAL_START
- Choose whether to configure and join the Thread network automatically. If you set this option ton
, also check and configure the network parameters that are used, for example:
Updating pre-built OpenThread libraries
You can update the OpenThread pre-built libraries in nrfxlib when using any Thread sample if you configure the sample to build the OpenThread stack from source with CONFIG_OPENTHREAD_SOURCES
.
Use this functionality for certification of your configuration of the OpenThread libraries, for example.
You can install the libraries either with or without debug symbols. Installing the libraries with debug symbols can be useful when debugging, but will take a significant amount of storage memory.
Updating the libraries without debug symbols
There is a set of commands to update the libraries without debug symbols.
When using the command line, run the commands in the project folder.
When using the nRF Connect for VS Code extension, open a terminal and choose nRF Terminal, then run the commands there.
Use the following commands:
west build -b nrf52840dk/nrf52840 -- -DOPENTHREAD_BUILD_OUTPUT_STRIPPED=y
west build -d build/cli -t install_openthread_libraries
This command builds two versions of the libraries, with and without debug symbols, and installs only the version without debug symbols.
This command also builds the sample on the specified board.
Make sure that the board you mention is compatible with the chosen sample.
The CONFIG_OPENTHREAD_BUILD_OUTPUT_STRIPPED
Kconfig option will be disabled again after this command completes.
Updating the libraries with debug symbols
There is a set of commands to update the libraries with debug symbols.
When using the command line, run the commands in the project folder.
When using the nRF Connect for VS Code extension, open a terminal and choose nRF Terminal, then run the commands there.
Use the following commands:
west build -b nrf52840dk/nrf52840
west build -d build/cli -t install_openthread_libraries
This command also builds the sample on the specified board. Make sure that the board you mention is compatible with the chosen sample.