diff --git a/examples/lighting-app/k32w/BUILD.gn b/examples/lighting-app/k32w/BUILD.gn index 4bcd97e6b91573..b8455a1ba8bbe1 100644 --- a/examples/lighting-app/k32w/BUILD.gn +++ b/examples/lighting-app/k32w/BUILD.gn @@ -73,8 +73,8 @@ k32w_executable("light_app") { "${chip_root}/src/lib", "${chip_root}/third_party/mbedtls:mbedtls", "${k32w_platform_dir}/app/support:freertos_mbedtls_utils", - "${openthread_root}:libopenthread-cli-mtd", - "${openthread_root}:libopenthread-mtd", + "${openthread_root}:libopenthread-cli-ftd", + "${openthread_root}:libopenthread-ftd", ] cflags = [ "-Wconversion" ] diff --git a/examples/lighting-app/k32w/include/CHIPProjectConfig.h b/examples/lighting-app/k32w/include/CHIPProjectConfig.h index f2146ccaddfb72..fe699768250bb8 100644 --- a/examples/lighting-app/k32w/include/CHIPProjectConfig.h +++ b/examples/lighting-app/k32w/include/CHIPProjectConfig.h @@ -176,10 +176,24 @@ */ #define CHIP_DEVICE_CONFIG_BLE_ADVERTISING_TIMEOUT (15 * 60 * 1000) +/** + * CONFIG_CHIP_NFC_COMMISSIONING, CHIP_DEVICE_CONFIG_ENABLE_NFC + * + * Set these defines to 1 if NFC Commissioning is needed + */ #define CONFIG_CHIP_NFC_COMMISSIONING 1 - #define CHIP_DEVICE_CONFIG_ENABLE_NFC 1 +/** + * @def CHIP_CONFIG_MAX_DEVICE_ADMINS + * + * @brief + * Maximum number of administrators that can provision the device. Each admin + * can provision the device with their unique operational credentials and manage + * their access control lists. + */ +#define CHIP_CONFIG_MAX_DEVICE_ADMINS 4 // 3 fabrics + 1 for rotation slack + /** * CHIP_CONFIG_EVENT_LOGGING_DEFAULT_IMPORTANCE * diff --git a/examples/lighting-app/k32w/main/AppTask.cpp b/examples/lighting-app/k32w/main/AppTask.cpp index a337d9c0ec3108..bb25ff4abf9266 100644 --- a/examples/lighting-app/k32w/main/AppTask.cpp +++ b/examples/lighting-app/k32w/main/AppTask.cpp @@ -145,7 +145,7 @@ CHIP_ERROR AppTask::Init() K32W_LOG("Current Firmware Version: %s", currentFirmwareRev); -#ifdef CONFIG_CHIP_NFC_COMMISSIONING +#if CONFIG_CHIP_NFC_COMMISSIONING PlatformMgr().AddEventHandler(ThreadProvisioningHandler, 0); #endif @@ -500,7 +500,7 @@ void AppTask::BleHandler(AppEvent * aEvent) } } -#ifdef CONFIG_CHIP_NFC_COMMISSIONING +#if CONFIG_CHIP_NFC_COMMISSIONING void AppTask::ThreadProvisioningHandler(const ChipDeviceEvent * event, intptr_t) { if (event->Type == DeviceEventType::kCHIPoBLEAdvertisingChange && event->CHIPoBLEAdvertisingChange.Result == kActivity_Stopped) diff --git a/examples/lock-app/k32w/BUILD.gn b/examples/lock-app/k32w/BUILD.gn index b62ad861af7701..3c1846bb87e89f 100644 --- a/examples/lock-app/k32w/BUILD.gn +++ b/examples/lock-app/k32w/BUILD.gn @@ -75,8 +75,8 @@ k32w_executable("lock_app") { "${chip_root}/third_party/mbedtls:mbedtls", "${chip_root}/third_party/simw-top-mini:se05x", "${k32w_platform_dir}/app/support:freertos_mbedtls_utils", - "${openthread_root}:libopenthread-cli-ftd", - "${openthread_root}:libopenthread-ftd", + "${openthread_root}:libopenthread-cli-mtd", + "${openthread_root}:libopenthread-mtd", ] cflags = [ "-Wconversion" ] diff --git a/examples/lock-app/k32w/include/CHIPProjectConfig.h b/examples/lock-app/k32w/include/CHIPProjectConfig.h index f2146ccaddfb72..83ed41b96d1db6 100644 --- a/examples/lock-app/k32w/include/CHIPProjectConfig.h +++ b/examples/lock-app/k32w/include/CHIPProjectConfig.h @@ -176,10 +176,31 @@ */ #define CHIP_DEVICE_CONFIG_BLE_ADVERTISING_TIMEOUT (15 * 60 * 1000) +/** + * CONFIG_CHIP_NFC_COMMISSIONING, CHIP_DEVICE_CONFIG_ENABLE_NFC + * + * Set these defines to 1 if NFC Commissioning is needed + */ #define CONFIG_CHIP_NFC_COMMISSIONING 1 - #define CHIP_DEVICE_CONFIG_ENABLE_NFC 1 +/** + * CHIP_DEVICE_CONFIG_THREAD_FTD + * + * E-Lock Demo Application is a Thread SED (Sleepy End Device) + */ +#define CHIP_DEVICE_CONFIG_THREAD_FTD 0 + +/** + * @def CHIP_CONFIG_MAX_DEVICE_ADMINS + * + * @brief + * Maximum number of administrators that can provision the device. Each admin + * can provision the device with their unique operational credentials and manage + * their access control lists. + */ +#define CHIP_CONFIG_MAX_DEVICE_ADMINS 4 // 3 fabrics + 1 for rotation slack + /** * CHIP_CONFIG_EVENT_LOGGING_DEFAULT_IMPORTANCE * diff --git a/examples/platform/k32w/app/project_include/OpenThreadConfig.h b/examples/platform/k32w/app/project_include/OpenThreadConfig.h index 58dd5de1391497..f59258a294be03 100644 --- a/examples/platform/k32w/app/project_include/OpenThreadConfig.h +++ b/examples/platform/k32w/app/project_include/OpenThreadConfig.h @@ -52,6 +52,11 @@ #define OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE 0 #define OPENTHREAD_CONFIG_DHCP6_CLIENT_ENABLE 0 #define OPENTHREAD_CONFIG_DHCP6_SERVER_ENABLE 0 +#define OPENTHREAD_CONFIG_TCP_ENABLE 0 + +#define OPENTHREAD_CONFIG_NUM_MESSAGE_BUFFERS 44 + +//#define OPENTHREAD_CONFIG_LOG_LEVEL OT_LOG_LEVEL_DEBG // Use the NXP-supplied default platform configuration for remainder // of OpenThread config options. diff --git a/src/lwip/k32w/lwipopts.h b/src/lwip/k32w/lwipopts.h index 3aa8308ec12f7d..1a6c599878475a 100644 --- a/src/lwip/k32w/lwipopts.h +++ b/src/lwip/k32w/lwipopts.h @@ -55,9 +55,19 @@ #define LWIP_SOCKET 0 -// TODO: seems like this is unnecessary on Thread-only platforms +#if INET_CONFIG_ENABLE_RAW_ENDPOINT #define LWIP_RAW 1 #define MEMP_NUM_RAW_PCB (5) +#else +#define LWIP_RAW 0 +#define MEMP_NUM_RAW_PCB 0 +#endif // INET_CONFIG_ENABLE_RAW_ENDPOINT +#if INET_CONFIG_ENABLE_TCP_ENDPOINT +#define LWIP_TCP 1 +#else +#define LWIP_TCP 0 +#define MEMP_NUM_TCP_PCB 0 +#endif // INET_CONFIG_ENABLE_TCP_ENDPOINT // TODO: verify count #define MEMP_NUM_UDP_PCB (7) @@ -126,7 +136,7 @@ // TODO: make LWIP_DEBUG conditional on build type -#define LWIP_DEBUG 1 +#define LWIP_DEBUG 0 #define MEMP_OVERFLOW_CHECK (0) #define MEMP_SANITY_CHECK (0) #define MEM_DEBUG (LWIP_DBG_OFF) diff --git a/src/platform/K32W/BUILD.gn b/src/platform/K32W/BUILD.gn index acc122ec6af23e..ee3e724190217d 100644 --- a/src/platform/K32W/BUILD.gn +++ b/src/platform/K32W/BUILD.gn @@ -53,8 +53,6 @@ static_library("K32W") { public_deps = [ "${chip_root}/src/platform:platform_base" ] if (chip_enable_openthread) { - public_deps += [ "${openthread_root}:libopenthread-ftd" ] - sources += [ "../OpenThread/OpenThreadUtils.cpp", "ThreadStackManagerImpl.cpp", diff --git a/src/platform/K32W/K32WConfig.cpp b/src/platform/K32W/K32WConfig.cpp index 48c8ccab11fa0a..6f6d7894805ead 100644 --- a/src/platform/K32W/K32WConfig.cpp +++ b/src/platform/K32W/K32WConfig.cpp @@ -381,16 +381,15 @@ CHIP_ERROR K32WConfig::FactoryResetConfigInternal(Key firstKey, Key lastKey) CHIP_ERROR err; // Iterate over all the CHIP Config PDM ID records and delete each one - err = ForEachRecord(kMinConfigKey_ChipConfig, kMaxConfigKey_ChipConfig, false, - [](const Key & pdmKey, const size_t & length) -> CHIP_ERROR { - CHIP_ERROR err2; + err = ForEachRecord(firstKey, lastKey, false, [](const Key & pdmKey, const size_t & length) -> CHIP_ERROR { + CHIP_ERROR err2; - err2 = ClearConfigValue(pdmKey); - SuccessOrExit(err2); + err2 = ClearConfigValue(pdmKey); + SuccessOrExit(err2); - exit: - return err2; - }); + exit: + return err2; + }); // Return success at end of iterations. if (err == CHIP_END_OF_INPUT) diff --git a/src/platform/K32W/args.gni b/src/platform/K32W/args.gni index 32c9b4fdb92082..758135675b1e0e 100644 --- a/src/platform/K32W/args.gni +++ b/src/platform/K32W/args.gni @@ -23,6 +23,9 @@ lwip_platform = "k32w" chip_inet_config_enable_ipv4 = false chip_inet_config_enable_dns_resolver = false +chip_inet_config_enable_tcp_endpoint = false +chip_inet_config_enable_raw_endpoint = false + chip_build_tests = false chip_mdns = "platform"