From 892b18b6fa363047f2b5e1e74b2eb6350eff1242 Mon Sep 17 00:00:00 2001 From: Dina Benamar Date: Mon, 26 Feb 2024 15:57:40 +0100 Subject: [PATCH] Revert "[nxp noup][platform][k32w] Adding platform code changes for k32w" This reverts commit 8973b882cc4793e37e8f29ea2103d483f3b9cc60. Signed-off-by: Dina Benamar --- .../k32w0_sdk.gni | 14 +- src/lib/shell/BUILD.gn | 5 + src/lib/shell/streamer_k32w.cpp | 76 ++++ src/lwip/BUILD.gn | 15 +- src/lwip/k32w1/arch/cc.h | 90 ---- src/lwip/k32w1/arch/perf.h | 26 -- src/lwip/k32w1/lwipopts.h | 172 -------- src/lwip/k32w1/lwippools.h | 1 - src/platform/BUILD.gn | 8 +- src/platform/device.gni | 9 +- .../nxp/k32w/common/BLEManagerCommon.cpp | 6 +- .../nxp/k32w/common/FactoryDataProvider.cpp | 4 - .../nxp/k32w/common/FactoryDataProvider.h | 2 - .../nxp/k32w/common/K32W_OTA_README.md | 7 +- .../nxp/k32w/common/OTAImageProcessorImpl.cpp | 19 +- src/platform/nxp/k32w/k32w0/BUILD.gn | 22 +- .../nxp/k32w/k32w0/CHIPDevicePlatformConfig.h | 2 +- .../k32w/k32w0/ConfigurationManagerImpl.cpp | 2 - src/platform/nxp/k32w/k32w0/Logging.cpp | 7 + .../nxp/k32w/k32w0/OTAFirmwareProcessor.h | 0 src/platform/nxp/k32w/k32w0/OTAHooks.cpp | 2 - .../nxp/k32w/k32w0/ThreadStackManagerImpl.cpp | 2 + src/platform/nxp/k32w/k32w0/args.gni | 30 +- .../nxp/k32w/k32w1/BLEManagerImpl.cpp | 2 +- src/platform/nxp/k32w/k32w1/BUILD.gn | 6 +- .../k32w/k32w1/DiagnosticDataProviderImpl.cpp | 3 +- .../k32w/k32w1/FactoryDataProviderImpl.cpp | 7 + .../nxp/k32w/k32w1/GroupKeyStoreImpl.cpp | 384 ------------------ .../nxp/k32w/k32w1/GroupKeyStoreImpl.h | 90 ---- src/platform/nxp/k32w/k32w1/K32W1Config.cpp | 4 + .../nxp/k32w/k32w1/OTAFirmwareProcessor.h | 1 + src/platform/nxp/k32w/k32w1/ram_storage.h | 2 +- src/system/BUILD.gn | 5 + third_party/nxp/k32w0_sdk/BUILD.gn | 10 +- ...xp_executable.gni => k32w0_executable.gni} | 0 third_party/nxp/k32w0_sdk/k32w0_sdk.gni | 64 ++- third_party/nxp/k32w1_sdk/k32w1_sdk.gni | 214 +++++----- .../platforms/nxp/k32w/k32w0/BUILD.gn | 9 +- .../platforms/nxp/k32w/k32w1/BUILD.gn | 11 +- 39 files changed, 312 insertions(+), 1021 deletions(-) rename third_party/nxp/k32w0_sdk/nxp_arm.gni => build_overrides/k32w0_sdk.gni (66%) create mode 100644 src/lib/shell/streamer_k32w.cpp delete mode 100644 src/lwip/k32w1/arch/cc.h delete mode 100644 src/lwip/k32w1/arch/perf.h delete mode 100644 src/lwip/k32w1/lwipopts.h delete mode 100644 src/lwip/k32w1/lwippools.h mode change 100755 => 100644 src/platform/nxp/k32w/k32w0/OTAFirmwareProcessor.h delete mode 100644 src/platform/nxp/k32w/k32w1/GroupKeyStoreImpl.cpp delete mode 100644 src/platform/nxp/k32w/k32w1/GroupKeyStoreImpl.h rename third_party/nxp/k32w0_sdk/{nxp_executable.gni => k32w0_executable.gni} (100%) mode change 100755 => 100644 third_party/nxp/k32w0_sdk/k32w0_sdk.gni diff --git a/third_party/nxp/k32w0_sdk/nxp_arm.gni b/build_overrides/k32w0_sdk.gni similarity index 66% rename from third_party/nxp/k32w0_sdk/nxp_arm.gni rename to build_overrides/k32w0_sdk.gni index 5afd55a8b3129f..fa487e9e7fb254 100644 --- a/third_party/nxp/k32w0_sdk/nxp_arm.gni +++ b/build_overrides/k32w0_sdk.gni @@ -1,4 +1,4 @@ -# Copyright (c) 2023 Project CHIP Authors +# Copyright (c) 2020 Project CHIP Authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -12,11 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -import("//build_overrides/nxp_sdk.gni") -import("${nxp_sdk_build_root}/nxp_sdk.gni") - -assert(nxp_platform == "k32w/k32w0", "${nxp_platform} must be k32w/k32w0.") - -arm_float_abi = "soft" -arm_cpu = "cortex-m4" -arm_arch = "armv7e-m" +declare_args() { + # Root directory for K32W SDK build files. + k32w0_sdk_build_root = "//third_party/nxp/k32w0_sdk" +} diff --git a/src/lib/shell/BUILD.gn b/src/lib/shell/BUILD.gn index 10dad73a268602..0bc5ce60874e02 100644 --- a/src/lib/shell/BUILD.gn +++ b/src/lib/shell/BUILD.gn @@ -56,6 +56,11 @@ static_library("shell") { "MainLoopSilabs.cpp", "streamer_silabs.cpp", ] + } else if (chip_device_platform == "k32w0") { + sources += [ + "MainLoopDefault.cpp", + "streamer_k32w.cpp", + ] } else if (chip_device_platform == "nxp") { sources += [ "MainLoopDefault.cpp", diff --git a/src/lib/shell/streamer_k32w.cpp b/src/lib/shell/streamer_k32w.cpp new file mode 100644 index 00000000000000..fadcb82f1913e1 --- /dev/null +++ b/src/lib/shell/streamer_k32w.cpp @@ -0,0 +1,76 @@ +/* + * + * Copyright (c) 2021 Project CHIP Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file + * Source implementation of an input / output stream for k32w targets. + */ + +#include +#include + +#include +#include + +#include "SerialManager.h" +extern uint8_t gShellSerMgrIf; + +namespace chip { +namespace Shell { +namespace { +extern "C" void K32WWriteBlocking(const uint8_t * aBuf, uint32_t len); +extern "C" serialStatus_t Serial_Read(uint8_t InterfaceId, uint8_t * pData, uint16_t dataSize, uint16_t * bytesRead); + +int streamer_k32w_init(streamer_t * streamer) +{ + (void) streamer; + + return 0; +} + +ssize_t streamer_k32w_read(streamer_t * streamer, char * buffer, size_t length) +{ + uint16_t bytesRead = 0; + + (void) streamer; + Serial_Read(gShellSerMgrIf, (uint8_t *) buffer, length, &bytesRead); + + return bytesRead; +} + +ssize_t streamer_k32w_write(streamer_t * streamer, const char * buffer, size_t length) +{ + (void) streamer; + K32WWriteBlocking((uint8_t *) buffer, length); + + return length; +} + +static streamer_t streamer_k32w = { + .init_cb = streamer_k32w_init, + .read_cb = streamer_k32w_read, + .write_cb = streamer_k32w_write, +}; +} // namespace + +streamer_t * streamer_get(void) +{ + return &streamer_k32w; +} + +} // namespace Shell +} // namespace chip diff --git a/src/lwip/BUILD.gn b/src/lwip/BUILD.gn index ada913d059e579..79bd5285e5c5c0 100644 --- a/src/lwip/BUILD.gn +++ b/src/lwip/BUILD.gn @@ -30,11 +30,12 @@ if (lwip_platform == "") { assert(lwip_platform == "external" || lwip_platform == "standalone" || lwip_platform == "cc13xx_26xx" || lwip_platform == "cc32xx" || lwip_platform == "nxp" || lwip_platform == "silabs" || - lwip_platform == "qpg" || lwip_platform == "mbed" || - lwip_platform == "psoc6" || lwip_platform == "cyw30739" || - lwip_platform == "bl602" || lwip_platform == "mw320" || - lwip_platform == "bl702" || lwip_platform == "bl702l" || - lwip_platform == "mt793x" || lwip_platform == "asr", + lwip_platform == "k32w0" || lwip_platform == "qpg" || + lwip_platform == "mbed" || lwip_platform == "psoc6" || + lwip_platform == "cyw30739" || lwip_platform == "bl602" || + lwip_platform == "mw320" || lwip_platform == "bl702" || + lwip_platform == "bl702l" || lwip_platform == "mt793x" || + lwip_platform == "asr", "Unsupported lwIP platform: ${lwip_platform}") if (lwip_platform != "external") { @@ -53,6 +54,8 @@ if (lwip_platform == "cc13xx_26xx") { } else if (lwip_platform == "qpg") { import("//build_overrides/qpg_sdk.gni") import("${qpg_sdk_build_root}/qpg_sdk.gni") +} else if (lwip_platform == "k32w0") { + import("//build_overrides/k32w0_sdk.gni") } else if (lwip_platform == "psoc6") { import("//build_overrides/psoc6.gni") } else if (lwip_platform == "cyw30739") { @@ -222,6 +225,8 @@ if (current_os == "zephyr" || current_os == "mbed") { public_deps += [ "${efr32_sdk_build_root}:efr32_sdk" ] } else if (lwip_platform == "standalone") { public_deps += [ "${chip_root}/src/lib/support" ] + } else if (lwip_platform == "k32w0") { + public_deps += [ "${k32w0_sdk_build_root}:k32w0_sdk" ] } else if (lwip_platform == "cyw30739") { public_deps += [ "${cyw30739_sdk_build_root}:cyw30739_sdk" ] } else if (lwip_platform == "bl702") { diff --git a/src/lwip/k32w1/arch/cc.h b/src/lwip/k32w1/arch/cc.h deleted file mode 100644 index 0dd3a291498a93..00000000000000 --- a/src/lwip/k32w1/arch/cc.h +++ /dev/null @@ -1,90 +0,0 @@ -/* - * - * Copyright (c) 2020 Nest Labs, Inc. - * All rights reserved. - * - * This document is the property of Nest. It is considered - * confidential and proprietary information. - * - * This document may not be reproduced or transmitted in any form, - * in whole or in part, without the express written permission of - * Nest. - * - * Description: - * This file defines processor-architecture- and toolchain- - * specific constants and types required for building - * LwIP against FreeRTOS. - * - */ - -#ifndef NL_LWIP_FREERTOS_ARCH_CC_H -#define NL_LWIP_FREERTOS_ARCH_CC_H - -#include -#include -#include -#include -#include -#include -#include - -#if CHIP_CONFIG_MEMORY_MGMT_MALLOC -#include -#endif - -#if __cplusplus -extern "C" { -#endif - -#ifndef LWIP_NOASSERT -#ifdef DEBUG -#define LWIP_PLATFORM_ASSERT(MSG) assert(MSG); -#else -#define LWIP_PLATFORM_ASSERT(MSG) -#endif -#else -#define LWIP_PLATFORM_ASSERT(message) -#endif - -#ifndef BYTE_ORDER -#if defined(__LITTLE_ENDIAN__) -#define BYTE_ORDER LITTLE_ENDIAN -#elif defined(__BIG_ENDIAN__) -#define BYTE_ORDER BIG_ENDIAN -#elif defined(__BYTE_ORDER__) -#define BYTE_ORDER __BYTE_ORDER__ -#endif -#endif // BYTE_ORDER - -#define PACK_STRUCT_STRUCT __attribute__((__packed__)) -#define PACK_STRUCT_FIELD(x) x - -extern void LwIPLog(const char * fmt, ...); -#define LWIP_PLATFORM_DIAG(x) \ - do \ - { \ - LwIPLog x; \ - } while (0) - -// Place LwIP pools into their own subsections of .bss to make it easier to see -// their sizes in the linker map file. -extern uint8_t __attribute__((section(".bss.lwip_ND6_QUEUE"))) memp_memory_ND6_QUEUE_base[]; -extern uint8_t __attribute__((section(".bss.lwip_IP6_REASSDATA"))) memp_memory_IP6_REASSDATA_base[]; -extern uint8_t __attribute__((section(".bss.lwip_RAW_PCB"))) memp_memory_RAW_PCB_base[]; -extern uint8_t __attribute__((section(".bss.lwip_TCP_SEG"))) memp_memory_TCP_SEG_base[]; -extern uint8_t __attribute__((section(".bss.lwip_PBUF_POOL"))) memp_memory_PBUF_POOL_base[]; -extern uint8_t __attribute__((section(".bss.lwip_FRAG_PBUF"))) memp_memory_FRAG_PBUF_base[]; -extern uint8_t __attribute__((section(".bss.lwip_PBUF"))) memp_memory_PBUF_base[]; -extern uint8_t __attribute__((section(".bss.lwip_TCP_PCB_LISTEN"))) memp_memory_TCP_PCB_LISTEN_base[]; -extern uint8_t __attribute__((section(".bss.lwip_REASSDATA"))) memp_memory_REASSDATA_base[]; -extern uint8_t __attribute__((section(".bss.lwip_UDP_PCB"))) memp_memory_UDP_PCB_base[]; -extern uint8_t __attribute__((section(".bss.lwip_MLD6_GROUP"))) memp_memory_MLD6_GROUP_base[]; -extern uint8_t __attribute__((section(".bss.lwip_IGMP_GROUP"))) memp_memory_IGMP_GROUP_base[]; -extern uint8_t __attribute__((section(".bss.lwip_TCP_PCB"))) memp_memory_TCP_PCB_base[]; -extern uint8_t __attribute__((section(".bss.lwip_SYS_TIMEOUT"))) memp_memory_SYS_TIMEOUT_base[]; - -#if __cplusplus -} -#endif - -#endif /* NL_LWIP_FREERTOS_ARCH_CC_H */ diff --git a/src/lwip/k32w1/arch/perf.h b/src/lwip/k32w1/arch/perf.h deleted file mode 100644 index bbef2139053135..00000000000000 --- a/src/lwip/k32w1/arch/perf.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - * - * Copyright (c) 2020 Nest Labs, Inc. - * All rights reserved. - * - * This document is the property of Nest. It is considered - * confidential and proprietary information. - * - * This document may not be reproduced or transmitted in any form, - * in whole or in part, without the express written permission of - * Nest. - * - * Description: - * This file defines processor-architecture-specific constants, - * interfaces and types required for LwIP performance - * measurement. - * - */ - -#ifndef NL_LWIP_FREERTOS_ARCH_PERF_H -#define NL_LWIP_FREERTOS_ARCH_PERF_H - -#define PERF_START -#define PERF_STOP(s) - -#endif /* NL_LWIP_FREERTOS_ARCH_PERF_H */ diff --git a/src/lwip/k32w1/lwipopts.h b/src/lwip/k32w1/lwipopts.h deleted file mode 100644 index 1ecec9f14f0a70..00000000000000 --- a/src/lwip/k32w1/lwipopts.h +++ /dev/null @@ -1,172 +0,0 @@ -/* - * - * Copyright (c) 2020 Nest Labs, Inc. - * All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @file - * Compile-time configuration for LwIP on K32W platforms using the - * NXP K32W SDK. - * - */ - -#ifndef __LWIPOPTS_H__ -#define __LWIPOPTS_H__ - -#if CHIP_HAVE_CONFIG_H -#include -#endif - -#include - -#define NO_SYS 0 -#define MEM_ALIGNMENT (4) -#define MEMP_NUM_TCP_SEG (TCP_SND_QUEUELEN + 1) -#define LWIP_TIMEVAL_PRIVATE (0) -#define MEM_LIBC_MALLOC (0) -#define LWIP_COMPAT_MUTEX (0) -#define SYS_LIGHTWEIGHT_PROT (1) -#define LWIP_AUTOIP (0) -#define LWIP_DHCP_AUTOIP_COOP (0) -#define LWIP_SOCKET_SET_ERRNO 0 -#define IP_REASS_MAX_PBUFS 0 -#define IP_REASSEMBLY 0 -#define MEMP_NUM_REASSDATA 0 -#define LWIP_SO_RCVTIMEO 0 -#define SO_REUSE (1) -#define LWIP_RANDOMIZE_INITIAL_LOCAL_PORTS (1) -#define LWIP_STATS (0) -#define LWIP_TCPIP_CORE_LOCKING 1 -#define TCP_QUEUE_OOSEQ 0 -#define ARP_QUEUEING (0) - -#define LWIP_SOCKET 0 - -#define LWIP_RAW 0 -#define MEMP_NUM_RAW_PCB 0 -#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) - -#define LWIP_HAVE_LOOPIF (0) - -// TODO: not sure why this is disabled -#define LWIP_NETIF_LOOPBACK (0) - -#define MEMP_NUM_NETCONN (0) - -#define LWIP_IPV4 0 -#define LWIP_IPV6 1 -#define LWIP_ARP (0) -#define LWIP_DNS (0) -#define LWIP_ICMP (0) -#define LWIP_IGMP (0) -#define LWIP_DHCP (0) -#define LWIP_IPV6_REASS (0) -#define LWIP_IPV6_DHCP6 0 -#define LWIP_IPV6_AUTOCONFIG (0) -#define LWIP_IPV6_ROUTER_SUPPORT 0 -#define LWIP_ND6_LISTEN_RA 0 - -#define LWIP_ND6_NUM_NEIGHBORS (0) -#define LWIP_ND6_NUM_DESTINATIONS (0) -#define LWIP_ND6_NUM_PREFIXES (0) -#define LWIP_ND6_NUM_ROUTERS (0) -#define LWIP_ND6_MAX_MULTICAST_SOLICIT (0) -#define LWIP_ND6_MAX_UNICAST_SOLICIT (0) -#define LWIP_ND6_MAX_NEIGHBOR_ADVERTISEMENT (0) -#define LWIP_ND6_TCP_REACHABILITY_HINTS (0) - -#define MEMP_SEPARATE_POOLS (1) -#define LWIP_PBUF_FROM_CUSTOM_POOLS (0) -#define MEMP_USE_CUSTOM_POOLS (0) -#define PBUF_POOL_SIZE (6) -#define PBUF_POOL_BUFSIZE (1280) -#define PBUF_CUSTOM_POOL_IDX_START (MEMP_PBUF_POOL_SMALL) -#define PBUF_CUSTOM_POOL_IDX_END (MEMP_PBUF_POOL_LARGE) - -#define TCP_MSS (1152) -#define TCP_SND_BUF (2 * TCP_MSS) -#define TCP_LISTEN_BACKLOG (1) - -#define ETH_PAD_SIZE (0) -#define SUB_ETHERNET_HEADER_SPACE (0) -#define PBUF_LINK_HLEN (0) - -#define TCPIP_THREAD_STACKSIZE (2048) -#define TCPIP_THREAD_PRIO (3) - -#define NETIF_MAX_HWADDR_LEN 8U - -#define LWIP_IPV6_NUM_ADDRESSES 5 - -#define LWIP_IPV6_ND 0 -#define LWIP_ND6_QUEUEING 0 - -#define LWIP_MULTICAST_PING 0 - -#define TCPIP_MBOX_SIZE 6 -#define DEFAULT_RAW_RECVMBOX_SIZE 6 -#define DEFAULT_UDP_RECVMBOX_SIZE 6 -#define DEFAULT_TCP_RECVMBOX_SIZE 6 - -// TODO: make LWIP_DEBUG conditional on build type - -#ifndef LWIP_DEBUG -#define LWIP_DEBUG 0 -#endif - -#define MEMP_OVERFLOW_CHECK (0) -#define MEMP_SANITY_CHECK (0) -#define MEM_DEBUG (LWIP_DBG_OFF) -#define MEMP_DEBUG (LWIP_DBG_OFF) -#define PBUF_DEBUG (LWIP_DBG_OFF) -#define API_LIB_DEBUG (LWIP_DBG_OFF) -#define API_MSG_DEBUG (LWIP_DBG_OFF) -#define TCPIP_DEBUG (LWIP_DBG_OFF) -#define NETIF_DEBUG (LWIP_DBG_OFF) -#define SOCKETS_DEBUG (LWIP_DBG_OFF) -#define DEMO_DEBUG (LWIP_DBG_OFF) -#define DHCP_DEBUG (LWIP_DBG_OFF) -#define AUTOIP_DEBUG (LWIP_DBG_OFF) -#define ETHARP_DEBUG (LWIP_DBG_OFF) -#define IP_DEBUG (LWIP_DBG_OFF) -#define IP_REASS_DEBUG (LWIP_DBG_OFF) -#define IP6_DEBUG (LWIP_DBG_OFF) -#define RAW_DEBUG (LWIP_DBG_OFF) -#define ICMP_DEBUG (LWIP_DBG_OFF) -#define UDP_DEBUG (LWIP_DBG_OFF) -#define TCP_DEBUG (LWIP_DBG_OFF) -#define TCP_INPUT_DEBUG (LWIP_DBG_OFF) -#define TCP_OUTPUT_DEBUG (LWIP_DBG_OFF) -#define TCP_RTO_DEBUG (LWIP_DBG_OFF) -#define TCP_CWND_DEBUG (LWIP_DBG_OFF) -#define TCP_WND_DEBUG (LWIP_DBG_OFF) -#define TCP_FR_DEBUG (LWIP_DBG_OFF) -#define TCP_QLEN_DEBUG (LWIP_DBG_OFF) -#define TCP_RST_DEBUG (LWIP_DBG_OFF) -#define PPP_DEBUG (LWIP_DBG_OFF) - -#define LWIP_DBG_TYPES_ON \ - (LWIP_DBG_ON | LWIP_DBG_TRACE) /* (LWIP_DBG_ON|LWIP_DBG_TRACE|LWIP_DBG_STATE|LWIP_DBG_FRESH|LWIP_DBG_HALT) */ - -#endif /* __LWIPOPTS_H__ */ diff --git a/src/lwip/k32w1/lwippools.h b/src/lwip/k32w1/lwippools.h deleted file mode 100644 index 8b137891791fe9..00000000000000 --- a/src/lwip/k32w1/lwippools.h +++ /dev/null @@ -1 +0,0 @@ - diff --git a/src/platform/BUILD.gn b/src/platform/BUILD.gn index 26f6185c141330..8d0812cdd1a217 100644 --- a/src/platform/BUILD.gn +++ b/src/platform/BUILD.gn @@ -127,7 +127,7 @@ if (chip_device_platform != "none" && chip_device_platform != "external") { if (chip_device_platform == "linux" || chip_device_platform == "darwin" || chip_device_platform == "tizen" || chip_device_platform == "android" || - chip_device_platform == "webos" || + chip_device_platform == "k32w0" || chip_device_platform == "webos" || chip_device_platform == "bl602" || chip_device_platform == "bl702" || chip_device_platform == "bl702l") { defines += [ "CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE=${chip_enable_ble}" ] @@ -203,6 +203,9 @@ if (chip_device_platform != "none" && chip_device_platform != "external") { } else if (chip_device_platform == "qpg") { device_layer_target_define = "QPG" defines += [ "CHIP_DEVICE_LAYER_TARGET=qpg" ] + } else if (chip_device_platform == "k32w0") { + device_layer_target_define = "K32W" + defines += [ "CHIP_DEVICE_LAYER_TARGET=nxp/k32w/k32w0" ] } else if (chip_device_platform == "nxp") { import("//build_overrides/nxp_sdk.gni") import("${nxp_sdk_build_root}/nxp_sdk.gni") @@ -318,6 +321,7 @@ if (chip_device_platform != "none" && chip_device_platform != "external") { "TIZEN", "NRFCONNECT", "QPG", + "K32W", "NXP", "NXP_ZEPHYR", "TELINK", @@ -520,6 +524,8 @@ if (chip_device_platform != "none") { _platform_target = "silabs/SiWx917" } else if (chip_device_platform == "esp32") { _platform_target = "ESP32" + } else if (chip_device_platform == "k32w0") { + _platform_target = "nxp/k32w/k32w0" } else if (chip_device_platform == "linux") { _platform_target = "Linux" } else if (chip_device_platform == "nrfconnect") { diff --git a/src/platform/device.gni b/src/platform/device.gni index 7a5c4a6fcd57b7..d3654dc170ca4f 100644 --- a/src/platform/device.gni +++ b/src/platform/device.gni @@ -16,7 +16,7 @@ import("//build_overrides/chip.gni") import("${chip_root}/src/ble/ble.gni") declare_args() { - # Device platform layer: cc13x2_26x2, cc13x4_26x4, cc32xx, darwin, efr32, esp32, external, freertos, linux, nrfconnect, nxp, qpg, tizen, cyw30739, bl602, mw320, zephyr, beken, openiotsdk, none. + # Device platform layer: cc13x2_26x2, cc13x4_26x4, cc32xx, darwin, efr32, esp32, external, freertos, linux, nrfconnect, k32w0, nxp, qpg, tizen, cyw30739, bl602, mw320, zephyr, beken, openiotsdk, none. chip_device_platform = "auto" chip_platform_target = "" @@ -51,8 +51,8 @@ declare_args() { chip_device_platform == "linux" || chip_device_platform == "qpg" || chip_device_platform == "cc13x2_26x2" || chip_device_platform == "cc13x4_26x4" || - chip_device_platform == "tizen" || chip_device_platform == "stm32" || - chip_device_platform == "webos" + chip_device_platform == "k32w0" || chip_device_platform == "tizen" || + chip_device_platform == "stm32" || chip_device_platform == "webos" } declare_args() { @@ -149,6 +149,8 @@ if (chip_device_platform == "cc13x2_26x2") { _chip_device_layer = "nrfconnect" } else if (chip_device_platform == "qpg") { _chip_device_layer = "qpg" +} else if (chip_device_platform == "k32w0") { + _chip_device_layer = "nxp/k32w/k32w0" } else if (chip_device_platform == "nxp") { import("//build_overrides/nxp_sdk.gni") import("${nxp_sdk_build_root}/nxp_sdk.gni") @@ -250,6 +252,7 @@ assert( chip_device_platform == "external" || chip_device_platform == "linux" || chip_device_platform == "tizen" || chip_device_platform == "nrfconnect" || chip_device_platform == "nxp" || + chip_device_platform == "k32w0" || chip_device_platform == "nxp_zephyr" || chip_device_platform == "qpg" || chip_device_platform == "telink" || chip_device_platform == "mbed" || chip_device_platform == "psoc6" || chip_device_platform == "android" || diff --git a/src/platform/nxp/k32w/common/BLEManagerCommon.cpp b/src/platform/nxp/k32w/common/BLEManagerCommon.cpp index b532ddef7f207e..40f9bc5c7d7abf 100644 --- a/src/platform/nxp/k32w/common/BLEManagerCommon.cpp +++ b/src/platform/nxp/k32w/common/BLEManagerCommon.cpp @@ -135,7 +135,7 @@ const ChipBleUUID ChipUUID_CHIPoBLEChar_TX = { { 0x18, 0xEE, 0x2E, 0xF5, 0x26, 0 static bool bleAppStopInProgress; #endif -BLEManagerCommon * sImplInstance = nullptr; +BLEManagerCommon * sImplInstance; } // namespace @@ -1085,7 +1085,7 @@ void BLEManagerCommon::blekw_generic_cb(gapGenericEvent_t * pGenericEvent) /* Call BLE Conn Manager */ BleConnManager_GenericEvent(pGenericEvent); - if (sImplInstance && sImplInstance->callbackDelegate.gapCallback) + if (sImplInstance->callbackDelegate.gapCallback) { sImplInstance->callbackDelegate.gapCallback(pGenericEvent); } @@ -1240,7 +1240,7 @@ void BLEManagerCommon::blekw_stop_connection_timeout(void) void BLEManagerCommon::blekw_gatt_server_cb(deviceId_t deviceId, gattServerEvent_t * pServerEvent) { - if (sImplInstance && sImplInstance->callbackDelegate.gattCallback) + if (sImplInstance->callbackDelegate.gattCallback) { sImplInstance->callbackDelegate.gattCallback(deviceId, pServerEvent); } diff --git a/src/platform/nxp/k32w/common/FactoryDataProvider.cpp b/src/platform/nxp/k32w/common/FactoryDataProvider.cpp index dd79b020c881ea..1770cf22c659f0 100644 --- a/src/platform/nxp/k32w/common/FactoryDataProvider.cpp +++ b/src/platform/nxp/k32w/common/FactoryDataProvider.cpp @@ -39,10 +39,6 @@ namespace DeviceLayer { static constexpr size_t kSpake2pSerializedVerifier_MaxBase64Len = BASE64_ENCODED_LEN(chip::Crypto::kSpake2p_VerifierSerialized_Length) + 1; static constexpr size_t kSpake2pSalt_MaxBase64Len = BASE64_ENCODED_LEN(chip::Crypto::kSpake2p_Max_PBKDF_Salt_Length) + 1; -/* Secure subsystem private key blob size is 32 + 24 = 56. - * DAC private key may be used to store an SSS exported blob instead of the private key. - */ -static constexpr size_t kDacPrivateKey_MaxLen = Crypto::kP256_PrivateKey_Length + 24; uint32_t FactoryDataProvider::kFactoryDataStart = (uint32_t) __MATTER_FACTORY_DATA_START; uint32_t FactoryDataProvider::kFactoryDataSize = (uint32_t) __MATTER_FACTORY_DATA_SIZE; diff --git a/src/platform/nxp/k32w/common/FactoryDataProvider.h b/src/platform/nxp/k32w/common/FactoryDataProvider.h index 03ccf370f7641c..2bad3e7934482f 100644 --- a/src/platform/nxp/k32w/common/FactoryDataProvider.h +++ b/src/platform/nxp/k32w/common/FactoryDataProvider.h @@ -25,8 +25,6 @@ #include "CHIPPlatformConfig.h" -#include - /* Grab symbol for the base address from the linker file. */ extern uint32_t __MATTER_FACTORY_DATA_START[]; extern uint32_t __MATTER_FACTORY_DATA_SIZE[]; diff --git a/src/platform/nxp/k32w/common/K32W_OTA_README.md b/src/platform/nxp/k32w/common/K32W_OTA_README.md index cad1c730690b4a..63079e0ce3c81e 100644 --- a/src/platform/nxp/k32w/common/K32W_OTA_README.md +++ b/src/platform/nxp/k32w/common/K32W_OTA_README.md @@ -48,6 +48,7 @@ public: CHIP_ERROR Process(ByteSpan & block); void RegisterDescriptorCallback(ProcessDescriptor callback); + protected: virtual CHIP_ERROR ProcessInternal(ByteSpan & block) = 0; }; @@ -123,9 +124,9 @@ implementation. The OTA image should be generated with the Prior to factory data update, the old factory data is backed up in external flash. If anything interrupts the update (e.g. power loss), there is a slight chance the internal flash factory data section is erased and has to be restored -at next boot. The `FactoryDataProvider` offers a default restore mechanism -and support for registering additional restore mechanisms or overwriting the -default one. +at next boot. The `FactoryDataProvider` offers a default restore mechanism and +support for registering additional restore mechanisms or overwriting the default +one. Prior to factory data update, the old factory data is backed up in external flash. If anything interrupts the update (e.g. power loss), there is a slight diff --git a/src/platform/nxp/k32w/common/OTAImageProcessorImpl.cpp b/src/platform/nxp/k32w/common/OTAImageProcessorImpl.cpp index e5b739ab2b3bf5..591d082ea992f7 100644 --- a/src/platform/nxp/k32w/common/OTAImageProcessorImpl.cpp +++ b/src/platform/nxp/k32w/common/OTAImageProcessorImpl.cpp @@ -110,8 +110,6 @@ void OTAImageProcessorImpl::HandlePrepareDownload(intptr_t context) GetRequestorInstance()->GetProviderLocation(imageProcessor->mBackupProviderLocation); - GetRequestorInstance()->GetProviderLocation(imageProcessor->mBackupProviderLocation); - imageProcessor->mHeaderParser.Init(); imageProcessor->mAccumulator.Init(sizeof(OTATlvHeader)); imageProcessor->mDownloader->OnPreparedForDownload(CHIP_NO_ERROR); @@ -181,11 +179,11 @@ CHIP_ERROR OTAImageProcessorImpl::SelectProcessor(ByteSpan & block) auto pair = mProcessorMap.find(header.tag); if (pair == mProcessorMap.end()) { - ChipLogError(SoftwareUpdate, "There is no registered processor for tag: %" PRIu32, header.tag); + ChipLogError(SoftwareUpdate, "There is no registered processor for tag: %lu", header.tag); return CHIP_OTA_PROCESSOR_NOT_REGISTERED; } - ChipLogDetail(SoftwareUpdate, "Selected processor with tag: %ld", pair->first); + ChipLogDetail(SoftwareUpdate, "Selected processor with tag: %lu", pair->first); mCurrentProcessor = pair->second; mCurrentProcessor->SetLength(header.length); mCurrentProcessor->SetWasSelected(true); @@ -198,7 +196,7 @@ CHIP_ERROR OTAImageProcessorImpl::RegisterProcessor(uint32_t tag, OTATlvProcesso auto pair = mProcessorMap.find(tag); if (pair != mProcessorMap.end()) { - ChipLogError(SoftwareUpdate, "A processor for tag %" PRIu32 " is already registered.", tag); + ChipLogError(SoftwareUpdate, "A processor for tag %lu is already registered.", tag); return CHIP_OTA_PROCESSOR_ALREADY_REGISTERED; } @@ -300,8 +298,8 @@ CHIP_ERROR OTAImageProcessorImpl::ConfirmCurrentImage() ReturnErrorOnFailure(DeviceLayer::ConfigurationMgr().GetSoftwareVersion(currentVersion)); if (currentVersion != targetVersion) { - ChipLogError(SoftwareUpdate, "Current sw version %" PRIu32 " is different than the expected sw version = %" PRIu32, - currentVersion, targetVersion); + ChipLogError(SoftwareUpdate, "Current sw version %lu is different than the expected sw version = %lu", currentVersion, + targetVersion); return CHIP_ERROR_INCORRECT_STATE; } @@ -386,14 +384,17 @@ void OTAImageProcessorImpl::HandleApply(intptr_t context) imageProcessor->mAccumulator.Clear(); ConfigurationManagerImpl().StoreSoftwareUpdateCompleted(); - PlatformMgr().HandleServerShuttingDown(); // Set the necessary information to inform the SSBL that a new image is available // and trigger the actual device reboot after some time, to take into account // queued actions, e.g. sending events to a subscription SystemLayer().StartTimer( chip::System::Clock::Milliseconds32(CHIP_DEVICE_LAYER_OTA_REBOOT_DELAY), - [](chip::System::Layer *, void *) { OtaHookReset(); }, nullptr); + [](chip::System::Layer *, void *) { + PlatformMgr().HandleServerShuttingDown(); + OtaHookReset(); + }, + nullptr); } CHIP_ERROR OTAImageProcessorImpl::ReleaseBlock() diff --git a/src/platform/nxp/k32w/k32w0/BUILD.gn b/src/platform/nxp/k32w/k32w0/BUILD.gn index 64babc97455708..a58609f28ef539 100644 --- a/src/platform/nxp/k32w/k32w0/BUILD.gn +++ b/src/platform/nxp/k32w/k32w0/BUILD.gn @@ -13,25 +13,24 @@ # limitations under the License. import("//build_overrides/chip.gni") -import("//build_overrides/nxp_sdk.gni") +import("//build_overrides/k32w0_sdk.gni") import("${chip_root}/src/platform/device.gni") -import("${nxp_sdk_build_root}/${nxp_sdk_name}/${nxp_sdk_name}.gni") +import("${k32w0_sdk_build_root}/k32w0_sdk.gni") -assert(chip_device_platform == "nxp") -assert(nxp_platform == "k32w/k32w0") +assert(chip_device_platform == "k32w0") if (chip_enable_openthread) { import("//build_overrides/openthread.gni") } -static_library("nxp_platform") { +static_library("k32w0") { sources = [ "../../../SingletonConfigurationManager.cpp", - "BLEManagerImpl.cpp", - "BLEManagerImpl.h", "../common/BLEManagerCommon.cpp", "../common/BLEManagerCommon.h", + "BLEManagerImpl.cpp", + "BLEManagerImpl.h", "CHIPDevicePlatformConfig.h", "CHIPDevicePlatformEvent.h", "ConfigurationManagerImpl.cpp", @@ -61,7 +60,6 @@ static_library("nxp_platform") { "${chip_root}/src/credentials/examples/DeviceAttestationCredsExample.h", "${chip_root}/src/credentials/examples/ExampleDACs.h", "${chip_root}/src/credentials/examples/ExamplePAI.h", - "${chip_root}/src/platform/nxp/k32w/k32w0/BLEManagerImpl.h", ] if (chip_with_factory_data == 1) { @@ -80,15 +78,13 @@ static_library("nxp_platform") { } if (chip_enable_ota_requestor) { - public += [ - "../common/OTAImageProcessorImpl.h" - ] + public += [ "../common/OTAImageProcessorImpl.h" ] sources += [ "../common/OTAImageProcessorImpl.cpp", "../common/OTAImageProcessorImpl.h", "../common/OTATlvProcessor.cpp", - "../common/OTATlvProcessor.h" + "../common/OTATlvProcessor.h", ] if (chip_enable_ota_firmware_processor == 1) { @@ -123,7 +119,7 @@ static_library("nxp_platform") { sources += [ "${chip_root}/src/platform/nxp/k32w/k32w0/crypto/CHIPCryptoPALNXPUltrafastP256.cpp" ] public_deps += [ - "${nxp_sdk_build_root}/${nxp_sdk_name}:nxp_sdk", + "${chip_root}/third_party/nxp/k32w0_sdk:k32w0_sdk", "${mbedtls_root}:mbedtls", ] } diff --git a/src/platform/nxp/k32w/k32w0/CHIPDevicePlatformConfig.h b/src/platform/nxp/k32w/k32w0/CHIPDevicePlatformConfig.h index eeef146e1a978a..a584e0c79afbbb 100644 --- a/src/platform/nxp/k32w/k32w0/CHIPDevicePlatformConfig.h +++ b/src/platform/nxp/k32w/k32w0/CHIPDevicePlatformConfig.h @@ -144,7 +144,7 @@ #endif // CHIP_DEVICE_CONFIG_THREAD_TASK_STACK_SIZE // Max size of event queue -#define CHIP_DEVICE_CONFIG_MAX_EVENT_QUEUE_SIZE 25 +#define CHIP_DEVICE_CONFIG_MAX_EVENT_QUEUE_SIZE 75 #ifndef CHIP_DEVICE_CONFIG_BLE_APP_TASK_NAME #define CHIP_DEVICE_CONFIG_BLE_APP_TASK_NAME "BLE App Task" diff --git a/src/platform/nxp/k32w/k32w0/ConfigurationManagerImpl.cpp b/src/platform/nxp/k32w/k32w0/ConfigurationManagerImpl.cpp index a8ce993c6dedbd..d7e9088f322143 100644 --- a/src/platform/nxp/k32w/k32w0/ConfigurationManagerImpl.cpp +++ b/src/platform/nxp/k32w/k32w0/ConfigurationManagerImpl.cpp @@ -70,8 +70,6 @@ CHIP_ERROR ConfigurationManagerImpl::Init() SuccessOrExit(err = DetermineBootReason(rebootCause)); - rebootCause = POWER_GetResetCause(); - // Initialize the generic implementation base class. err = Internal::GenericConfigurationManagerImpl::Init(); SuccessOrExit(err); diff --git a/src/platform/nxp/k32w/k32w0/Logging.cpp b/src/platform/nxp/k32w/k32w0/Logging.cpp index 5fc5b64d4404d9..537ceed1181694 100644 --- a/src/platform/nxp/k32w/k32w0/Logging.cpp +++ b/src/platform/nxp/k32w/k32w0/Logging.cpp @@ -27,6 +27,7 @@ static constexpr uint8_t category_max_len_bytes = 3; #include #endif // CHIP_DEVICE_CONFIG_ENABLE_THREAD +static bool isLogInitialized; extern "C" uint32_t otPlatAlarmMilliGetNow(void); namespace chip { @@ -104,6 +105,12 @@ void ENFORCE_FORMAT(1, 0) GenericLog(const char * format, va_list arg, const cha char formattedMsg[CHIP_CONFIG_LOG_MESSAGE_MAX_SIZE - 1] = { 0 }; size_t prefixLen, writtenLen; + if (!isLogInitialized) + { + isLogInitialized = true; + otPlatUartEnable(); + } + /* Prefix is composed of [Time Reference][Debug String][Module Name String] */ FillPrefix(formattedMsg, CHIP_CONFIG_LOG_MESSAGE_MAX_SIZE - 1, module, category); prefixLen = strlen(formattedMsg); diff --git a/src/platform/nxp/k32w/k32w0/OTAFirmwareProcessor.h b/src/platform/nxp/k32w/k32w0/OTAFirmwareProcessor.h old mode 100755 new mode 100644 diff --git a/src/platform/nxp/k32w/k32w0/OTAHooks.cpp b/src/platform/nxp/k32w/k32w0/OTAHooks.cpp index 5bdeede16a25e7..a00ae428a0f40d 100644 --- a/src/platform/nxp/k32w/k32w0/OTAHooks.cpp +++ b/src/platform/nxp/k32w/k32w0/OTAHooks.cpp @@ -21,8 +21,6 @@ #include -#include - #include #include #if CONFIG_CHIP_K32W0_OTA_FACTORY_DATA_PROCESSOR diff --git a/src/platform/nxp/k32w/k32w0/ThreadStackManagerImpl.cpp b/src/platform/nxp/k32w/k32w0/ThreadStackManagerImpl.cpp index c74c2a9af4d907..0435d168a99305 100644 --- a/src/platform/nxp/k32w/k32w0/ThreadStackManagerImpl.cpp +++ b/src/platform/nxp/k32w/k32w0/ThreadStackManagerImpl.cpp @@ -72,8 +72,10 @@ void ThreadStackManagerImpl::ProcessThreadActivity() * by doing this, we avoid allocating a new stack for short-lived * BLE processing (e.g.: only during Matter commissioning) */ +#if CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE auto * bleManager = &chip::DeviceLayer::Internal::BLEMgrImpl(); bleManager->DoBleProcessing(); +#endif #if defined(chip_with_low_power) && (chip_with_low_power == 1) if (isThreadInitialized()) diff --git a/src/platform/nxp/k32w/k32w0/args.gni b/src/platform/nxp/k32w/k32w0/args.gni index 5076b2e3221c74..59a41ae6931585 100644 --- a/src/platform/nxp/k32w/k32w0/args.gni +++ b/src/platform/nxp/k32w/k32w0/args.gni @@ -13,30 +13,18 @@ # limitations under the License. import("//build_overrides/chip.gni") -import("//build_overrides/nxp_sdk.gni") +import("//build_overrides/k32w0_sdk.gni") import("//build_overrides/openthread.gni") -nxp_platform = "k32w/k32w0" -nxp_sdk_name = "k32w0_sdk" -nxp_device_layer = "nxp/${nxp_platform}" -nxp_use_lwip = false -nxp_use_mbedtls_port = false -k32w0_sdk_root="${chip_root}/third_party/nxp/k32w0_sdk/repo/core" +chip_device_platform = "k32w0" -# ARM architecture flags will be set based on NXP board. -arm_platform_config = "${nxp_sdk_build_root}/${nxp_sdk_name}/nxp_arm.gni" +if (getenv("NXP_K32W0_SDK_ROOT") == "") { + k32w0_sdk_root = "${chip_root}/third_party/nxp/k32w0_sdk/repo/core" +} else { + k32w0_sdk_root = getenv("NXP_K32W0_SDK_ROOT") +} -chip_device_platform = "nxp" - -chip_device_project_config_include = "" -chip_project_config_include = "" -chip_inet_project_config_include = "" -chip_system_project_config_include = "" -chip_ble_project_config_include = "" -chip_project_config_include_dirs = ["${chip_root}/examples/platform/${nxp_platform}/app/project_include"] - -chip_enable_openthread = true -chip_openthread_ftd = false +lwip_platform = "k32w0" chip_inet_config_enable_ipv4 = false @@ -59,7 +47,7 @@ chip_mdns = "platform" chip_system_config_use_open_thread_inet_endpoints = true chip_with_lwip = false -mbedtls_target = "${nxp_sdk_build_root}/${nxp_sdk_name}:mbedtls" +mbedtls_target = "${chip_root}/third_party/nxp/k32w0_sdk:mbedtls" openthread_external_mbedtls = mbedtls_target openthread_project_core_config_file = "OpenThreadConfig.h" diff --git a/src/platform/nxp/k32w/k32w1/BLEManagerImpl.cpp b/src/platform/nxp/k32w/k32w1/BLEManagerImpl.cpp index 0766ce91e2af1a..88d5c00400193c 100644 --- a/src/platform/nxp/k32w/k32w1/BLEManagerImpl.cpp +++ b/src/platform/nxp/k32w/k32w1/BLEManagerImpl.cpp @@ -68,7 +68,7 @@ CHIP_ERROR BLEManagerImpl::InitHostController(BLECallbackDelegate::GapGenericCal /* BLE Host Stack Init */ VerifyOrExit(Ble_HostInitialize(cb_fp, Hcit_SendPacket) == gBleSuccess_c, err = CHIP_ERROR_INCORRECT_STATE); - /* configure tx power to use in NBU specfic to BLE */ + /* configure tx power to use in NBU specific to BLE */ Controller_SetTxPowerLevelDbm(mAdvertisingDefaultTxPower_c, gAdvTxChannel_c); Controller_SetTxPowerLevelDbm(mConnectionDefaultTxPower_c, gConnTxChannel_c); Controller_ConfigureInvalidPduHandling(gLlInvalidPduHandlingType_c); diff --git a/src/platform/nxp/k32w/k32w1/BUILD.gn b/src/platform/nxp/k32w/k32w1/BUILD.gn index ad1673bf9603bd..bb3e74dc034527 100644 --- a/src/platform/nxp/k32w/k32w1/BUILD.gn +++ b/src/platform/nxp/k32w/k32w1/BUILD.gn @@ -30,8 +30,6 @@ if (chip_crypto == "platform") { } static_library("nxp_platform") { - defines = [ "CHIP_DEVICE_K32W1=1" ] - sources = [ "../../../SingletonConfigurationManager.cpp", "../common/BLEManagerCommon.cpp", @@ -67,8 +65,8 @@ static_library("nxp_platform") { "${chip_root}/src/credentials/examples/ExampleDACs.h", "${chip_root}/src/credentials/examples/ExamplePAI.h", "${chip_root}/src/platform/nxp/k32w/k32w1/BLEManagerImpl.h", - "${chip_root}/src/platform/nxp/k32w/k32w1/DefaultTestEventTriggerDelegate.h", - "${chip_root}/src/platform/nxp/k32w/k32w1/SMU2Manager.h" + "${chip_root}/src/platform/nxp/k32w/k32w1/BLEManagerImpl.h", + "${chip_root}/src/platform/nxp/k32w/k32w1/SMU2Manager.h", ] public_deps = [ "${chip_root}/src/platform:platform_base" ] diff --git a/src/platform/nxp/k32w/k32w1/DiagnosticDataProviderImpl.cpp b/src/platform/nxp/k32w/k32w1/DiagnosticDataProviderImpl.cpp index 3a3412eb031d36..212d0b5ea39fa6 100644 --- a/src/platform/nxp/k32w/k32w1/DiagnosticDataProviderImpl.cpp +++ b/src/platform/nxp/k32w/k32w1/DiagnosticDataProviderImpl.cpp @@ -99,7 +99,8 @@ CHIP_ERROR DiagnosticDataProviderImpl::GetThreadMetrics(ThreadMetrics ** threadM { ThreadMetrics * thread = (ThreadMetrics *) pvPortMalloc(sizeof(ThreadMetrics)); - Platform::CopyString(thread->NameBuf, taskStatusArray[x].pcTaskName); + strncpy(thread->NameBuf, taskStatusArray[x].pcTaskName, kMaxThreadNameLength - 1); + thread->NameBuf[kMaxThreadNameLength] = '\0'; thread->name.Emplace(CharSpan::fromCharString(thread->NameBuf)); thread->id = taskStatusArray[x].xTaskNumber; diff --git a/src/platform/nxp/k32w/k32w1/FactoryDataProviderImpl.cpp b/src/platform/nxp/k32w/k32w1/FactoryDataProviderImpl.cpp index 06741ef770dcc4..10ae6d0dd4ab05 100644 --- a/src/platform/nxp/k32w/k32w1/FactoryDataProviderImpl.cpp +++ b/src/platform/nxp/k32w/k32w1/FactoryDataProviderImpl.cpp @@ -36,11 +36,18 @@ FactoryDataProviderImpl::~FactoryDataProviderImpl() CHIP_ERROR FactoryDataProviderImpl::Init() { CHIP_ERROR error = CHIP_NO_ERROR; + uint32_t sum = 0; #if CHIP_DEVICE_CONFIG_ENABLE_SSS_API_TEST SSS_RunApiTest(); #endif + if (sum > kFactoryDataSize) + { + ChipLogError(DeviceLayer, "Max size of factory data: %lu is bigger than reserved factory data size: %lu", sum, + kFactoryDataSize); + } + error = Validate(); if (error != CHIP_NO_ERROR) { diff --git a/src/platform/nxp/k32w/k32w1/GroupKeyStoreImpl.cpp b/src/platform/nxp/k32w/k32w1/GroupKeyStoreImpl.cpp deleted file mode 100644 index bfe6ff23d05758..00000000000000 --- a/src/platform/nxp/k32w/k32w1/GroupKeyStoreImpl.cpp +++ /dev/null @@ -1,384 +0,0 @@ -/* - * - * Copyright (c) 2020 Project CHIP Authors - * Copyright (c) 2020 Nest Labs, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @file - * Provides an implementation of the Chip GroupKeyStore interface - * for platforms based on the NXP SDK. - */ -/* this file behaves like a config.h, comes first */ -#include - -#include - -using namespace ::chip; -using namespace ::chip::Profiles::Security::AppKeys; - -namespace chip { -namespace DeviceLayer { -namespace Internal { - -CHIP_ERROR GroupKeyStoreImpl::RetrieveGroupKey(uint32_t keyId, ChipGroupKey & key) -{ - CHIP_ERROR err; - - // Iterate over all the GroupKey PDM records looking for a matching key... - err = ForEachRecord(kConfigKey_GroupKeyBase, kConfigKey_GroupKeyMax, false, - [keyId, &key](const Key & nvmIdKey, const size_t & length) -> CHIP_ERROR { - CHIP_ERROR err2; - size_t keyLen; - uint8_t buf[kMaxEncodedKeySize]; // (buf length == 45 bytes) - uint32_t curKeyId; - - // Read the PDM obj binary data data into the buffer. - err2 = ReadConfigValueBin(nvmIdKey, buf, sizeof(buf), keyLen); - - // Decode the CHIP key id for the current key. - err2 = DecodeGroupKeyId(buf, keyLen, curKeyId); - SuccessOrExit(err2); - - // If it matches the key we're looking for... - if (curKeyId == keyId) - { - // Decode the associated key data. - err2 = DecodeGroupKey(buf, keyLen, key); - SuccessOrExit(err2); - - // End the iteration by returning a CHIP_END_OF_INPUT result. - ExitNow(err2 = CHIP_END_OF_INPUT); - } - - exit: - return err2; - }); - - // Modify error code for return. - switch (err) - { - case CHIP_END_OF_INPUT: - err = CHIP_NO_ERROR; // Match found. - break; - case CHIP_NO_ERROR: - err = CHIP_ERROR_KEY_NOT_FOUND; // Match not found. - break; - default: - break; - } - - return err; -} - -CHIP_ERROR GroupKeyStoreImpl::StoreGroupKey(const ChipGroupKey & key) -{ - CHIP_ERROR err; - - // Delete any existing group key with the same id (this may or may not exit). - DeleteGroupKey(key.KeyId); // no error checking here. - - // Iterate over all the GroupKey PDM records looking for the first - // empty PDM key where we can store the data. (Note- use arg addNewrecord=true) - err = ForEachRecord(kConfigKey_GroupKeyBase, kConfigKey_GroupKeyMax, true, - [&key](const Key & pdmKey, const size_t & length) -> CHIP_ERROR { - CHIP_ERROR err2; - size_t keyLen; - uint8_t buf[kMaxEncodedKeySize]; // (buf length == 45 bytes) - - // Encode the key for storage in an PDM record. - err2 = EncodeGroupKey(key, buf, sizeof(buf), keyLen); - SuccessOrExit(err2); - - // Write the encoded binary data into the PDM object. - err2 = WriteConfigValueBin(pdmKey, buf, keyLen); - SuccessOrExit(err2); - - // End the iteration by returning a CHIP_END_OF_INPUT result. - ExitNow(err2 = CHIP_END_OF_INPUT); - - exit: - return err2; - }); - - // Modify error code for return. - switch (err) - { - case CHIP_END_OF_INPUT: - err = CHIP_NO_ERROR; // Key entry was stored. - break; - case CHIP_NO_ERROR: - err = CHIP_ERROR_KEY_NOT_FOUND; // Key entry was not stored. - break; - default: - break; - } - - if (err == CHIP_NO_ERROR) - { -#if CHIP_PROGRESS_LOGGING - { - char extraKeyInfo[32]; - if (ChipKeyId::IsAppEpochKey(key.KeyId)) - { - snprintf(extraKeyInfo, sizeof(extraKeyInfo), ", start time %" PRId32, key.StartTime); - } - else if (ChipKeyId::IsAppGroupMasterKey(key.KeyId)) - { - snprintf(extraKeyInfo, sizeof(extraKeyInfo), ", global id 0x%08" PRIX32, key.GlobalId); - } - else - { - extraKeyInfo[0] = 0; - } - -#if CHIP_CONFIG_SECURITY_TEST_MODE - ChipLogProgress(SecurityManager, - "GroupKeyStore: storing key 0x%08" PRIX32 " (%s), len %" PRId8 ", data 0x%02" PRIX8 "...%s", key.KeyId, - ChipKeyId::DescribeKey(key.KeyId), key.KeyLen, key.Key[0], extraKeyInfo); -#else - ChipLogProgress(SecurityManager, "GroupKeyStore: storing key 0x%08" PRIX32 " (%s), len %" PRId8 "%s", key.KeyId, - ChipKeyId::DescribeKey(key.KeyId), key.KeyLen, extraKeyInfo); -#endif - } - } - - return err; -} - -CHIP_ERROR GroupKeyStoreImpl::DeleteGroupKey(uint32_t keyId) -{ - CHIP_ERROR err; - - // Iterate over all the GroupKey PDM records looking for a matching key... - err = ForEachRecord(kConfigKey_GroupKeyBase, kConfigKey_GroupKeyMax, false, - [keyId](const Key & pdmKey, const size_t & length) -> CHIP_ERROR { - CHIP_ERROR err2; - size_t keyLen; - uint8_t buf[kMaxEncodedKeySize]; // (buf length == 45 bytes) - uint32_t curKeyId; - - // Read the PDM obj binary data data into the buffer. - err2 = ReadConfigValueBin(pdmKey, buf, sizeof(buf), keyLen); - SuccessOrExit(err2); - - // Decode the Chip key id for the current group key. - err2 = DecodeGroupKeyId(buf, keyLen, curKeyId); - SuccessOrExit(err2); - - // If it matches the key we are looking for, delete the PDM record. - if (curKeyId == keyId) - { - err2 = ClearConfigValue(pdmKey); - ChipLogProgress(DeviceLayer, "GroupKeyStore: deleting key 0x%08" PRIX32, curKeyId); - - // End the iteration by returning a CHIP_END_OF_INPUT result. - ExitNow(err2 = CHIP_END_OF_INPUT); - } - - exit: - return err2; - }); - - // Modify error code for return. - switch (err) - { - case CHIP_END_OF_INPUT: - err = CHIP_NO_ERROR; // Key entry was deleted. - break; - case CHIP_NO_ERROR: - err = CHIP_ERROR_KEY_NOT_FOUND; // Key entry was not deleted. - break; - default: - break; - } - - return err; -} - -CHIP_ERROR GroupKeyStoreImpl::DeleteGroupKeysOfAType(uint32_t keyType) -{ - CHIP_ERROR err; - - // Iterate over all the GroupKey PDM records looking for a matching key... - err = ForEachRecord(kConfigKey_GroupKeyBase, kConfigKey_GroupKeyMax, false, - [keyType](const Key & pdmKey, const size_t & length) -> CHIP_ERROR { - CHIP_ERROR err2; - size_t keyLen; - uint8_t buf[kMaxEncodedKeySize]; // (buf length == 45 bytes) - uint32_t curKeyId; - - // Read the PDM obj binary data data into the buffer. - err2 = ReadConfigValueBin(pdmKey, buf, sizeof(buf), keyLen); - SuccessOrExit(err2); - - // Decode the CHIP key id for the current group key. - err2 = DecodeGroupKeyId(buf, keyLen, curKeyId); - SuccessOrExit(err2); - - // If the current key matches the type we are looking for, delete the PDM record. - if (ChipKeyId::GetType(curKeyId) == keyType) - { - err2 = ClearConfigValue(pdmKey); - ChipLogProgress(DeviceLayer, "GroupKeyStore: deleting key 0x%08" PRIX32, curKeyId); - } - - exit: - return err2; - }); - - return err; -} - -CHIP_ERROR GroupKeyStoreImpl::EnumerateGroupKeys(uint32_t keyType, uint32_t * keyIds, uint8_t keyIdsArraySize, uint8_t & keyCount) -{ - CHIP_ERROR err; - - keyCount = 0; - - // Iterate over all the GroupKey records looking for keys of the specified type... - err = ForEachRecord(kConfigKey_GroupKeyBase, kConfigKey_GroupKeyMax, false, - [keyType, keyIds, keyIdsArraySize, &keyCount](const Key & pdmKey, const size_t & length) -> CHIP_ERROR { - CHIP_ERROR err2; - size_t keyLen; - uint8_t buf[kMaxEncodedKeySize]; // (buf length == 45 bytes) - uint32_t curKeyId; - - // Read the PDM obj binary data data into the buffer. - err2 = ReadConfigValueBin(pdmKey, buf, sizeof(buf), keyLen); - SuccessOrExit(err2); - - // Decode the CHIP key id for the current group key. - err2 = DecodeGroupKeyId(buf, keyLen, curKeyId); - SuccessOrExit(err2); - - // If the current key matches the type we're looking for, add it to the keyIds array. - if ((keyType == ChipKeyId::kType_None) || (ChipKeyId::GetType(curKeyId) == keyType)) - { - keyIds[keyCount++] = curKeyId; - - // Stop iterating if there's no more room in the keyIds array. - VerifyOrExit(keyCount < keyIdsArraySize, err2 = CHIP_ERROR_BUFFER_TOO_SMALL); - } - - exit: - return err2; - }); - - // Simply return a truncated list if there are more matching keys than will fit in the array. - if (err == CHIP_ERROR_BUFFER_TOO_SMALL) - { - err = CHIP_NO_ERROR; - } - - return err; -} - -CHIP_ERROR GroupKeyStoreImpl::Clear(void) -{ - CHIP_ERROR err; - - // Iterate over all the GroupKey PDM records deleting each one... - err = ForEachRecord(kConfigKey_GroupKeyBase, kConfigKey_GroupKeyMax, false, - [](const Key & pdmKey, const size_t & length) -> CHIP_ERROR { - CHIP_ERROR err2; - - err2 = ClearConfigValue(pdmKey); - SuccessOrExit(err2); - - exit: - return err2; - }); - - return err; -} - -CHIP_ERROR GroupKeyStoreImpl::RetrieveLastUsedEpochKeyId(void) -{ - CHIP_ERROR err; - - err = ReadConfigValue(kConfigKey_LastUsedEpochKeyId, LastUsedEpochKeyId); - if (err == CHIP_DEVICE_ERROR_CONFIG_NOT_FOUND) - { - LastUsedEpochKeyId = ChipKeyId::kNone; - err = CHIP_NO_ERROR; - } - return err; -} - -CHIP_ERROR GroupKeyStoreImpl::StoreLastUsedEpochKeyId(void) -{ - return WriteConfigValue(kConfigKey_LastUsedEpochKeyId, LastUsedEpochKeyId); -} - -CHIP_ERROR GroupKeyStoreImpl::Init() -{ - // Nothing to do - return CHIP_NO_ERROR; -} - -CHIP_ERROR GroupKeyStoreImpl::EncodeGroupKey(const ChipGroupKey & key, uint8_t * buf, size_t bufSize, size_t & encodedKeyLen) -{ - CHIP_ERROR err = CHIP_NO_ERROR; - uint8_t * p = buf; - - VerifyOrExit(bufSize >= kFixedEncodedKeySize + key.KeyLen, err = CHIP_ERROR_BUFFER_TOO_SMALL); - - Encoding::LittleEndian::Write32(p, key.KeyId); - Encoding::LittleEndian::Write32(p, key.StartTime); - Encoding::Write8(p, key.KeyLen); - memcpy(p, key.Key, key.KeyLen); - p += key.KeyLen; - - encodedKeyLen = p - buf; - -exit: - return err; -} - -CHIP_ERROR GroupKeyStoreImpl::DecodeGroupKeyId(const uint8_t * encodedKey, size_t encodedKeyLen, uint32_t & keyId) -{ - CHIP_ERROR err = CHIP_NO_ERROR; - - VerifyOrExit(encodedKeyLen >= kFixedEncodedKeySize, err = CHIP_ERROR_INVALID_ARGUMENT); - - keyId = Encoding::LittleEndian::Get32(encodedKey); - -exit: - return err; -} - -CHIP_ERROR GroupKeyStoreImpl::DecodeGroupKey(const uint8_t * encodedKey, size_t encodedKeyLen, ChipGroupKey & key) -{ - CHIP_ERROR err = CHIP_NO_ERROR; - const uint8_t * p = encodedKey; - - VerifyOrExit(encodedKeyLen >= kFixedEncodedKeySize, err = CHIP_ERROR_INVALID_ARGUMENT); - - key.KeyId = Encoding::LittleEndian::Read32(p); - key.StartTime = Encoding::LittleEndian::Read32(p); - key.KeyLen = Encoding::Read8(p); - - VerifyOrExit(encodedKeyLen >= kFixedEncodedKeySize + key.KeyLen, err = CHIP_ERROR_INVALID_ARGUMENT); - - memcpy(key.Key, p, key.KeyLen); - -exit: - return err; -} - -} // namespace Internal -} // namespace DeviceLayer -} // namespace chip diff --git a/src/platform/nxp/k32w/k32w1/GroupKeyStoreImpl.h b/src/platform/nxp/k32w/k32w1/GroupKeyStoreImpl.h deleted file mode 100644 index b4ab4c9776625f..00000000000000 --- a/src/platform/nxp/k32w/k32w1/GroupKeyStoreImpl.h +++ /dev/null @@ -1,90 +0,0 @@ -/* - * - * Copyright (c) 2020 Project CHIP Authors - * Copyright (c) 2020 Nest Labs, Inc. - * All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @file - * Provides an implementation of the Chip Group Key Store interface - * for platforms based on the NXP SDK. - */ - -#include -#include -#include - -namespace chip { -namespace DeviceLayer { -namespace Internal { - -class ChipGroupKey -{ -public: - enum - { - MaxKeySize = 36 - }; - uint32_t KeyId; /**< The key ID. */ - uint8_t KeyLen; /**< The key length. */ - uint8_t Key[MaxKeySize]; /**< The secret key material. */ - union - { - uint32_t StartTime; /**< The epoch key start time. */ - uint32_t GlobalId; /**< The application group key global ID. */ - }; -}; - -/** - * An implementation of the Chip GroupKeyStoreBase API for platforms based - * on the NXP SDK. - */ -class GroupKeyStoreImpl final : public ::chip::Profiles::Security::AppKeys::GroupKeyStoreBase, private K32WConfig -{ - using ChipGroupKey = ::chip::Profiles::Security::AppKeys::ChipGroupKey; - -public: - CHIP_ERROR Init(); - - CHIP_ERROR RetrieveGroupKey(uint32_t keyId, ChipGroupKey & key) override; - CHIP_ERROR StoreGroupKey(const ChipGroupKey & key) override; - CHIP_ERROR DeleteGroupKey(uint32_t keyId) override; - CHIP_ERROR DeleteGroupKeysOfAType(uint32_t keyType) override; - CHIP_ERROR EnumerateGroupKeys(uint32_t keyType, uint32_t * keyIds, uint8_t keyIdsArraySize, uint8_t & keyCount) override; - CHIP_ERROR Clear(void) override; - CHIP_ERROR RetrieveLastUsedEpochKeyId(void) override; - CHIP_ERROR StoreLastUsedEpochKeyId(void) override; - -private: - static constexpr size_t kFixedEncodedKeySize = 4U + // key id - 4U + // start time / global id - 1U; // key data length - - static constexpr size_t kMaxEncodedKeySize = kFixedEncodedKeySize + ChipGroupKey::MaxKeySize; - - /* Not used - static constexpr uint16_t kGroupKeyFileId = GetFileId(kConfigKey_GroupKey); - static constexpr uint16_t kGroupKeyRecordKey = GetRecordKey(kConfigKey_GroupKey); - */ - - static CHIP_ERROR EncodeGroupKey(const ChipGroupKey & key, uint8_t * buf, size_t bufSize, size_t & encodedKeyLen); - static CHIP_ERROR DecodeGroupKey(const uint8_t * encodedKey, size_t encodedKeyLen, ChipGroupKey & key); - static CHIP_ERROR DecodeGroupKeyId(const uint8_t * encodedKey, size_t encodedKeyLen, uint32_t & keyId); -}; - -} // namespace Internal -} // namespace DeviceLayer -} // namespace chip diff --git a/src/platform/nxp/k32w/k32w1/K32W1Config.cpp b/src/platform/nxp/k32w/k32w1/K32W1Config.cpp index 2019fce5811eba..489d6363d8f4e9 100644 --- a/src/platform/nxp/k32w/k32w1/K32W1Config.cpp +++ b/src/platform/nxp/k32w/k32w1/K32W1Config.cpp @@ -35,6 +35,10 @@ #include #endif +#if (defined(K32W_LOG_ENABLED) && (K32W_LOG_ENABLED > 0)) +// #include "fsl_component_log.h" +// #include "fsl_component_log_backend_debugconsole.h" +#endif #include "FreeRTOS.h" #include "FunctionLib.h" #include "NVM_Interface.h" diff --git a/src/platform/nxp/k32w/k32w1/OTAFirmwareProcessor.h b/src/platform/nxp/k32w/k32w1/OTAFirmwareProcessor.h index 8e2c794596ce5e..c06a2342ba08d6 100644 --- a/src/platform/nxp/k32w/k32w1/OTAFirmwareProcessor.h +++ b/src/platform/nxp/k32w/k32w1/OTAFirmwareProcessor.h @@ -1,6 +1,7 @@ /* * * Copyright (c) 2023 Project CHIP Authors + * All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/platform/nxp/k32w/k32w1/ram_storage.h b/src/platform/nxp/k32w/k32w1/ram_storage.h index b356542c30e649..77cdca10b4f7f1 100644 --- a/src/platform/nxp/k32w/k32w1/ram_storage.h +++ b/src/platform/nxp/k32w/k32w1/ram_storage.h @@ -92,7 +92,7 @@ rsError ramStorageSet(ramBufferDescriptor * pBuffer, uint16_t aKey, const uint8_ rsError ramStorageAdd(ramBufferDescriptor * pBuffer, uint16_t aKey, const uint8_t * aValue, uint16_t aValueLength); /* search RAM Buffer for aKey (with aIndex) and delete it: - * - if aIndex is -1 then all the occurences of aKey are deleted + * - if aIndex is -1 then all the occurrences of aKey are deleted */ rsError ramStorageDelete(ramBufferDescriptor * pBuffer, uint16_t aKey, int aIndex); diff --git a/src/system/BUILD.gn b/src/system/BUILD.gn index 7182f7d3025c08..7fcd80f38d2abb 100644 --- a/src/system/BUILD.gn +++ b/src/system/BUILD.gn @@ -58,6 +58,8 @@ if (chip_device_platform == "cc13x2_26x2") { } else if (chip_device_platform == "qpg") { import("//build_overrides/qpg_sdk.gni") import("${qpg_sdk_build_root}/qpg_sdk.gni") +} else if (chip_device_platform == "k32w0") { + import("//build_overrides/k32w0_sdk.gni") } else if (chip_device_platform == "nxp") { import("//build_overrides/nxp_sdk.gni") } else if (chip_device_platform == "psoc6") { @@ -183,6 +185,9 @@ source_set("system_config_header") { if (chip_device_platform == "qpg") { public_deps += [ "${qpg_sdk_build_root}:qpg_sdk" ] } + if (chip_device_platform == "k32w0") { + public_deps += [ "${k32w0_sdk_build_root}:k32w0_sdk" ] + } if (chip_device_platform == "nxp") { public_deps += [ "${nxp_sdk_build_root}:nxp_sdk" ] } diff --git a/third_party/nxp/k32w0_sdk/BUILD.gn b/third_party/nxp/k32w0_sdk/BUILD.gn index 3541648787f4d5..efc1d786420239 100644 --- a/third_party/nxp/k32w0_sdk/BUILD.gn +++ b/third_party/nxp/k32w0_sdk/BUILD.gn @@ -13,12 +13,10 @@ # limitations under the License. import("//build_overrides/chip.gni") -import("//build_overrides/nxp_sdk.gni") +import("//build_overrides/k32w0_sdk.gni") import("//build_overrides/mbedtls.gni") -import("//build_overrides/chip.gni") -import("${nxp_sdk_build_root}/nxp_sdk.gni") -import("${nxp_sdk_build_root}/${nxp_sdk_name}/${nxp_sdk_name}.gni") +import("${k32w0_sdk_build_root}/k32w0_sdk.gni") import("${mbedtls_root}/mbedtls.gni") declare_args() { @@ -28,7 +26,7 @@ declare_args() { assert(k32w0_sdk_target != "", "k32w0_sdk_target must be specified") -group("nxp_sdk") { +group("k32w0_sdk") { public_deps = [ k32w0_sdk_target ] } @@ -97,7 +95,7 @@ mbedtls_target("mbedtls") { public_configs = [ ":mbedtls_k32w0_config" ] public_deps = [ - ":nxp_sdk", + ":k32w0_sdk", "${chip_root}/third_party/openthread/platforms/nxp/k32w/k32w0:openthread_mbedtls_config_k32w0", ] } diff --git a/third_party/nxp/k32w0_sdk/nxp_executable.gni b/third_party/nxp/k32w0_sdk/k32w0_executable.gni similarity index 100% rename from third_party/nxp/k32w0_sdk/nxp_executable.gni rename to third_party/nxp/k32w0_sdk/k32w0_executable.gni diff --git a/third_party/nxp/k32w0_sdk/k32w0_sdk.gni b/third_party/nxp/k32w0_sdk/k32w0_sdk.gni old mode 100755 new mode 100644 index 0f4c6d754277b6..754ac91df80875 --- a/third_party/nxp/k32w0_sdk/k32w0_sdk.gni +++ b/third_party/nxp/k32w0_sdk/k32w0_sdk.gni @@ -14,15 +14,14 @@ import("//build_overrides/build.gni") import("//build_overrides/chip.gni") -import("//build_overrides/nxp_sdk.gni") +import("//build_overrides/k32w0_sdk.gni") import("//build_overrides/mbedtls.gni") import("//build_overrides/openthread.gni") import("${build_root}/config/compiler/compiler.gni") import("${chip_root}/src/crypto/crypto.gni") -import("${chip_root}/src/platform/device.gni") import("${chip_root}/src/lib/core/core.gni") -import("${chip_root}/src/platform/nxp/${nxp_platform}/args.gni") +import("${chip_root}/src/platform/nxp/k32w/k32w0/args.gni") declare_args() { # Location of the k32w0 SDK. @@ -39,6 +38,7 @@ declare_args() { board = "k32w061dk6" chip_with_ntag = 1 chip_with_high_power = 0 + chip_with_factory_data = 0 use_fro_32k = 0 use_custom_factory_provider = 0 chip_crypto_flavor = "NXP-Ultrafast-P256" @@ -52,6 +52,15 @@ declare_args() { chip_with_ota_encryption = 0 chip_with_ota_key = "1234567890ABCDEFA1B2C3D4E5F6F1B4" chip_with_sdk_package = 1 + + # ICD Matter Configuration flags + nxp_ot_idle_interval_ms = 2000 # 2s Idle Intervals + nxp_ot_active_interval_ms = 500 # 500ms Active Intervals + + nxp_idle_mode_duration_s = 600 # 10min Idle Mode Interval + nxp_active_mode_duration_ms = 10000 # 10s Active Mode Interval + nxp_active_mode_threshold_ms = 1000 # 1s Active Mode Threshold + nxp_icd_supported_clients_per_fabric = 2 # 2 registration slots per fabric } assert(k32w0_sdk_root != "", "k32w0_sdk_root must be specified") @@ -86,16 +95,8 @@ template("k32w0_sdk") { "Please disable low power if expansion board, openthread CLI or SE is needed!") assert( - use_custom_factory_provider == 0 || chip_with_factory_data == 1, - "Please set chip_with_factory_data=1 if using custom factory provider.") - - assert( - chip_enable_ota_factory_data_processor == 0 || chip_enable_ota_firmware_processor == 1, - "Please set chip_enable_ota_firmware_processor=1 if using default factory data processor.") - - assert( - chip_enable_ota_factory_data_processor == 0 || chip_with_factory_data == 1, - "Please set chip_with_factory_data=1 if using default factory data processor.") + use_custom_factory_provider == 0 || chip_with_factory_data == 1, + "Please set chip_with_factory_data=1 if using custom factory provider.") assert( chip_enable_ota_factory_data_processor == 0 || @@ -145,7 +146,8 @@ template("k32w0_sdk") { chip_with_ntag = 0 } - if(k32w0_sdk_root == "${chip_root}/third_party/nxp/k32w0_sdk/repo/core") { + if (k32w0_sdk_root == "${chip_root}/third_party/nxp/k32w0_sdk/repo/core" || + k32w0_sdk_root == "/opt/sdk/core") { chip_with_sdk_package = 0 } else { chip_with_sdk_package = 1 @@ -160,7 +162,6 @@ template("k32w0_sdk") { print("OTA default factory data processor: ", chip_enable_ota_factory_data_processor) print("PDM Encryption: ", chip_with_pdm_encryption) - print("Antenna Diversity enabled: ", use_antenna_diversity) if (chip_with_low_power == 1 && chip_logging == true) { print( @@ -374,13 +375,6 @@ template("k32w0_sdk") { "NXP_ICD_SUPPORTED_CLIENTS_PER_FABRIC=${nxp_icd_supported_clients_per_fabric}", ] - if (use_antenna_diversity == 1){ - print("Check ADO/ADE pin configuration when using Antenna Diversity.") - defines += [ - "ANTENNA_DIVERSITY_ENABLE", - ] - } - # If OTA default processors are enabled, then OTA custom entry structure # will be saved in external flash: gOTACustomOtaEntryMemory=OTACustomStorage_ExtFlash (1) if (chip_enable_ota_firmware_processor == 1) { @@ -419,12 +413,6 @@ template("k32w0_sdk") { defines += [ "PDM_ENCRYPTION=0" ] } - if (chip_with_pdm_encryption == 1) { - defines += [ "PDM_ENCRYPTION=1" ] - } else { - defines += [ "PDM_ENCRYPTION=0" ] - } - if (chip_with_ota_encryption == 1) { defines += [ "OTA_ENCRYPTION_ENABLE=1", @@ -669,27 +657,27 @@ template("k32w0_sdk") { ] } else { sources += [ - "${k32w0_sdk_root}/drivers/lpc_adc/fsl_adc.c", - "${k32w0_sdk_root}/drivers/aes/fsl_aes.c", "${k32w0_sdk_root}/devices/K32W061/drivers/fsl_clock.c", + "${k32w0_sdk_root}/devices/K32W061/drivers/fsl_power.c", + "${k32w0_sdk_root}/devices/K32W061/drivers/fsl_reset.c", + "${k32w0_sdk_root}/devices/K32W061/drivers/fsl_wtimer.c", + "${k32w0_sdk_root}/drivers/aes/fsl_aes.c", "${k32w0_sdk_root}/drivers/common/fsl_common.c", "${k32w0_sdk_root}/drivers/ctimer/fsl_ctimer.c", - "${k32w0_sdk_root}/drivers/jn_flash/fsl_flash.c", "${k32w0_sdk_root}/drivers/flexcomm/fsl_flexcomm.c", - "${k32w0_sdk_root}/drivers/fmeas/fsl_fmeas.c", - "${k32w0_sdk_root}/drivers/lpc_gpio/fsl_gpio.c", "${k32w0_sdk_root}/drivers/flexcomm/fsl_i2c.c", "${k32w0_sdk_root}/drivers/flexcomm/fsl_i2c_freertos.c", + "${k32w0_sdk_root}/drivers/flexcomm/fsl_usart.c", + "${k32w0_sdk_root}/drivers/fmeas/fsl_fmeas.c", "${k32w0_sdk_root}/drivers/inputmux/fsl_inputmux.c", - "${k32w0_sdk_root}/drivers/pint/fsl_pint.c", - "${k32w0_sdk_root}/devices/K32W061/drivers/fsl_power.c", - "${k32w0_sdk_root}/devices/K32W061/drivers/fsl_reset.c", + "${k32w0_sdk_root}/drivers/jn_flash/fsl_flash.c", "${k32w0_sdk_root}/drivers/jn_rng/fsl_rng.c", "${k32w0_sdk_root}/drivers/jn_rtc/fsl_rtc.c", + "${k32w0_sdk_root}/drivers/lpc_adc/fsl_adc.c", + "${k32w0_sdk_root}/drivers/lpc_gpio/fsl_gpio.c", + "${k32w0_sdk_root}/drivers/pint/fsl_pint.c", "${k32w0_sdk_root}/drivers/sha/fsl_sha.c", "${k32w0_sdk_root}/drivers/spifi/fsl_spifi.c", - "${k32w0_sdk_root}/drivers/flexcomm/fsl_usart.c", - "${k32w0_sdk_root}/devices/K32W061/drivers/fsl_wtimer.c", "${k32w0_sdk_root}/utilities/debug_console/fsl_debug_console.c", "${k32w0_sdk_root}/utilities/debug_console/str/fsl_str.c", ] diff --git a/third_party/nxp/k32w1_sdk/k32w1_sdk.gni b/third_party/nxp/k32w1_sdk/k32w1_sdk.gni index 753fb15a7af5e4..d6d9f6146086d7 100644 --- a/third_party/nxp/k32w1_sdk/k32w1_sdk.gni +++ b/third_party/nxp/k32w1_sdk/k32w1_sdk.gni @@ -36,7 +36,6 @@ declare_args() { use_smu2_dynamic = false use_hw_sha256 = false use_hw_aes = false - chip_config_dimmable_led = false } openthread_nxp_root = "${chip_root}/third_party/openthread/ot-nxp" @@ -158,12 +157,6 @@ template("k32w1_sdk") { "${chip_root}/src/platform/nxp/k32w/k32w1", ] - if (chip_config_dimmable_led) { - _sdk_include_dirs += [ - "${k32w1_sdk_root}/components/pwm", - ] - } - if (sdk_release == 1) { _sdk_include_dirs += [ "${k32w1_sdk_root}/middleware/wireless/bluetooth/application/common/matter", @@ -405,172 +398,155 @@ template("k32w1_sdk") { if (sdk_release == 1) { sources += [ - "${k32w1_sdk_root}/middleware/wireless/bluetooth/application/common/matter/ble_init.c", - "${k32w1_sdk_root}/devices/K32W1480/drivers/fsl_k4_flash.c", - "${k32w1_sdk_root}/devices/K32W1480/drivers/fsl_k4_controller.c", + "${k32w1_sdk_root}/devices/K32W1480/drivers/fsl_ccm32k.c", "${k32w1_sdk_root}/devices/K32W1480/drivers/fsl_clock.c", + "${k32w1_sdk_root}/devices/K32W1480/drivers/fsl_cmc.c", + "${k32w1_sdk_root}/devices/K32W1480/drivers/fsl_crc.c", + "${k32w1_sdk_root}/devices/K32W1480/drivers/fsl_elemu.c", "${k32w1_sdk_root}/devices/K32W1480/drivers/fsl_gpio.c", + "${k32w1_sdk_root}/devices/K32W1480/drivers/fsl_imu.c", + "${k32w1_sdk_root}/devices/K32W1480/drivers/fsl_k4_controller.c", + "${k32w1_sdk_root}/devices/K32W1480/drivers/fsl_k4_flash.c", + "${k32w1_sdk_root}/devices/K32W1480/drivers/fsl_lpspi.c", + "${k32w1_sdk_root}/devices/K32W1480/drivers/fsl_lptmr.c", "${k32w1_sdk_root}/devices/K32W1480/drivers/fsl_lpuart.c", "${k32w1_sdk_root}/devices/K32W1480/drivers/fsl_ltc.c", - "${k32w1_sdk_root}/devices/K32W1480/drivers/fsl_lptmr.c", - "${k32w1_sdk_root}/devices/K32W1480/drivers/fsl_lpspi.c", - "${k32w1_sdk_root}/devices/K32W1480/drivers/fsl_elemu.c", "${k32w1_sdk_root}/devices/K32W1480/drivers/fsl_spc.c", "${k32w1_sdk_root}/devices/K32W1480/drivers/fsl_wuu.c", - "${k32w1_sdk_root}/devices/K32W1480/drivers/fsl_imu.c", - "${k32w1_sdk_root}/devices/K32W1480/drivers/fsl_crc.c", - "${k32w1_sdk_root}/devices/K32W1480/drivers/fsl_cmc.c", - "${k32w1_sdk_root}/devices/K32W1480/drivers/fsl_ccm32k.c", - "${k32w1_sdk_root}/devices/K32W1480/utilities/fsl_assert.c", "${k32w1_sdk_root}/devices/K32W1480/utilities/debug_console/fsl_debug_console.c", + "${k32w1_sdk_root}/devices/K32W1480/utilities/fsl_assert.c", "${k32w1_sdk_root}/devices/K32W1480/utilities/str/fsl_str.c", + "${k32w1_sdk_root}/middleware/wireless/bluetooth/application/common/matter/ble_init.c", ] - if (chip_config_dimmable_led) { - sources += [ - "${k32w1_sdk_root}/devices/K32W1480/drivers/fsl_tpm.c", - ] - } - if (chip_enable_pw_rpc) { sources += [ "${k32w1_sdk_root}/devices/K32W1480/drivers/fsl_edma.c", - "${k32w1_sdk_root}/devices/K32W1480/drivers/fsl_lpuart_edma.c" + "${k32w1_sdk_root}/devices/K32W1480/drivers/fsl_lpuart_edma.c", ] } } else { sources += [ - "${k32w1_sdk_root}/middleware/wireless/bluetooth/application/common/ble_init.c", - "${k32w1_sdk_root}/platform/drivers/flash_k4/fsl_k4_flash.c", - "${k32w1_sdk_root}/platform/drivers/flash_k4/fsl_k4_controller.c", - "${k32w1_sdk_root}/devices/KW45B41Z83/drivers/fsl_clock.c", - "${k32w1_sdk_root}/platform/drivers/gpio/fsl_gpio.c", - "${k32w1_sdk_root}/platform/drivers/lpuart/fsl_lpuart.c", - "${k32w1_sdk_root}/platform/drivers/ltc/fsl_ltc.c", - "${k32w1_sdk_root}/platform/drivers/lptmr/fsl_lptmr.c", - "${k32w1_sdk_root}/platform/drivers/lpspi/fsl_lpspi.c", - "${k32w1_sdk_root}/platform/drivers/elemu/fsl_elemu.c", - "${k32w1_sdk_root}/platform/drivers/spc/fsl_spc.c", - "${k32w1_sdk_root}/platform/drivers/wuu/fsl_wuu.c", - "${k32w1_sdk_root}/platform/drivers/imu/fsl_imu.c", - "${k32w1_sdk_root}/platform/drivers/crc/fsl_crc.c", - "${k32w1_sdk_root}/platform/drivers/cmc/fsl_cmc.c", - "${k32w1_sdk_root}/platform/drivers/ccm32k/fsl_ccm32k.c", - "${k32w1_sdk_root}/platform/utilities/assert/fsl_assert.c", - "${k32w1_sdk_root}/platform/utilities/debug_console/fsl_debug_console.c", - "${k32w1_sdk_root}/platform/utilities/str/fsl_str.c", + "${k32w1_sdk_root}/devices/KW45B41Z83/drivers/fsl_clock.c", + "${k32w1_sdk_root}/middleware/wireless/bluetooth/application/common/ble_init.c", + "${k32w1_sdk_root}/platform/drivers/ccm32k/fsl_ccm32k.c", + "${k32w1_sdk_root}/platform/drivers/cmc/fsl_cmc.c", + "${k32w1_sdk_root}/platform/drivers/crc/fsl_crc.c", + "${k32w1_sdk_root}/platform/drivers/elemu/fsl_elemu.c", + "${k32w1_sdk_root}/platform/drivers/flash_k4/fsl_k4_controller.c", + "${k32w1_sdk_root}/platform/drivers/flash_k4/fsl_k4_flash.c", + "${k32w1_sdk_root}/platform/drivers/gpio/fsl_gpio.c", + "${k32w1_sdk_root}/platform/drivers/imu/fsl_imu.c", + "${k32w1_sdk_root}/platform/drivers/lpspi/fsl_lpspi.c", + "${k32w1_sdk_root}/platform/drivers/lptmr/fsl_lptmr.c", + "${k32w1_sdk_root}/platform/drivers/lpuart/fsl_lpuart.c", + "${k32w1_sdk_root}/platform/drivers/ltc/fsl_ltc.c", + "${k32w1_sdk_root}/platform/drivers/spc/fsl_spc.c", + "${k32w1_sdk_root}/platform/drivers/wuu/fsl_wuu.c", + "${k32w1_sdk_root}/platform/utilities/assert/fsl_assert.c", + "${k32w1_sdk_root}/platform/utilities/debug_console/fsl_debug_console.c", + "${k32w1_sdk_root}/platform/utilities/str/fsl_str.c", ] if (chip_enable_pw_rpc) { sources += [ "${k32w1_sdk_root}/platform/drivers/lpuart/fsl_edma.c", - "${k32w1_sdk_root}/platform/drivers/lpuart/fsl_lpuart_edma.c" + "${k32w1_sdk_root}/platform/drivers/lpuart/fsl_lpuart_edma.c", ] } } sources += [ - "${k32w1_sdk_root}/devices/K32W1480/gcc/startup_K32W1480.S", - "${k32w1_sdk_root}/devices/K32W1480/system_K32W1480.c", - "${k32w1_sdk_root}/components/rpmsg/fsl_adapter_rpmsg.c", - "${k32w1_sdk_root}/components/osa/fsl_os_abstraction_free_rtos.c", + "${k32w1_sdk_root}/components/button/fsl_component_button.c", + "${k32w1_sdk_root}/components/flash//nor/lpspi/fsl_lpspi_mem_adapter.c", + "${k32w1_sdk_root}/components/flash//nor/lpspi/fsl_lpspi_nor_flash.c", + "${k32w1_sdk_root}/components/gpio/fsl_adapter_gpio.c", + "${k32w1_sdk_root}/components/internal_flash/fsl_adapter_k4_flash.c", + "${k32w1_sdk_root}/components/led/fsl_component_led.c", "${k32w1_sdk_root}/components/lists/fsl_component_generic_list.c", - "${k32w1_sdk_root}/components/messaging/fsl_component_messaging.c", "${k32w1_sdk_root}/components/mem_manager/fsl_component_mem_manager_light.c", + "${k32w1_sdk_root}/components/messaging/fsl_component_messaging.c", + "${k32w1_sdk_root}/components/osa/fsl_os_abstraction_free_rtos.c", "${k32w1_sdk_root}/components/panic/fsl_component_panic.c", + "${k32w1_sdk_root}/components/power_manager/boards/K32W148-EVK/fsl_pm_board.c", + "${k32w1_sdk_root}/components/power_manager/core/fsl_pm_core.c", + "${k32w1_sdk_root}/components/reset/fsl_adapter_reset.c", + "${k32w1_sdk_root}/components/rpmsg/fsl_adapter_rpmsg.c", "${k32w1_sdk_root}/components/serial_manager/fsl_component_serial_manager.c", "${k32w1_sdk_root}/components/serial_manager/fsl_component_serial_port_uart.c", - "${k32w1_sdk_root}/components/uart/fsl_adapter_lpuart.c", - "${k32w1_sdk_root}/components/gpio/fsl_adapter_gpio.c", - "${k32w1_sdk_root}/components/led/fsl_component_led.c", - "${k32w1_sdk_root}/components/button/fsl_component_button.c", - "${k32w1_sdk_root}/components/timer_manager/fsl_component_timer_manager.c", - "${k32w1_sdk_root}/components/timer/fsl_adapter_lptmr.c", "${k32w1_sdk_root}/components/time_stamp/fsl_adapter_lptmr_time_stamp.c", - "${k32w1_sdk_root}/components/internal_flash/fsl_adapter_k4_flash.c", - "${k32w1_sdk_root}/components/reset/fsl_adapter_reset.c", - "${k32w1_sdk_root}/components/flash//nor/lpspi/fsl_lpspi_nor_flash.c", - "${k32w1_sdk_root}/components/flash//nor/lpspi/fsl_lpspi_mem_adapter.c", - "${k32w1_sdk_root}/components/power_manager/boards/K32W148-EVK/fsl_pm_board.c", - "${k32w1_sdk_root}/components/power_manager/core/fsl_pm_core.c", - + "${k32w1_sdk_root}/components/timer/fsl_adapter_lptmr.c", + "${k32w1_sdk_root}/components/timer_manager/fsl_component_timer_manager.c", + "${k32w1_sdk_root}/components/uart/fsl_adapter_lpuart.c", + "${k32w1_sdk_root}/devices/K32W1480/gcc/startup_K32W1480.S", + "${k32w1_sdk_root}/devices/K32W1480/system_K32W1480.c", + "${k32w1_sdk_root}/middleware/multicore/mcmgr/src/mcmgr.c", + "${k32w1_sdk_root}/middleware/multicore/mcmgr/src/mcmgr_imu_internal.c", + "${k32w1_sdk_root}/middleware/multicore/mcmgr/src/mcmgr_internal_core_api_k32w1.c", + "${k32w1_sdk_root}/middleware/multicore/rpmsg_lite/lib/common/llist.c", + "${k32w1_sdk_root}/middleware/multicore/rpmsg_lite/lib/rpmsg_lite/porting/environment/rpmsg_env_freertos.c", + "${k32w1_sdk_root}/middleware/multicore/rpmsg_lite/lib/rpmsg_lite/porting/platform/k32w1/rpmsg_platform.c", + "${k32w1_sdk_root}/middleware/multicore/rpmsg_lite/lib/rpmsg_lite/rpmsg_lite.c", + "${k32w1_sdk_root}/middleware/multicore/rpmsg_lite/lib/virtio/virtqueue.c", + "${k32w1_sdk_root}/middleware/secure-subsystem/port/kw45_k4w1/sss_aes.c", + "${k32w1_sdk_root}/middleware/secure-subsystem/port/kw45_k4w1/sss_aes_cmac.c", + "${k32w1_sdk_root}/middleware/secure-subsystem/port/kw45_k4w1/sss_ccm.c", + "${k32w1_sdk_root}/middleware/secure-subsystem/port/kw45_k4w1/sss_ecdh.c", + "${k32w1_sdk_root}/middleware/secure-subsystem/port/kw45_k4w1/sss_hmac_sha256.c", + "${k32w1_sdk_root}/middleware/secure-subsystem/port/kw45_k4w1/sss_init.c", + "${k32w1_sdk_root}/middleware/secure-subsystem/port/kw45_k4w1/sss_sha256.c", + "${k32w1_sdk_root}/middleware/secure-subsystem/src/sscp/fsl_sscp_mu.c", + "${k32w1_sdk_root}/middleware/secure-subsystem/src/sscp/fsl_sss_mgmt.c", + "${k32w1_sdk_root}/middleware/secure-subsystem/src/sscp/fsl_sss_sscp.c", + "${k32w1_sdk_root}/middleware/wireless/ble_controller/src/controller_api.c", + "${k32w1_sdk_root}/middleware/wireless/bluetooth/application/common/ble_conn_manager.c", + "${k32w1_sdk_root}/middleware/wireless/bluetooth/application/common/gatt_db/gatt_database.c", + "${k32w1_sdk_root}/middleware/wireless/bluetooth/hci_transport/source/hcit_generic_adapter_interface.c", + "${k32w1_sdk_root}/middleware/wireless/bluetooth/host/config/ble_globals.c", + "${k32w1_sdk_root}/middleware/wireless/bluetooth/port/fwk_generic_list.c", + "${k32w1_sdk_root}/middleware/wireless/bluetooth/port/fwk_timer_manager.c", + "${k32w1_sdk_root}/middleware/wireless/framework/Common/rtos/freertos/heap_mem_manager.c", + "${k32w1_sdk_root}/middleware/wireless/framework/FunctionLib/FunctionLib.c", + "${k32w1_sdk_root}/middleware/wireless/framework/HWParameter/HWParameter.c", + "${k32w1_sdk_root}/middleware/wireless/framework/LowPower/PWR.c", + "${k32w1_sdk_root}/middleware/wireless/framework/LowPower/PWR_systicks.c", + "${k32w1_sdk_root}/middleware/wireless/framework/NVM/Source/NV_Flash.c", + "${k32w1_sdk_root}/middleware/wireless/framework/OtaSupport/Source/OtaExternalFlash.c", + "${k32w1_sdk_root}/middleware/wireless/framework/OtaSupport/Source/OtaSupport.c", + "${k32w1_sdk_root}/middleware/wireless/framework/RNG/RNG.c", + "${k32w1_sdk_root}/middleware/wireless/framework/SecLib/SecLib_sss.c", + "${k32w1_sdk_root}/middleware/wireless/framework/Sensors/sensors.c", "${k32w1_sdk_root}/middleware/wireless/framework/boards/kw45_k32w1/K32W1480/clock_config.c", "${k32w1_sdk_root}/middleware/wireless/framework/boards/kw45_k32w1/K32W1480/pin_mux.c", - "${k32w1_sdk_root}/middleware/wireless/framework/boards/kw45_k32w1/board_comp.c", - "${k32w1_sdk_root}/middleware/wireless/framework/boards/kw45_k32w1/board_lp.c", - "${k32w1_sdk_root}/middleware/wireless/framework/boards/kw45_k32w1/board.c", - "${k32w1_sdk_root}/middleware/wireless/framework/boards/kw45_k32w1/hardware_init.c", "${k32w1_sdk_root}/middleware/wireless/framework/boards/kw45_k32w1/app_services_init.c", + "${k32w1_sdk_root}/middleware/wireless/framework/boards/kw45_k32w1/board.c", + "${k32w1_sdk_root}/middleware/wireless/framework/boards/kw45_k32w1/board_comp.c", "${k32w1_sdk_root}/middleware/wireless/framework/boards/kw45_k32w1/board_dcdc.c", "${k32w1_sdk_root}/middleware/wireless/framework/boards/kw45_k32w1/board_extflash.c", - "${k32w1_sdk_root}/middleware/wireless/framework/FunctionLib/FunctionLib.c", - "${k32w1_sdk_root}/middleware/wireless/framework/HWParameter/HWParameter.c", - "${k32w1_sdk_root}/middleware/wireless/framework/Sensors/sensors.c", + "${k32w1_sdk_root}/middleware/wireless/framework/boards/kw45_k32w1/board_lp.c", + "${k32w1_sdk_root}/middleware/wireless/framework/boards/kw45_k32w1/hardware_init.c", "${k32w1_sdk_root}/middleware/wireless/framework/platform/kw45_k32w1/fwk_platform.c", + "${k32w1_sdk_root}/middleware/wireless/framework/platform/kw45_k32w1/fwk_platform_ble.c", + "${k32w1_sdk_root}/middleware/wireless/framework/platform/kw45_k32w1/fwk_platform_extflash.c", + "${k32w1_sdk_root}/middleware/wireless/framework/platform/kw45_k32w1/fwk_platform_ics.c", "${k32w1_sdk_root}/middleware/wireless/framework/platform/kw45_k32w1/fwk_platform_lowpower.c", "${k32w1_sdk_root}/middleware/wireless/framework/platform/kw45_k32w1/fwk_platform_lowpower_timer.c", - "${k32w1_sdk_root}/middleware/wireless/framework/platform/kw45_k32w1/fwk_platform_ble.c", "${k32w1_sdk_root}/middleware/wireless/framework/platform/kw45_k32w1/fwk_platform_ot.c", - "${k32w1_sdk_root}/middleware/wireless/framework/platform/kw45_k32w1/fwk_platform_ics.c", "${k32w1_sdk_root}/middleware/wireless/framework/platform/kw45_k32w1/fwk_platform_ota.c", - "${k32w1_sdk_root}/middleware/wireless/framework/platform/kw45_k32w1/fwk_platform_extflash.c", - "${k32w1_sdk_root}/middleware/wireless/framework/RNG/RNG.c", - "${k32w1_sdk_root}/middleware/wireless/framework/LowPower/PWR.c", - "${k32w1_sdk_root}/middleware/wireless/framework/LowPower/PWR_systicks.c", - "${k32w1_sdk_root}/middleware/wireless/framework/NVM/Source/NV_Flash.c", - "${k32w1_sdk_root}/middleware/wireless/framework/SecLib/SecLib_sss.c", - "${k32w1_sdk_root}/middleware/wireless/framework/OtaSupport/Source/OtaSupport.c", - "${k32w1_sdk_root}/middleware/wireless/framework/OtaSupport/Source/OtaExternalFlash.c", - - "${k32w1_sdk_root}/middleware/multicore/rpmsg_lite/lib/rpmsg_lite/rpmsg_lite.c", - "${k32w1_sdk_root}/middleware/multicore/rpmsg_lite/lib/rpmsg_lite/porting/environment/rpmsg_env_freertos.c", - "${k32w1_sdk_root}/middleware/multicore/rpmsg_lite/lib/rpmsg_lite/porting/platform/k32w1/rpmsg_platform.c", - "${k32w1_sdk_root}/middleware/multicore/rpmsg_lite/lib/common/llist.c", - "${k32w1_sdk_root}/middleware/multicore/rpmsg_lite/lib/virtio/virtqueue.c", - "${k32w1_sdk_root}/middleware/multicore/mcmgr/src/mcmgr.c", - "${k32w1_sdk_root}/middleware/multicore/mcmgr/src/mcmgr_imu_internal.c", - "${k32w1_sdk_root}/middleware/multicore/mcmgr/src/mcmgr_internal_core_api_k32w1.c", - "${k32w1_sdk_root}/middleware/wireless/ble_controller/src/controller_api.c", - "${k32w1_sdk_root}/middleware/wireless/bluetooth/port/fwk_generic_list.c", - "${k32w1_sdk_root}/middleware/wireless/bluetooth/application/common/ble_conn_manager.c", - "${k32w1_sdk_root}/middleware/wireless/bluetooth/application/common/gatt_db/gatt_database.c", - "${k32w1_sdk_root}/middleware/wireless/bluetooth/hci_transport/source/hcit_generic_adapter_interface.c", - "${k32w1_sdk_root}/middleware/wireless/bluetooth/host/config/ble_globals.c", - "${k32w1_sdk_root}/middleware/wireless/bluetooth/port/fwk_timer_manager.c", - - "${k32w1_sdk_root}/middleware/secure-subsystem/src/sscp/fsl_sscp_mu.c", - "${k32w1_sdk_root}/middleware/secure-subsystem/src/sscp/fsl_sss_mgmt.c", - "${k32w1_sdk_root}/middleware/secure-subsystem/src/sscp/fsl_sss_sscp.c", - "${k32w1_sdk_root}/middleware/secure-subsystem/port/kw45_k4w1/sss_init.c", - "${k32w1_sdk_root}/middleware/secure-subsystem/port/kw45_k4w1/sss_aes.c", - "${k32w1_sdk_root}/middleware/secure-subsystem/port/kw45_k4w1/sss_ccm.c", - "${k32w1_sdk_root}/middleware/secure-subsystem/port/kw45_k4w1/sss_sha256.c", - "${k32w1_sdk_root}/middleware/secure-subsystem/port/kw45_k4w1/sss_hmac_sha256.c", - "${k32w1_sdk_root}/middleware/secure-subsystem/port/kw45_k4w1/sss_ecdh.c", - "${k32w1_sdk_root}/middleware/secure-subsystem/port/kw45_k4w1/sss_aes_cmac.c", - + "${k32w1_sdk_root}/middleware/wireless/ieee-802.15.4/ieee_802_15_4/phy/source/PhyTime.c", "${k32w1_sdk_root}/middleware/wireless/ieee-802.15.4/ieee_802_15_4/phy/source/SerialDevice/ASP.c", "${k32w1_sdk_root}/middleware/wireless/ieee-802.15.4/ieee_802_15_4/phy/source/SerialDevice/Phy.c", - "${k32w1_sdk_root}/middleware/wireless/ieee-802.15.4/ieee_802_15_4/phy/source/PhyTime.c", - - "${k32w1_sdk_root}/rtos/freertos/freertos_kernel/portable/GCC/ARM_CM33_NTZ/non_secure/port.c", - "${k32w1_sdk_root}/rtos/freertos/freertos_kernel/portable/GCC/ARM_CM33_NTZ/non_secure/portasm.c", - "${k32w1_sdk_root}/middleware/wireless/framework/Common/rtos/freertos/heap_mem_manager.c", "${k32w1_sdk_root}/rtos/freertos/freertos_kernel/croutine.c", "${k32w1_sdk_root}/rtos/freertos/freertos_kernel/event_groups.c", "${k32w1_sdk_root}/rtos/freertos/freertos_kernel/list.c", + "${k32w1_sdk_root}/rtos/freertos/freertos_kernel/portable/GCC/ARM_CM33_NTZ/non_secure/port.c", + "${k32w1_sdk_root}/rtos/freertos/freertos_kernel/portable/GCC/ARM_CM33_NTZ/non_secure/portasm.c", "${k32w1_sdk_root}/rtos/freertos/freertos_kernel/queue.c", "${k32w1_sdk_root}/rtos/freertos/freertos_kernel/stream_buffer.c", "${k32w1_sdk_root}/rtos/freertos/freertos_kernel/tasks.c", "${k32w1_sdk_root}/rtos/freertos/freertos_kernel/timers.c", ] - if (chip_config_dimmable_led) { - sources += [ - "${k32w1_sdk_root}/components/pwm/fsl_adapter_pwm_tpm.c", - ] - } - if (chip_with_low_power == 1) { sources += [] } diff --git a/third_party/openthread/platforms/nxp/k32w/k32w0/BUILD.gn b/third_party/openthread/platforms/nxp/k32w/k32w0/BUILD.gn index 91b4dfa3ae7009..a67158170d0a18 100644 --- a/third_party/openthread/platforms/nxp/k32w/k32w0/BUILD.gn +++ b/third_party/openthread/platforms/nxp/k32w/k32w0/BUILD.gn @@ -14,12 +14,11 @@ import("//build_overrides/build.gni") import("//build_overrides/chip.gni") -import("//build_overrides/nxp_sdk.gni") +import("//build_overrides/k32w0_sdk.gni") import("//build_overrides/openthread.gni") import("${build_root}/config/compiler/compiler.gni") -import("${nxp_sdk_build_root}/nxp_sdk.gni") -import("${nxp_sdk_build_root}/${nxp_sdk_name}/${nxp_sdk_name}.gni") +import("${chip_root}/third_party/nxp/k32w0_sdk/k32w0_sdk.gni") openthread_nxp_root = "${chip_root}/third_party/openthread/ot-nxp" @@ -91,8 +90,8 @@ source_set("libopenthread-k32w0") { public_deps = [ ":openthread_core_config_k32w0", - "${nxp_sdk_build_root}:nxp_sdk", - "${nxp_sdk_build_root}/${nxp_sdk_name}:mbedtls", + "${k32w0_sdk_build_root}:k32w0_sdk", + "${k32w0_sdk_build_root}:mbedtls", "${openthread_root}/src/core:libopenthread_core_headers", "../../..:libopenthread-platform", "../../..:libopenthread-platform-utils", diff --git a/third_party/openthread/platforms/nxp/k32w/k32w1/BUILD.gn b/third_party/openthread/platforms/nxp/k32w/k32w1/BUILD.gn index 293165e7187de2..446768b23b778c 100644 --- a/third_party/openthread/platforms/nxp/k32w/k32w1/BUILD.gn +++ b/third_party/openthread/platforms/nxp/k32w/k32w1/BUILD.gn @@ -27,11 +27,12 @@ config("openthread_k32w1_config") { include_dirs += [ "${chip_root}/examples/platform/nxp/k32w/k32w1" ] defines = [ - "OPENTHREAD_CONFIG_HEAP_EXTERNAL_ENABLE=1", - "OPENTHREAD_CONFIG_IP6_SLAAC_ENABLE=1", - "MBEDTLS_ENTROPY_HARDWARE_ALT=1", - "MBEDTLS_THREADING_C=1", - "MBEDTLS_THREADING_ALT=1" + "OPENTHREAD_CONFIG_HEAP_EXTERNAL_ENABLE=1", + "OPENTHREAD_CONFIG_IP6_SLAAC_ENABLE=1", + "MBEDTLS_ENTROPY_HARDWARE_ALT=1", + "OPENTHREAD_PLATFORM_CORE_CONFIG_FILE=\"app/project_include/OpenThreadConfig.h\"", + "MBEDTLS_THREADING_C=1", + "MBEDTLS_THREADING_ALT=1", ] if (use_smu2_dynamic) {