diff --git a/doc/nrf/releases_and_maturity/releases/release-notes-changelog.rst b/doc/nrf/releases_and_maturity/releases/release-notes-changelog.rst index 87339e8ea077..15ab9c960a08 100644 --- a/doc/nrf/releases_and_maturity/releases/release-notes-changelog.rst +++ b/doc/nrf/releases_and_maturity/releases/release-notes-changelog.rst @@ -169,7 +169,7 @@ nRF IEEE 802.15.4 radio driver Thread ------ -|no_changes_yet_note| +* Added a warning when using precompiled OpenThread libraries with modified Kconfig options related to the OpenThread stack. Wi-FiĀ® ------ diff --git a/modules/openthread/CMakeLists.txt b/modules/openthread/CMakeLists.txt index 3bff32aea668..a1afe5863b44 100644 --- a/modules/openthread/CMakeLists.txt +++ b/modules/openthread/CMakeLists.txt @@ -1,141 +1,122 @@ if(CONFIG_OPENTHREAD) + # Include the Kconfig tracking utilities - this defines kconfig_to_ot_option macro + # and openthread_check_kconfig_for_precompiled_libs function + include(${CMAKE_CURRENT_LIST_DIR}/openthread_kconfig_check.cmake) + + # Register all OpenThread Kconfig options that affect the stack. + kconfig_to_ot_option(CONFIG_OPENTHREAD_ANYCAST_LOCATOR OT_ANYCAST_LOCATOR "Enable anycast locator" BOOL) + kconfig_to_ot_option(CONFIG_ASSERT OT_ASSERT "Enable assert function OT_ASSERT()" BOOL) + kconfig_to_ot_option(CONFIG_OPENTHREAD_BACKBONE_ROUTER OT_BACKBONE_ROUTER "Enable backbone router functionality" BOOL) + kconfig_to_ot_option(CONFIG_OPENTHREAD_BACKBONE_ROUTER_DUA_NDPROXYING OT_BACKBONE_ROUTER_DUA_NDPROXYING "Enable BBR DUA ND Proxy support" BOOL) + kconfig_to_ot_option(CONFIG_OPENTHREAD_BACKBONE_ROUTER_MULTICAST_ROUTING OT_BACKBONE_ROUTER_MULTICAST_ROUTING "Enable BBR MR support" BOOL) + kconfig_to_ot_option(CONFIG_OPENTHREAD_BLE_TCAT OT_BLE_TCAT "Enable BLE TCAT support" BOOL) + kconfig_to_ot_option(CONFIG_OPENTHREAD_BORDER_AGENT OT_BORDER_AGENT "Enable Border Agent" BOOL) + kconfig_to_ot_option(CONFIG_OPENTHREAD_BORDER_AGENT_EPHEMERAL_KEY_ENABLE OT_BORDER_AGENT_EPSKC "Border agent ephemeral PSKc" BOOL) + kconfig_to_ot_option(CONFIG_OPENTHREAD_BORDER_AGENT_ID OT_BORDER_AGENT_ID "Create and save border agent ID" BOOL) + kconfig_to_ot_option(CONFIG_OPENTHREAD_BORDER_ROUTER OT_BORDER_ROUTER "Enable Border Router" BOOL) + kconfig_to_ot_option(CONFIG_OPENTHREAD_BORDER_ROUTING OT_BORDER_ROUTING "Enable Border routing" BOOL) + kconfig_to_ot_option(CONFIG_OPENTHREAD_BORDER_ROUTING_COUNTERS OT_BORDER_ROUTING_COUNTERS "Enable Border routing counters" BOOL) + kconfig_to_ot_option(CONFIG_OPENTHREAD_BORDER_ROUTING_DHCP6_PD OT_BORDER_ROUTING_DHCP6_PD "DHCPv6-PD support in border routing" BOOL) + kconfig_to_ot_option(CONFIG_OPENTHREAD_CHANNEL_MANAGER OT_CHANNEL_MANAGER "Enable channel manager support" BOOL) + kconfig_to_ot_option(CONFIG_OPENTHREAD_CHANNEL_MANAGER_CSL OT_CHANNEL_MANAGER_CSL "Channel manager for CSL channel" BOOL) + kconfig_to_ot_option(CONFIG_OPENTHREAD_CHANNEL_MONITOR OT_CHANNEL_MONITOR "Enable channel monitor support" BOOL) + kconfig_to_ot_option(CONFIG_OPENTHREAD_COAP OT_COAP "Enable CoAP API" BOOL) + kconfig_to_ot_option(CONFIG_OPENTHREAD_COAP_BLOCK OT_COAP_BLOCK "Enable CoAP Block-wise option support" BOOL) + kconfig_to_ot_option(CONFIG_OPENTHREAD_COAP_OBSERVE OT_COAP_OBSERVE "Enable CoAP Observe option support" BOOL) + kconfig_to_ot_option(CONFIG_OPENTHREAD_COAPS OT_COAPS "Enable secure CoAP API support" BOOL) + kconfig_to_ot_option(CONFIG_OPENTHREAD_COMMISSIONER OT_COMMISSIONER "Enable Commissioner" BOOL) + kconfig_to_ot_option(CONFIG_OPENTHREAD_CSL_AUTO_SYNC OT_CSL_AUTO_SYNC "Enable csl autosync" BOOL) + kconfig_to_ot_option(CONFIG_OPENTHREAD_CSL_DEBUG OT_CSL_DEBUG "Enable CSL debug" BOOL) + kconfig_to_ot_option(CONFIG_OPENTHREAD_CSL_RECEIVER OT_CSL_RECEIVER "Enable CSL receiver feature for Thread 1.2" BOOL) + kconfig_to_ot_option(CONFIG_OPENTHREAD_CSL_RECEIVER_LOCAL_TIME_SYNC OT_CSL_RECEIVER_LOCAL_TIME_SYNC "Use local time for CSL sync" BOOL) + kconfig_to_ot_option(CONFIG_OPENTHREAD_DATASET_UPDATER OT_DATASET_UPDATER "Enable Dataset updater" BOOL) + kconfig_to_ot_option(CONFIG_OPENTHREAD_DEVICE_PROP_LEADER_WEIGHT OT_DEVICE_PROP_LEADER_WEIGHT "Enable device props for leader weight" BOOL) + kconfig_to_ot_option(CONFIG_OPENTHREAD_DHCP6_CLIENT OT_DHCP6_CLIENT "Enable DHCPv6 Client" BOOL) + kconfig_to_ot_option(CONFIG_OPENTHREAD_DHCP6_SERVER OT_DHCP6_SERVER "Enable DHCPv6 Server" BOOL) + kconfig_to_ot_option(CONFIG_OPENTHREAD_DIAG OT_DIAGNOSTIC "Enable Diagnostics support" BOOL) + kconfig_to_ot_option(CONFIG_OPENTHREAD_DNS_CLIENT OT_DNS_CLIENT "Enable DNS client support" BOOL) + kconfig_to_ot_option(CONFIG_OPENTHREAD_DNS_CLIENT_OVER_TCP OT_DNS_CLIENT_OVER_TCP "Enable dns query over tcp" BOOL) + kconfig_to_ot_option(CONFIG_OPENTHREAD_DNS_DSO OT_DNS_DSO "Enable DNS Stateful Operations (DSO) support" BOOL) + kconfig_to_ot_option(CONFIG_OPENTHREAD_DNS_UPSTREAM_QUERY OT_DNS_UPSTREAM_QUERY "Enable forwarding DNS queries to upstream" BOOL) + kconfig_to_ot_option(CONFIG_OPENTHREAD_DNSSD_DISCOVERY_PROXY OT_DNSSD_DISCOVERY_PROXY "Enable DNS-SD discovery proxy support" BOOL) + kconfig_to_ot_option(CONFIG_OPENTHREAD_DNSSD_SERVER OT_DNSSD_SERVER "Enable DNS-SD server support" BOOL) + kconfig_to_ot_option(CONFIG_OPENTHREAD_DUA OT_DUA "Enable Domain Unicast Address feature for Thread 1.2" BOOL) + kconfig_to_ot_option(CONFIG_OPENTHREAD_DYNAMIC_STORE_FRAME_AHEAD_COUNTER OT_DYNAMIC_STORE_FRAME_AHEAD_COUNTER "Enable dynamic store frame ahead counter" BOOL) + kconfig_to_ot_option(CONFIG_OPENTHREAD_ECDSA OT_ECDSA "Enable ECDSA support" BOOL) + kconfig_to_ot_option(CONFIG_OPENTHREAD_ENABLE_SERVICE OT_SERVICE "Enable Service entries in Thread Network Data" BOOL) + kconfig_to_ot_option(CONFIG_OPENTHREAD_EXTERNAL_HEAP OT_EXTERNAL_HEAP "Enable external heap support" BOOL) + kconfig_to_ot_option(CONFIG_OPENTHREAD_FIREWALL OT_FIREWALL "Enable firewall" BOOL) + kconfig_to_ot_option(CONFIG_OPENTHREAD_FULL_LOGS OT_FULL_LOGS "Enable full logs" BOOL) + kconfig_to_ot_option(CONFIG_OPENTHREAD_HISTORY_TRACKER OT_HISTORY_TRACKER "Enable history tracker support." BOOL) + kconfig_to_ot_option(CONFIG_OPENTHREAD_IP6_FRAGM OT_IP6_FRAGM "Enable IPv6 fragmentation support" BOOL) + kconfig_to_ot_option(CONFIG_OPENTHREAD_JAM_DETECTION OT_JAM_DETECTION "Enable Jam Detection" BOOL) + kconfig_to_ot_option(CONFIG_OPENTHREAD_JOINER OT_JOINER "Enable Joiner" BOOL) + kconfig_to_ot_option(CONFIG_OPENTHREAD_LEGACY OT_LEGACY "Enable legacy network support" BOOL) + kconfig_to_ot_option(CONFIG_OPENTHREAD_LINK_METRICS_INITIATOR OT_LINK_METRICS_INITIATOR "Enable Link Metrics initiator for Thread 1.2" BOOL) + kconfig_to_ot_option(CONFIG_OPENTHREAD_LINK_METRICS_MANAGER OT_LINK_METRICS_MANAGER "Enable Link Metrics manager for Thread 1.2" BOOL) + kconfig_to_ot_option(CONFIG_OPENTHREAD_LINK_METRICS_SUBJECT OT_LINK_METRICS_SUBJECT "Enable Link Metrics subject for Thread 1.2" BOOL) + kconfig_to_ot_option(CONFIG_OPENTHREAD_PLATFORM_LOG_CRASH_DUMP OT_PLATFORM_LOG_CRASH_DUMP "Platform log crash dump" BOOL) + kconfig_to_ot_option(CONFIG_OPENTHREAD_LOG_LEVEL_DYNAMIC OT_LOG_LEVEL_DYNAMIC "Enable dynamic log level control" BOOL) + kconfig_to_ot_option(CONFIG_OPENTHREAD_MAC_FILTER OT_MAC_FILTER "Enable MAC filter support" BOOL) + kconfig_to_ot_option(CONFIG_OPENTHREAD_MULTICAST_DNS OT_MDNS "multicast DNS (mDNS)" BOOL) + kconfig_to_ot_option(CONFIG_OPENTHREAD_MESH_DIAG OT_MESH_DIAG "Enable Mesh Diagnostics" BOOL) + kconfig_to_ot_option(CONFIG_OPENTHREAD_MESSAGE_USE_HEAP OT_MESSAGE_USE_HEAP "Enable heap allocator for message buffers" BOOL) + kconfig_to_ot_option(CONFIG_OPENTHREAD_MLE_LONG_ROUTES OT_MLE_LONG_ROUTES "Enable MLE long routes support (Experimental)" BOOL) + kconfig_to_ot_option(CONFIG_OPENTHREAD_MLR OT_MLR "Enable Multicast Listener Registration feature for Thread 1.2" BOOL) + kconfig_to_ot_option(CONFIG_OPENTHREAD_MULTIPAN_RCP OT_MULTIPAN_RCP "Enable Multi-PAN RCP" BOOL) + kconfig_to_ot_option(CONFIG_OPENTHREAD_MULTIPLE_INSTANCE OT_MULTIPLE_INSTANCE "Enable multiple instances" BOOL) + kconfig_to_ot_option(CONFIG_OPENTHREAD_NAT64_BORDER_ROUTING OT_NAT64_BORDER_ROUTING "Enable border routing NAT64 support" BOOL) + kconfig_to_ot_option(CONFIG_OPENTHREAD_NAT64_TRANSLATOR OT_NAT64_TRANSLATOR "Enable NAT64 translator" BOOL) + kconfig_to_ot_option(CONFIG_OPENTHREAD_NEIGHBOR_DISCOVERY_AGENT OT_NEIGHBOR_DISCOVERY_AGENT "Enable neighbor discovery agent support" BOOL) + kconfig_to_ot_option(CONFIG_OPENTHREAD_NETDIAG_CLIENT OT_NETDIAG_CLIENT "Enable TMF network diagnostics on clients" BOOL) + kconfig_to_ot_option(CONFIG_OPENTHREAD_NETDIAG_VENDOR_INFO OT_NETDIAG_VENDOR_INFO "Allow setting vendor info at runtime" BOOL) + kconfig_to_ot_option(CONFIG_OPENTHREAD_NETDATA_PUBLISHER OT_NETDATA_PUBLISHER "Enable Thread Network Data publisher" BOOL) + kconfig_to_ot_option(CONFIG_OPENTHREAD_OPERATIONAL_DATASET_AUTO_INIT OT_OPERATIONAL_DATASET_AUTO_INIT "Enable operational dataset auto init" BOOL) + kconfig_to_ot_option(CONFIG_OPENTHREAD_OTNS OT_OTNS "Enable OTNS support" BOOL) + kconfig_to_ot_option(CONFIG_OPENTHREAD_PING_SENDER OT_PING_SENDER "Enable ping sender support" BOOL) + kconfig_to_ot_option(CONFIG_OPENTHREAD_PLATFORM_BOOTLOADER_MODE OT_PLATFORM_BOOTLOADER_MODE "Enable platform bootloader mode support" BOOL) + kconfig_to_ot_option(CONFIG_OPENTHREAD_PLATFORM_KEY_REF OT_PLATFORM_KEY_REF "Enable platform key reference support" BOOL) + kconfig_to_ot_option(CONFIG_OPENTHREAD_PLATFORM_NETIF OT_PLATFORM_NETIF "Enable platform netif support" BOOL) + kconfig_to_ot_option(CONFIG_OPENTHREAD_PLATFORM_UDP OT_PLATFORM_UDP "Enable platform UDP support" BOOL) + kconfig_to_ot_option(CONFIG_OPENTHREAD_RADIO_LINK_IEEE_802_15_4_ENABLE OT_15_4 "Enable 802.15.4 radio" BOOL) + kconfig_to_ot_option(CONFIG_OPENTHREAD_RAW OT_LINK_RAW "Enable Link Raw" BOOL) + kconfig_to_ot_option(CONFIG_OPENTHREAD_REFERENCE_DEVICE OT_REFERENCE_DEVICE "Enable Thread Certification Reference Device" BOOL) + kconfig_to_ot_option(CONFIG_OPENTHREAD_SETTINGS_RAM OT_SETTINGS_RAM "Enable volatile-only storage of settings" BOOL) + kconfig_to_ot_option(CONFIG_OPENTHREAD_SLAAC OT_SLAAC "Enable SLAAC" BOOL) + kconfig_to_ot_option(CONFIG_OPENTHREAD_SNTP_CLIENT OT_SNTP_CLIENT "Enable SNTP Client support" BOOL) + kconfig_to_ot_option(CONFIG_OPENTHREAD_SRP_ADV_PROXY OT_SRP_ADV_PROXY "Enable SRP Server Advertising Proxy support" BOOL) + kconfig_to_ot_option(CONFIG_OPENTHREAD_SRP_CLIENT OT_SRP_CLIENT "Enable SRP Client support" BOOL) + kconfig_to_ot_option(CONFIG_OPENTHREAD_SRP_SERVER OT_SRP_SERVER "Enable SRP Server support" BOOL) + kconfig_to_ot_option(CONFIG_OPENTHREAD_TCP_ENABLE OT_TCP "Enable TCP support" BOOL) + kconfig_to_ot_option(CONFIG_OPENTHREAD_TIME_SYNC OT_TIME_SYNC "Enable the time synchronization service feature" BOOL) + kconfig_to_ot_option(CONFIG_OPENTHREAD_TREL OT_TREL "Enable TREL radio link for Thread over Infrastructure feature" BOOL) + kconfig_to_ot_option(CONFIG_OPENTHREAD_TX_BEACON_PAYLOAD OT_TX_BEACON_PAYLOAD "Enable tx beacon payload support" BOOL) + kconfig_to_ot_option(CONFIG_OPENTHREAD_TX_QUEUE_STATISTICS OT_TX_QUEUE_STATS "Enable tx queue statistics" BOOL) + kconfig_to_ot_option(CONFIG_OPENTHREAD_UDP_FORWARD OT_UDP_FORWARD "Enable UDP forward feature" BOOL) + kconfig_to_ot_option(CONFIG_OPENTHREAD_UPTIME OT_UPTIME "Enable support for tracking OpenThread instance's uptime" BOOL) + kconfig_to_ot_option(CONFIG_OPENTHREAD_VERHOEFF_CHECKSUM OT_VERHOEFF_CHECKSUM "Verhoeff checksum" BOOL) + kconfig_to_ot_option(CONFIG_OPENTHREAD_WAKEUP_COORDINATOR OT_WAKEUP_COORDINATOR "Enable Wake-up Coordinator role" BOOL) + kconfig_to_ot_option(CONFIG_OPENTHREAD_WAKEUP_END_DEVICE OT_WAKEUP_END_DEVICE "Enable Wake-up End Device role" BOOL) + kconfig_to_ot_option(CONFIG_OPENTHREAD_FTD OT_FTD "Enable Full Thread Device" BOOL) + kconfig_to_ot_option(CONFIG_OPENTHREAD_MTD OT_MTD "Enable Minimal Thread Device" BOOL) + + # Register string OpenThread Kconfig options + kconfig_to_ot_option(CONFIG_OPENTHREAD_THREAD_VERSION OT_THREAD_VERSION "Thread stack version" STRING) + kconfig_to_ot_option(CONFIG_OPENTHREAD_MBEDTLS_LIB_NAME OT_EXTERNAL_MBEDTLS "External mbedtls library" STRING) + kconfig_to_ot_option(CONFIG_OPENTHREAD_COPROCESSOR_VENDOR_HOOK_SOURCE OT_NCP_VENDOR_HOOK_SOURCE "NCP vendor hook source" STRING) + kconfig_to_ot_option(CONFIG_OPENTHREAD_POWER_SUPPLY OT_POWER_SUPPLY "Power supply configuration" STRING) + kconfig_to_ot_option(CONFIG_OPENTHREAD_CLI_VENDOR_EXTENSION OT_CLI_VENDOR_EXTENSION "CLI vendor extension" STRING) + if(CONFIG_OPENTHREAD_SOURCES) set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) - macro(kconfig_to_ot_option kconfig_option ot_config description) - if(${kconfig_option}) - set(${ot_config} ON CACHE BOOL "${description}" FORCE) - else() - set(${ot_config} OFF CACHE BOOL "${description}" FORCE) - endif() - endmacro() - # OpenThread options set(OT_BUILD_EXECUTABLES OFF CACHE BOOL "Disable OpenThread samples") set(OT_BUILTIN_MBEDTLS_MANAGEMENT OFF CACHE BOOL "Use Zephyr's mbedTLS heap") set(OT_PLATFORM "zephyr" CACHE STRING "Zephyr as a target platform") set(OT_PLATFORM_POWER_CALIBRATION OFF CACHE BOOL "Use Zephyr's power calibration handled by Radio Driver") - set(OT_THREAD_VERSION ${CONFIG_OPENTHREAD_THREAD_VERSION} CACHE STRING "User selected Thread stack version") set(OT_CLI_TRANSPORT "CONSOLE" CACHE STRING "Set CLI to use console interpreter") - string(REPLACE " " ";" OT_MBEDTLS_LIB_LIST " ${CONFIG_OPENTHREAD_MBEDTLS_LIB_NAME}") - - set(OT_EXTERNAL_MBEDTLS ${OT_MBEDTLS_LIB_LIST} CACHE STRING "Specify external mbedtls library" FORCE) - - if(CONFIG_OPENTHREAD_FTD) - set(OT_FTD ON CACHE BOOL "Enable FTD" FORCE) - set(OT_MTD OFF CACHE BOOL "Enable MTD" FORCE) - elseif(CONFIG_OPENTHREAD_MTD) - set(OT_FTD OFF CACHE BOOL "Enable FTD" FORCE) - set(OT_MTD ON CACHE BOOL "Enable MTD" FORCE) - endif() - - kconfig_to_ot_option(CONFIG_OPENTHREAD_ANYCAST_LOCATOR OT_ANYCAST_LOCATOR "Enable anycast locator") - kconfig_to_ot_option(CONFIG_ASSERT OT_ASSERT "Enable assert function OT_ASSERT()") - kconfig_to_ot_option(CONFIG_OPENTHREAD_BACKBONE_ROUTER OT_BACKBONE_ROUTER "Enable backbone router functionality") - kconfig_to_ot_option(CONFIG_OPENTHREAD_BACKBONE_ROUTER_DUA_NDPROXYING OT_BACKBONE_ROUTER_DUA_NDPROXYING "Enable BBR DUA ND Proxy support") - kconfig_to_ot_option(CONFIG_OPENTHREAD_BACKBONE_ROUTER_MULTICAST_ROUTING OT_BACKBONE_ROUTER_MULTICAST_ROUTING "Enable BBR MR support") - kconfig_to_ot_option(CONFIG_OPENTHREAD_BLE_TCAT OT_BLE_TCAT "Enable BLE TCAT support") - kconfig_to_ot_option(CONFIG_OPENTHREAD_BORDER_AGENT OT_BORDER_AGENT "Enable Border Agent") - kconfig_to_ot_option(CONFIG_OPENTHREAD_BORDER_AGENT_EPHEMERAL_KEY_ENABLE OT_BORDER_AGENT_EPSKC "Border agent ephemeral PSKc") - kconfig_to_ot_option(CONFIG_OPENTHREAD_BORDER_AGENT_ID OT_BORDER_AGENT_ID "Create and save border agent ID") - kconfig_to_ot_option(CONFIG_OPENTHREAD_BORDER_ROUTER OT_BORDER_ROUTER "Enable Border Router") - kconfig_to_ot_option(CONFIG_OPENTHREAD_BORDER_ROUTING OT_BORDER_ROUTING "Enable Border routing") - kconfig_to_ot_option(CONFIG_OPENTHREAD_BORDER_ROUTING_COUNTERS OT_BORDER_ROUTING_COUNTERS "Enable Border routing counters") - kconfig_to_ot_option(CONFIG_OPENTHREAD_BORDER_ROUTING_DHCP6_PD OT_BORDER_ROUTING_DHCP6_PD "DHCPv6-PD support in border routing") - kconfig_to_ot_option(CONFIG_OPENTHREAD_CHANNEL_MANAGER OT_CHANNEL_MANAGER "Enable channel manager support") - kconfig_to_ot_option(CONFIG_OPENTHREAD_CHANNEL_MANAGER_CSL OT_CHANNEL_MANAGER_CSL "Channel manager for CSL channel") - kconfig_to_ot_option(CONFIG_OPENTHREAD_CHANNEL_MONITOR OT_CHANNEL_MONITOR "Enable channel monitor support") - kconfig_to_ot_option(CONFIG_OPENTHREAD_COAP OT_COAP "Enable CoAP API") - kconfig_to_ot_option(CONFIG_OPENTHREAD_COAP_BLOCK OT_COAP_BLOCK "Enable CoAP Block-wise option support") - kconfig_to_ot_option(CONFIG_OPENTHREAD_COAP_OBSERVE OT_COAP_OBSERVE "Enable CoAP Observe option support") - kconfig_to_ot_option(CONFIG_OPENTHREAD_COAPS OT_COAPS "Enable secure CoAP API support") - kconfig_to_ot_option(CONFIG_OPENTHREAD_COMMISSIONER OT_COMMISSIONER "Enable Commissioner") - kconfig_to_ot_option(CONFIG_OPENTHREAD_CSL_AUTO_SYNC OT_CSL_AUTO_SYNC "Enable csl autosync") - kconfig_to_ot_option(CONFIG_OPENTHREAD_CSL_DEBUG OT_CSL_DEBUG "Enable CSL debug") - kconfig_to_ot_option(CONFIG_OPENTHREAD_CSL_RECEIVER OT_CSL_RECEIVER "Enable CSL receiver feature for Thread 1.2") - kconfig_to_ot_option(CONFIG_OPENTHREAD_CSL_RECEIVER_LOCAL_TIME_SYNC OT_CSL_RECEIVER_LOCAL_TIME_SYNC "Use local time for CSL sync") - kconfig_to_ot_option(CONFIG_OPENTHREAD_DATASET_UPDATER OT_DATASET_UPDATER "Enable Dataset updater") - kconfig_to_ot_option(CONFIG_OPENTHREAD_DEVICE_PROP_LEADER_WEIGHT OT_DEVICE_PROP_LEADER_WEIGHT "Enable device props for leader weight") - kconfig_to_ot_option(CONFIG_OPENTHREAD_DHCP6_CLIENT OT_DHCP6_CLIENT "Enable DHCPv6 Client") - kconfig_to_ot_option(CONFIG_OPENTHREAD_DHCP6_SERVER OT_DHCP6_SERVER "Enable DHCPv6 Server") - kconfig_to_ot_option(CONFIG_OPENTHREAD_DIAG OT_DIAGNOSTIC "Enable Diagnostics support") - kconfig_to_ot_option(CONFIG_OPENTHREAD_DNS_CLIENT OT_DNS_CLIENT "Enable DNS client support") - kconfig_to_ot_option(CONFIG_OPENTHREAD_DNS_CLIENT_OVER_TCP OT_DNS_CLIENT_OVER_TCP "Enable dns query over tcp") - kconfig_to_ot_option(CONFIG_OPENTHREAD_DNS_DSO OT_DNS_DSO "Enable DNS Stateful Operations (DSO) support") - kconfig_to_ot_option(CONFIG_OPENTHREAD_DNS_UPSTREAM_QUERY OT_DNS_UPSTREAM_QUERY "Enable forwarding DNS queries to upstream") - kconfig_to_ot_option(CONFIG_OPENTHREAD_DNSSD_DISCOVERY_PROXY OT_DNSSD_DISCOVERY_PROXY "Enable DNS-SD discovery proxy support") - kconfig_to_ot_option(CONFIG_OPENTHREAD_DNSSD_SERVER OT_DNSSD_SERVER "Enable DNS-SD server support") - kconfig_to_ot_option(CONFIG_OPENTHREAD_DUA OT_DUA "Enable Domain Unicast Address feature for Thread 1.2") - kconfig_to_ot_option(CONFIG_OPENTHREAD_DYNAMIC_STORE_FRAME_AHEAD_COUNTER OT_DYNAMIC_STORE_FRAME_AHEAD_COUNTER "Enable dynamic store frame ahead counter") - kconfig_to_ot_option(CONFIG_OPENTHREAD_ECDSA OT_ECDSA "Enable ECDSA support") - kconfig_to_ot_option(CONFIG_OPENTHREAD_ENABLE_SERVICE OT_SERVICE "Enable Service entries in Thread Network Data") - kconfig_to_ot_option(CONFIG_OPENTHREAD_EXTERNAL_HEAP OT_EXTERNAL_HEAP "Enable external heap support") - kconfig_to_ot_option(CONFIG_OPENTHREAD_FIREWALL OT_FIREWALL "Enable firewall") - kconfig_to_ot_option(CONFIG_OPENTHREAD_FULL_LOGS OT_FULL_LOGS "Enable full logs") - kconfig_to_ot_option(CONFIG_OPENTHREAD_HISTORY_TRACKER OT_HISTORY_TRACKER "Enable history tracker support.") - kconfig_to_ot_option(CONFIG_OPENTHREAD_IP6_FRAGM OT_IP6_FRAGM "Enable IPv6 fragmentation support") - kconfig_to_ot_option(CONFIG_OPENTHREAD_JAM_DETECTION OT_JAM_DETECTION "Enable Jam Detection") - kconfig_to_ot_option(CONFIG_OPENTHREAD_JOINER OT_JOINER "Enable Joiner") - kconfig_to_ot_option(CONFIG_OPENTHREAD_LEGACY OT_LEGACY "Enable legacy network support") - kconfig_to_ot_option(CONFIG_OPENTHREAD_LINK_METRICS_INITIATOR OT_LINK_METRICS_INITIATOR "Enable Link Metrics initiator for Thread 1.2") - kconfig_to_ot_option(CONFIG_OPENTHREAD_LINK_METRICS_MANAGER OT_LINK_METRICS_MANAGER "Enable Link Metrics manager for Thread 1.2") - kconfig_to_ot_option(CONFIG_OPENTHREAD_LINK_METRICS_SUBJECT OT_LINK_METRICS_SUBJECT "Enable Link Metrics subject for Thread 1.2") - kconfig_to_ot_option(CONFIG_OPENTHREAD_PLATFORM_LOG_CRASH_DUMP OT_PLATFORM_LOG_CRASH_DUMP "Platform log crash dump") - kconfig_to_ot_option(CONFIG_OPENTHREAD_LOG_LEVEL_DYNAMIC OT_LOG_LEVEL_DYNAMIC "Enable dynamic log level control") - kconfig_to_ot_option(CONFIG_OPENTHREAD_MAC_FILTER OT_MAC_FILTER "Enable MAC filter support") - kconfig_to_ot_option(CONFIG_OPENTHREAD_MULTICAST_DNS OT_MDNS "multicast DNS (mDNS)") - kconfig_to_ot_option(CONFIG_OPENTHREAD_MESH_DIAG OT_MESH_DIAG "Enable Mesh Diagnostics") - kconfig_to_ot_option(CONFIG_OPENTHREAD_MESSAGE_USE_HEAP OT_MESSAGE_USE_HEAP "Enable heap allocator for message buffers") - kconfig_to_ot_option(CONFIG_OPENTHREAD_MLE_LONG_ROUTES OT_MLE_LONG_ROUTES "Enable MLE long routes support (Experimental)") - kconfig_to_ot_option(CONFIG_OPENTHREAD_MLR OT_MLR "Enable Multicast Listener Registration feature for Thread 1.2") - kconfig_to_ot_option(CONFIG_OPENTHREAD_MULTIPAN_RCP OT_MULTIPAN_RCP "Enable Multi-PAN RCP") - kconfig_to_ot_option(CONFIG_OPENTHREAD_MULTIPLE_INSTANCE OT_MULTIPLE_INSTANCE "Enable multiple instances") - kconfig_to_ot_option(CONFIG_OPENTHREAD_NAT64_BORDER_ROUTING OT_NAT64_BORDER_ROUTING "Enable border routing NAT64 support") - kconfig_to_ot_option(CONFIG_OPENTHREAD_NAT64_TRANSLATOR OT_NAT64_TRANSLATOR "Enable NAT64 translator") - kconfig_to_ot_option(CONFIG_OPENTHREAD_NEIGHBOR_DISCOVERY_AGENT OT_NEIGHBOR_DISCOVERY_AGENT "Enable neighbor discovery agent support") - kconfig_to_ot_option(CONFIG_OPENTHREAD_NETDIAG_CLIENT OT_NETDIAG_CLIENT "Enable TMF network diagnostics on clients") - kconfig_to_ot_option(CONFIG_OPENTHREAD_NETDIAG_VENDOR_INFO OT_NETDIAG_VENDOR_INFO "Allow setting vendor info at runtime") - kconfig_to_ot_option(CONFIG_OPENTHREAD_NETDATA_PUBLISHER OT_NETDATA_PUBLISHER "Enable Thread Network Data publisher") - kconfig_to_ot_option(CONFIG_OPENTHREAD_OPERATIONAL_DATASET_AUTO_INIT OT_OPERATIONAL_DATASET_AUTO_INIT "Enable operational dataset auto init") - kconfig_to_ot_option(CONFIG_OPENTHREAD_OTNS OT_OTNS "Enable OTNS support") - kconfig_to_ot_option(CONFIG_OPENTHREAD_PING_SENDER OT_PING_SENDER "Enable ping sender support") - kconfig_to_ot_option(CONFIG_OPENTHREAD_PLATFORM_BOOTLOADER_MODE OT_PLATFORM_BOOTLOADER_MODE "Enable platform bootloader mode support") - kconfig_to_ot_option(CONFIG_OPENTHREAD_PLATFORM_KEY_REF OT_PLATFORM_KEY_REF "Enable platform key reference support") - kconfig_to_ot_option(CONFIG_OPENTHREAD_PLATFORM_NETIF OT_PLATFORM_NETIF "Enable platform netif support") - kconfig_to_ot_option(CONFIG_OPENTHREAD_PLATFORM_UDP OT_PLATFORM_UDP "Enable platform UDP support") - kconfig_to_ot_option(CONFIG_OPENTHREAD_RADIO_LINK_IEEE_802_15_4_ENABLE OT_15_4 "Enable 802.15.4 radio") - kconfig_to_ot_option(CONFIG_OPENTHREAD_RAW OT_LINK_RAW "Enable Link Raw") - kconfig_to_ot_option(CONFIG_OPENTHREAD_REFERENCE_DEVICE OT_REFERENCE_DEVICE "Enable Thread Certification Reference Device") - kconfig_to_ot_option(CONFIG_OPENTHREAD_SETTINGS_RAM OT_SETTINGS_RAM "Enable volatile-only storage of settings") - kconfig_to_ot_option(CONFIG_OPENTHREAD_SLAAC OT_SLAAC "Enable SLAAC") - kconfig_to_ot_option(CONFIG_OPENTHREAD_SNTP_CLIENT OT_SNTP_CLIENT "Enable SNTP Client support") - kconfig_to_ot_option(CONFIG_OPENTHREAD_SRP_ADV_PROXY OT_SRP_ADV_PROXY "Enable SRP Server Advertising Proxy support") - kconfig_to_ot_option(CONFIG_OPENTHREAD_SRP_CLIENT OT_SRP_CLIENT "Enable SRP Client support") - kconfig_to_ot_option(CONFIG_OPENTHREAD_SRP_SERVER OT_SRP_SERVER "Enable SRP Server support") - kconfig_to_ot_option(CONFIG_OPENTHREAD_TCP_ENABLE OT_TCP "Enable TCP support") - kconfig_to_ot_option(CONFIG_OPENTHREAD_TIME_SYNC OT_TIME_SYNC "Enable the time synchronization service feature") - kconfig_to_ot_option(CONFIG_OPENTHREAD_TREL OT_TREL "Enable TREL radio link for Thread over Infrastructure feature") - kconfig_to_ot_option(CONFIG_OPENTHREAD_TX_BEACON_PAYLOAD OT_TX_BEACON_PAYLOAD "Enable tx beacon payload support") - kconfig_to_ot_option(CONFIG_OPENTHREAD_TX_QUEUE_STATISTICS OT_TX_QUEUE_STATS "Enable tx queue statistics") - kconfig_to_ot_option(CONFIG_OPENTHREAD_UDP_FORWARD OT_UDP_FORWARD "Enable UDP forward feature") - kconfig_to_ot_option(CONFIG_OPENTHREAD_UPTIME OT_UPTIME "Enable support for tracking OpenThread instance's uptime") - kconfig_to_ot_option(CONFIG_OPENTHREAD_VERHOEFF_CHECKSUM OT_VERHOEFF_CHECKSUM "Verhoeff checksum") - kconfig_to_ot_option(CONFIG_OPENTHREAD_WAKEUP_COORDINATOR OT_WAKEUP_COORDINATOR "Enable Wake-up Coordinator role") - kconfig_to_ot_option(CONFIG_OPENTHREAD_WAKEUP_END_DEVICE OT_WAKEUP_END_DEVICE "Enable Wake-up End Device role") - - if(CONFIG_OPENTHREAD_COPROCESSOR_VENDOR_HOOK_SOURCE) - set(OT_NCP_VENDOR_HOOK_SOURCE ${CONFIG_OPENTHREAD_COPROCESSOR_VENDOR_HOOK_SOURCE} CACHE STRING "NCP vendor hook source file name" FORCE) - endif() - - if(CONFIG_OPENTHREAD_POWER_SUPPLY) - set(OT_POWER_SUPPLY ${CONFIG_OPENTHREAD_POWER_SUPPLY} CACHE STRING "Power supply configuration" FORCE) - endif() - - if(CONFIG_OPENTHREAD_CLI_VENDOR_EXTENSION) - set(OT_CLI_VENDOR_EXTENSION ${CONFIG_OPENTHREAD_CLI_VENDOR_EXTENSION} CACHE STRING "Path to CMake file to define and link Openthread CLI vendor extension" FORCE) - endif() - set(BUILD_TESTING OFF CACHE BOOL "Disable openthread cmake testing targets" FORCE) # Zephyr logging options @@ -271,7 +252,13 @@ if(CONFIG_OPENTHREAD) endif() target_link_libraries(zephyr PRIVATE ${ot_libs}) - endif() + + else() # CONFIG_OPENTHREAD_SOURCES + + # Check for modified Kconfig options when using precompiled libraries + openthread_check_kconfig_for_precompiled_libs() + + endif() # CONFIG_OPENTHREAD_SOURCES # Create a library for the OpenThread Zephyr utils zephyr_library_named(openthread_utils) diff --git a/modules/openthread/openthread_kconfig_check.cmake b/modules/openthread/openthread_kconfig_check.cmake new file mode 100644 index 000000000000..2bb84ee528c7 --- /dev/null +++ b/modules/openthread/openthread_kconfig_check.cmake @@ -0,0 +1,208 @@ +# +# Copyright (c) 2026 Nordic Semiconductor +# +# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause +# + +# This file provides utilities for tracking OpenThread Kconfig options and +# warning users when they modify options that have no effect with precompiled libraries. + +# Include nrfxlib extensions to get access to openthread_calculate_lib_path +include(${ZEPHYR_NRFXLIB_MODULE_DIR}/openthread/cmake/extensions.cmake) + +# Initialize the lists to track OpenThread Kconfig options and their OT mappings +# Format: "KCONFIG_OPTION:OT_OPTION" pairs +set(OPENTHREAD_KCONFIG_OT_BOOL_MAPPINGS "" CACHE INTERNAL "List of boolean Kconfig to OT option mappings") +set(OPENTHREAD_KCONFIG_OT_STRING_MAPPINGS "" CACHE INTERNAL "List of string Kconfig to OT option mappings") + +# Unified macro that registers a Kconfig option and sets the corresponding OT option when building from sources +# +# Arguments: +# kconfig_option - The Kconfig option to check (e.g., CONFIG_OPENTHREAD_ANYCAST_LOCATOR) +# ot_config - The OpenThread config to set (e.g., OT_ANYCAST_LOCATOR) +# description - Description for the cache variable +# type - Type of the option: BOOL, STRING, or INT +# +macro(kconfig_to_ot_option kconfig_option ot_config description type) + if("${type}" STREQUAL "BOOL") + # Register boolean option in the bool tracking list + set(OPENTHREAD_KCONFIG_OT_BOOL_MAPPINGS "${OPENTHREAD_KCONFIG_OT_BOOL_MAPPINGS};${kconfig_option}:${ot_config}" CACHE INTERNAL "") + + # Only set the OT option when building OpenThread from sources + if(CONFIG_OPENTHREAD_SOURCES) + if(${kconfig_option}) + set(${ot_config} ON CACHE BOOL "${description}" FORCE) + else() + set(${ot_config} OFF CACHE BOOL "${description}" FORCE) + endif() + endif() + elseif("${type}" STREQUAL "STRING" OR "${type}" STREQUAL "INT") + # Register string/int option in the string tracking list (CMake treats both as strings) + set(OPENTHREAD_KCONFIG_OT_STRING_MAPPINGS "${OPENTHREAD_KCONFIG_OT_STRING_MAPPINGS};${kconfig_option}:${ot_config}" CACHE INTERNAL "") + + # Only set the OT option when building OpenThread from sources + if(CONFIG_OPENTHREAD_SOURCES) + if(DEFINED ${kconfig_option}) + set(${ot_config} "${${kconfig_option}}" CACHE STRING "${description}" FORCE) + else() + # Explicitly set to empty if the Kconfig option is not defined + set(${ot_config} "" CACHE STRING "${description}" FORCE) + endif() + endif() + else() + message(FATAL_ERROR "kconfig_to_ot_option: Unknown type '${type}'. Must be BOOL, STRING, or INT.") + endif() +endmacro() + +# Function to check and warn about modified OpenThread Kconfig options when using precompiled libraries +# +# This function should be called after all kconfig_to_ot_option() calls. +# It reads the library configuration file for the selected platform, compares current Kconfig values +# with the library OT_* values, and displays a warning if any options have been changed. +# +function(openthread_check_kconfig_for_precompiled_libs) + # Calculate the library path based on platform and configuration + openthread_calculate_lib_path("v${CONFIG_OPENTHREAD_THREAD_VERSION}" OT_LIB_PATH) + + # Check if configuration file exists + set(conf_file "${OT_LIB_PATH}/openthread_lib_configuration.txt") + if(NOT EXISTS "${conf_file}") + message(WARNING "OpenThread library configuration file not found: ${conf_file}") + return() + endif() + + # Read the library configuration file + file(READ "${conf_file}" LIB_CONFIG_CONTENT) + + # Parse the configuration file into lines + string(REPLACE "\n" ";" conf_lines "${LIB_CONFIG_CONTENT}") + + # Collect all options that differ from the library configuration + set(changed_options "") + + # Check boolean options + foreach(mapping IN LISTS OPENTHREAD_KCONFIG_OT_BOOL_MAPPINGS) + # Skip empty entries + if("${mapping}" STREQUAL "") + continue() + endif() + + # Parse the mapping "KCONFIG_OPTION:OT_OPTION" + string(REPLACE ":" ";" mapping_parts "${mapping}") + list(LENGTH mapping_parts parts_count) + if(NOT parts_count EQUAL 2) + continue() + endif() + + list(GET mapping_parts 0 kconfig_option) + list(GET mapping_parts 1 ot_option) + + # Get current kconfig value: y -> ON, n -> OFF + if(${kconfig_option}) + set(current_value "ON") + else() + set(current_value "OFF") + endif() + + # Search for the OT_* option in the library configuration + set(lib_value_found FALSE) + set(lib_value "") + foreach(line IN LISTS conf_lines) + # Match lines like OT_COAP=ON, OT_ASSERT=OFF, or OT_LOG_LEVEL= (empty) + if("${line}" MATCHES "^${ot_option}=(.*)$") + set(lib_value_found TRUE) + set(lib_value "${CMAKE_MATCH_1}") + break() + endif() + endforeach() + + # Process library value: empty values are treated as OFF + if(lib_value_found) + if("${lib_value}" STREQUAL "") + set(lib_value "OFF") + endif() + + # Compare current value with library value + if(NOT "${current_value}" STREQUAL "${lib_value}") + list(APPEND changed_options "${kconfig_option} -> ${ot_option} (current: ${current_value}, library: ${lib_value})") + endif() + else() + if("${current_value}" STREQUAL "ON") + list(APPEND changed_options "${kconfig_option} -> ${ot_option} (current: ${current_value}, library: OFF)") + endif() + endif() + endforeach() + + # Check string options + foreach(mapping IN LISTS OPENTHREAD_KCONFIG_OT_STRING_MAPPINGS) + # Skip empty entries + if("${mapping}" STREQUAL "") + continue() + endif() + + # Parse the mapping "KCONFIG_OPTION:OT_OPTION" + string(REPLACE ":" ";" mapping_parts "${mapping}") + list(LENGTH mapping_parts parts_count) + if(NOT parts_count EQUAL 2) + continue() + endif() + + list(GET mapping_parts 0 kconfig_option) + list(GET mapping_parts 1 ot_option) + + # Get current kconfig string value + set(current_value "${${kconfig_option}}") + + # Search for the OT_* option in the library configuration + set(lib_value_found FALSE) + set(lib_value "") + foreach(line IN LISTS conf_lines) + # Match lines like OT_POWER_SUPPLY=EXTERNAL or OT_EXTERNAL_MBEDTLS=mbedtls_external + if("${line}" MATCHES "^${ot_option}=(.*)$") + set(lib_value_found TRUE) + set(lib_value "${CMAKE_MATCH_1}") + break() + endif() + endforeach() + + # Compare current value with library value + if(lib_value_found) + if(NOT "${current_value}" STREQUAL "${lib_value}") + list(APPEND changed_options "${kconfig_option} -> ${ot_option} (current: ${current_value}, library: ${lib_value})") + endif() + else() + # OT option not found in library config + # Only report if current value is not empty + if(NOT "${current_value}" STREQUAL "") + list(APPEND changed_options "${kconfig_option} -> ${ot_option} (current: ${current_value}, library: not set)") + endif() + endif() + endforeach() + + list(LENGTH changed_options num_changed) + + if(num_changed GREATER 0) + # Get relative path to the library + cmake_path(RELATIVE_PATH OT_LIB_PATH BASE_DIRECTORY ${ZEPHYR_NRFXLIB_MODULE_DIR} OUTPUT_VARIABLE LIB_PATH_REL) + + # Format the list of options for display + string(REPLACE ";" "\n # - " options_formatted "${changed_options}") + message(WARNING + "\n" + " ##################################################################################################\n" + " # #\n" + " # The following OpenThread Kconfig options differ from the precompiled library: #\n" + " # - ${options_formatted}\n" + " # #\n" + " # These options have NO EFFECT when using precompiled OpenThread libraries. #\n" + " # #\n" + " # The library was built with the configuration from: #\n" + " # nrfxlib/${LIB_PATH_REL}/openthread_lib_configuration.txt\n" + " # #\n" + " # To apply these configuration changes, you need to build OpenThread from #\n" + " # sources by setting CONFIG_OPENTHREAD_SOURCES=y in your configuration. #\n" + " # #\n" + " ##################################################################################################\n" + ) + endif() +endfunction() diff --git a/subsys/net/CMakeLists.txt b/subsys/net/CMakeLists.txt index 6a52bf3c0599..e2dd344f1459 100644 --- a/subsys/net/CMakeLists.txt +++ b/subsys/net/CMakeLists.txt @@ -8,4 +8,4 @@ add_subdirectory(lib) add_subdirectory_ifdef(CONFIG_OPENTHREAD_RPC openthread/rpc) add_subdirectory_ifdef(CONFIG_L2_WIFI_CONNECTIVITY l2_wifi_if_conn) add_subdirectory_ifdef(CONFIG_OPENTHREAD_REPORT openthread/report) -add_subdirectory_ifdef(CONFIG_NET_L2_OPENTHREAD openthread/settings_check) +add_subdirectory_ifdef(CONFIG_OPENTHREAD openthread/settings_check)