diff --git a/examples/light-switch-app/efr32/build_for_wifi_gnfile.gn b/examples/light-switch-app/efr32/build_for_wifi_gnfile.gn index 9752ee73e7c91d..d391814190d09f 100644 --- a/examples/light-switch-app/efr32/build_for_wifi_gnfile.gn +++ b/examples/light-switch-app/efr32/build_for_wifi_gnfile.gn @@ -23,6 +23,6 @@ check_system_includes = true default_args = { target_cpu = "arm" target_os = "freertos" - use_thread = false + chip_enable_wifi = true import("//build_for_wifi_args.gni") } diff --git a/examples/lighting-app/telink/CMakeLists.txt b/examples/lighting-app/telink/CMakeLists.txt index cad8cc224805ae..1783b09f5e8527 100644 --- a/examples/lighting-app/telink/CMakeLists.txt +++ b/examples/lighting-app/telink/CMakeLists.txt @@ -93,6 +93,7 @@ target_sources(app PRIVATE ${CHIP_ROOT}/src/app/clusters/level-control/level-control.cpp ${CHIP_ROOT}/src/app/clusters/color-control-server/color-control-server.cpp ${CHIP_ROOT}/src/app/clusters/occupancy-sensor-server/occupancy-sensor-server.cpp + ${CHIP_ROOT}/src/app/clusters/network-commissioning/network-commissioning.cpp ${CHIP_ROOT}/src/app/clusters/network-commissioning-old/network-commissioning-ember.cpp ${CHIP_ROOT}/src/app/clusters/network-commissioning-old/network-commissioning-old.cpp ${CHIP_ROOT}/src/app/clusters/ota-requestor/ota-requestor-server.cpp diff --git a/examples/lock-app/efr32/build_for_wifi_gnfile.gn b/examples/lock-app/efr32/build_for_wifi_gnfile.gn index 9752ee73e7c91d..d391814190d09f 100644 --- a/examples/lock-app/efr32/build_for_wifi_gnfile.gn +++ b/examples/lock-app/efr32/build_for_wifi_gnfile.gn @@ -23,6 +23,6 @@ check_system_includes = true default_args = { target_cpu = "arm" target_os = "freertos" - use_thread = false + chip_enable_wifi = true import("//build_for_wifi_args.gni") } diff --git a/examples/persistent-storage/qpg/args.gni b/examples/persistent-storage/qpg/args.gni index b0d121b1029802..4918e5af9de27b 100644 --- a/examples/persistent-storage/qpg/args.gni +++ b/examples/persistent-storage/qpg/args.gni @@ -16,3 +16,4 @@ import("//build_overrides/chip.gni") import("${chip_root}/examples/platform/qpg/args.gni") qpg_sdk_target = get_label_info(":sdk", "label_no_toolchain") +chip_enable_openthread = false diff --git a/examples/shell/shell_common/BUILD.gn b/examples/shell/shell_common/BUILD.gn index 484c3dbbbde058..2134cbdc7e4d1f 100644 --- a/examples/shell/shell_common/BUILD.gn +++ b/examples/shell/shell_common/BUILD.gn @@ -33,6 +33,9 @@ config("shell_common_config") { "ENABLE_CHIP_SHELL", "OPENTHREAD_CONFIG_CLI_TRANSPORT=OT_CLI_TRANSPORT_CONSOLE", "CHIP_SHELL_ENABLE_CMD_SERVER=${chip_shell_cmd_server}", + + # shell app use openthread but do not have the NETWORK_COMMISSIONING cluster or zap config. + "_NO_NETWORK_COMMISSIONING_DRIVER_", ] } diff --git a/examples/window-app/efr32/build_for_wifi_gnfile.gn b/examples/window-app/efr32/build_for_wifi_gnfile.gn index 9752ee73e7c91d..d391814190d09f 100644 --- a/examples/window-app/efr32/build_for_wifi_gnfile.gn +++ b/examples/window-app/efr32/build_for_wifi_gnfile.gn @@ -23,6 +23,6 @@ check_system_includes = true default_args = { target_cpu = "arm" target_os = "freertos" - use_thread = false + chip_enable_wifi = true import("//build_for_wifi_args.gni") } diff --git a/src/platform/EFR32/BUILD.gn b/src/platform/EFR32/BUILD.gn index 00469606e03597..172b94bdb82dce 100644 --- a/src/platform/EFR32/BUILD.gn +++ b/src/platform/EFR32/BUILD.gn @@ -95,7 +95,9 @@ static_library("EFR32") { sources += [ "../OpenThread/DnssdImpl.cpp" ] deps += [ "${chip_root}/src/lib/dnssd:platform_header" ] } - } else { + } + + if (chip_enable_wifi) { sources += [ "ConnectivityManagerImpl_WIFI.cpp", "ServiceProvisioning.cpp", diff --git a/src/platform/EFR32/CHIPDevicePlatformConfig.h b/src/platform/EFR32/CHIPDevicePlatformConfig.h index 74521d1da33f60..f6e5b9619ab079 100644 --- a/src/platform/EFR32/CHIPDevicePlatformConfig.h +++ b/src/platform/EFR32/CHIPDevicePlatformConfig.h @@ -29,12 +29,13 @@ #define CHIP_DEVICE_CONFIG_EFR32_NVM3_ERROR_MIN 0xB00000 #define CHIP_DEVICE_CONFIG_EFR32_BLE_ERROR_MIN 0xC00000 +#define CHIP_DEVICE_CONFIG_ENABLE_WIFI_STATION 0 +#define CHIP_DEVICE_CONFIG_ENABLE_WIFI_AP 0 + #if defined(SL_WIFI) #define CHIP_DEVICE_CONFIG_ENABLE_WIFI_STATION 1 #elif CHIP_ENABLE_OPENTHREAD -#define CHIP_DEVICE_CONFIG_ENABLE_WIFI_STATION 0 -#define CHIP_DEVICE_CONFIG_ENABLE_WIFI_AP 0 #define CHIP_DEVICE_CONFIG_ENABLE_THREAD 1 #define CHIP_DEVICE_CONFIG_ENABLE_THREAD_SRP_CLIENT 1 #define CHIP_DEVICE_CONFIG_ENABLE_THREAD_DNS_CLIENT 1 diff --git a/src/platform/OpenThread/GenericThreadStackManagerImpl_OpenThread.cpp b/src/platform/OpenThread/GenericThreadStackManagerImpl_OpenThread.cpp index 95af4cf7269e3b..b6f22ec9ecf1df 100644 --- a/src/platform/OpenThread/GenericThreadStackManagerImpl_OpenThread.cpp +++ b/src/platform/OpenThread/GenericThreadStackManagerImpl_OpenThread.cpp @@ -85,10 +85,19 @@ namespace Internal { // Network commissioning namespace { +#ifndef _NO_NETWORK_COMMISSIONING_DRIVER_ NetworkCommissioning::GenericThreadDriver sGenericThreadDriver; Clusters::NetworkCommissioning::Instance sThreadNetworkCommissioningInstance(0 /* Endpoint Id */, &sGenericThreadDriver); -} // namespace +#endif +void initNetworkCommissioningThreadDriver(void) +{ +#ifndef _NO_NETWORK_COMMISSIONING_DRIVER_ + sThreadNetworkCommissioningInstance.Init(); +#endif +} + +} // namespace // Fully instantiate the generic implementation class in whatever compilation unit includes this file. template class GenericThreadStackManagerImpl_OpenThread; @@ -305,7 +314,6 @@ CHIP_ERROR GenericThreadStackManagerImpl_OpenThread::_GetThreadProvis } assert(Thread::kSizeOperationalDataset <= netInfo.size()); - // memcpy(tlvs.mTlvs, netInfo.data(), netInfo.size()); netInfo = ByteSpan(datasetTlv.mTlvs, datasetTlv.mLength); return CHIP_NO_ERROR; @@ -1574,7 +1582,7 @@ CHIP_ERROR GenericThreadStackManagerImpl_OpenThread::DoInit(otInstanc ChipLogProgress(DeviceLayer, "OpenThread ifconfig up and thread start"); } - sThreadNetworkCommissioningInstance.Init(); + initNetworkCommissioningThreadDriver(); exit: ChipLogProgress(DeviceLayer, "OpenThread started: %s", otThreadErrorToString(otErr)); diff --git a/src/test_driver/efr32/BUILD.gn b/src/test_driver/efr32/BUILD.gn index ec5848855dcecd..67bbf521466712 100644 --- a/src/test_driver/efr32/BUILD.gn +++ b/src/test_driver/efr32/BUILD.gn @@ -57,6 +57,9 @@ efr32_sdk("sdk") { "BOARD_ID=${efr32_board}", "EFR32_LOG_ENABLED=1", "PW_RPC_ENABLED", + + # Thread is built but test driver do not have the NETWORK_COMMISSIONING cluster or zap config. + "_NO_NETWORK_COMMISSIONING_DRIVER_", ] }