From bb09061209748fe634a4b837f4db1db4f8b2d140 Mon Sep 17 00:00:00 2001 From: Marcin Kajor Date: Thu, 7 Mar 2024 11:44:35 +0100 Subject: [PATCH 1/9] [nrfconnect] Disable Zephyr socket extensions The recvmsg() is now implemented natively in Zephyr, so we are not supposed to define a custom one. Signed-off-by: Marcin Kajor --- src/platform/nrfconnect/SystemPlatformConfig.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/platform/nrfconnect/SystemPlatformConfig.h b/src/platform/nrfconnect/SystemPlatformConfig.h index 60d9c354d01ab1..78b4944b354327 100644 --- a/src/platform/nrfconnect/SystemPlatformConfig.h +++ b/src/platform/nrfconnect/SystemPlatformConfig.h @@ -66,3 +66,6 @@ struct ChipDeviceEvent; #endif // CHIP_SYSTEM_CONFIG_PACKETBUFFER_CAPACITY_MAX // ========== Platform-specific Configuration Overrides ========= + +// Disable Zephyr Socket extensions module, as the Zephyr RTOS now implements recvmsg() +#define CHIP_SYSTEM_CONFIG_USE_ZEPHYR_SOCKET_EXTENSIONS 0 From d0a169f74d5401d59f7e9dedcc74fdb43ec0154a Mon Sep 17 00:00:00 2001 From: Marcin Kajor Date: Mon, 11 Mar 2024 11:17:12 +0100 Subject: [PATCH 2/9] [nrfconnect] Remove D_SYS__PTHREADTYPES_H_ flag ... from the gnu17 configuration to avoid missing pthread types definitions (_pthreadtypes.h). This tricked the preprocessor the header was already included, hence we didn't get its content. Signed-off-by: Marcin Kajor --- config/nrfconnect/app/enable-gnu-std.cmake | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/config/nrfconnect/app/enable-gnu-std.cmake b/config/nrfconnect/app/enable-gnu-std.cmake index 5f31e1a5c62ab8..4019bbd31bf27a 100644 --- a/config/nrfconnect/app/enable-gnu-std.cmake +++ b/config/nrfconnect/app/enable-gnu-std.cmake @@ -1,6 +1,5 @@ add_library(gnu17 INTERFACE) target_compile_options(gnu17 INTERFACE - $<$:-std=gnu++17> - -D_SYS__PTHREADTYPES_H_) + $<$:-std=gnu++17>) target_link_libraries(app PRIVATE gnu17) From fcce0d71b21a26e1db42ef2aa03a36816ef6c6fd Mon Sep 17 00:00:00 2001 From: Marcin Kajor Date: Mon, 11 Mar 2024 12:02:44 +0100 Subject: [PATCH 3/9] [nrfconnect] Use newlib as a default libc implementation. The PICOLIB is now used by the default. NEWLIB_LIBC symbol is no longer selected by hostap. OpenThread selects NEWLIB_LIBC anyway. Signed-off-by: Marcin Kajor --- config/nrfconnect/chip-module/Kconfig.defaults | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/config/nrfconnect/chip-module/Kconfig.defaults b/config/nrfconnect/chip-module/Kconfig.defaults index 562755b14b9c25..64d1b5278691ce 100644 --- a/config/nrfconnect/chip-module/Kconfig.defaults +++ b/config/nrfconnect/chip-module/Kconfig.defaults @@ -24,6 +24,10 @@ if CHIP # System configuration # ============================================================================== +choice LIBC_IMPLEMENTATION + default NEWLIB_LIBC +endchoice + config ASSERT default y From cfa8bfe6fcf3b0a2358544f4b9c1470dc6457cff Mon Sep 17 00:00:00 2001 From: Kamil Kasperczyk Date: Fri, 26 Apr 2024 11:48:59 +0200 Subject: [PATCH 4/9] [zephyr] Added OpenThread dependencies to a few Kconfigs Co-authored-by: Damian Krolik --- config/zephyr/Kconfig | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/config/zephyr/Kconfig b/config/zephyr/Kconfig index bdfa709592adff..c806ceed805385 100644 --- a/config/zephyr/Kconfig +++ b/config/zephyr/Kconfig @@ -309,7 +309,8 @@ config CHIP_PROJECT_CONFIG config CHIP_ENABLE_DNSSD_SRP bool "OpenThread Service Registration Protocol" - default y if NET_L2_OPENTHREAD + default y + depends on NET_L2_OPENTHREAD imply OPENTHREAD_ECDSA imply OPENTHREAD_SRP_CLIENT help @@ -318,7 +319,8 @@ config CHIP_ENABLE_DNSSD_SRP config CHIP_ENABLE_DNS_CLIENT bool "OpenThread DNS client" - default y if NET_L2_OPENTHREAD + default y + depends on NET_L2_OPENTHREAD imply OPENTHREAD_DNS_CLIENT help Enables using the OpenThread DNS client for the Matter service discovery. @@ -413,6 +415,7 @@ config CHIP_THREAD_SSED config CHIP_OPENTHREAD_CONFIG string "Custom OpenThread configuration file" + depends on NET_L2_OPENTHREAD help Provides a path to an OpenThread configuration file. The path can be either absolute or relative to the application directory. When this option From 4f7f99ae5b5b9e83109fca076e9746ad2bd93b7c Mon Sep 17 00:00:00 2001 From: Patryk Lipinski Date: Fri, 19 Jan 2024 15:37:43 +0100 Subject: [PATCH 5/9] [zephyr] Lock Thread stack before factory reset MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This fixes a problem with Thread activity interrupting factory reset. This activity used to led to “Factory reset fail: -6”. Writing to the cleared nvm flash pages caused the problem. Signed-off-by: Patryk Lipinski Signed-off-by: Michał Szablowski --- src/platform/Zephyr/ConfigurationManagerImpl.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/platform/Zephyr/ConfigurationManagerImpl.cpp b/src/platform/Zephyr/ConfigurationManagerImpl.cpp index f41eed0492080f..639f3a9324796d 100644 --- a/src/platform/Zephyr/ConfigurationManagerImpl.cpp +++ b/src/platform/Zephyr/ConfigurationManagerImpl.cpp @@ -40,6 +40,10 @@ #include #endif +#ifdef CONFIG_NET_L2_OPENTHREAD +#include +#endif + namespace chip { namespace DeviceLayer { @@ -179,6 +183,11 @@ void ConfigurationManagerImpl::DoFactoryReset(intptr_t arg) { ChipLogProgress(DeviceLayer, "Performing factory reset"); +// Lock the Thread stack to avoid unwanted interaction with settings NVS during factory reset. +#ifdef CONFIG_NET_L2_OPENTHREAD + ThreadStackMgr().LockThreadStack(); +#endif + #ifdef CONFIG_CHIP_FACTORY_RESET_ERASE_NVS void * storage = nullptr; int status = settings_storage_get(&storage); From 8a54c320d6990963d1b16a395560cf1a067de238 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Duda?= Date: Mon, 8 Apr 2024 08:46:08 +0200 Subject: [PATCH 6/9] [nrfconnect] Increase default number of packet buffers and stack size MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit reverts the previous optimization of reducing the number of packet buffers in the system. Additionally increase of stack size is needed to accomodate LTO. Signed-off-by: Łukasz Duda --- src/platform/nrfconnect/CHIPDevicePlatformConfig.h | 3 +++ src/platform/nrfconnect/SystemPlatformConfig.h | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/platform/nrfconnect/CHIPDevicePlatformConfig.h b/src/platform/nrfconnect/CHIPDevicePlatformConfig.h index f9e445f35fb3d4..59158f374f8b9f 100644 --- a/src/platform/nrfconnect/CHIPDevicePlatformConfig.h +++ b/src/platform/nrfconnect/CHIPDevicePlatformConfig.h @@ -161,6 +161,9 @@ #endif // CHIP_DEVICE_CONFIG_CHIP_TASK_PRIORITY #ifndef CHIP_DEVICE_CONFIG_CHIP_TASK_STACK_SIZE +#if defined(CONFIG_LTO) +#define CHIP_DEVICE_CONFIG_CHIP_TASK_STACK_SIZE 10240 +#else #define CHIP_DEVICE_CONFIG_CHIP_TASK_STACK_SIZE 6144 #endif // CHIP_DEVICE_CONFIG_CHIP_TASK_STACK_SIZE diff --git a/src/platform/nrfconnect/SystemPlatformConfig.h b/src/platform/nrfconnect/SystemPlatformConfig.h index 78b4944b354327..de2f59cb7eac27 100644 --- a/src/platform/nrfconnect/SystemPlatformConfig.h +++ b/src/platform/nrfconnect/SystemPlatformConfig.h @@ -48,7 +48,7 @@ struct ChipDeviceEvent; #define CHIP_SYSTEM_CONFIG_USE_SOCKETS 1 #ifndef CONFIG_ARCH_POSIX -#define CHIP_SYSTEM_CONFIG_PACKETBUFFER_POOL_SIZE 8 +#define CHIP_SYSTEM_CONFIG_PACKETBUFFER_POOL_SIZE 15 #endif #ifndef CHIP_SYSTEM_CONFIG_PACKETBUFFER_CAPACITY_MAX From b602aa6535b3a00d2956b8ad20457371790fee49 Mon Sep 17 00:00:00 2001 From: Arkadiusz Balys Date: Thu, 7 Mar 2024 14:06:49 +0100 Subject: [PATCH 7/9] [nrfconnect] Select Experimental for persistent subscriptions Currently, there is an issue with persistent subscriptions when multiple controllers create subscriptions. --- config/nrfconnect/chip-module/Kconfig | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/config/nrfconnect/chip-module/Kconfig b/config/nrfconnect/chip-module/Kconfig index 5d03e82530c84e..e3c5a86bf96c1d 100644 --- a/config/nrfconnect/chip-module/Kconfig +++ b/config/nrfconnect/chip-module/Kconfig @@ -302,4 +302,9 @@ config CHIP_FACTORY_RESET_ON_KEY_MIGRATION_FAILURE Perform factory reset of the device if the operational key for Fabric has not been migrated properly to PSA ITS storage. +config CHIP_PERSISTENT_SUBSCRIPTIONS + default n + # selecting experimental for this feature since there is an issue with multiple controllers. + select EXPERIMENTAL + endif # CHIP From 8acef4679ec52ed63311fa66f8bb9277c76a11f2 Mon Sep 17 00:00:00 2001 From: Kamil Kasperczyk Date: Tue, 23 Apr 2024 07:55:20 +0200 Subject: [PATCH 8/9] [nrfconnect] Fixed mcuboot default configuration Removed the defaults from Kconfig.mcuboot.defaults configuration that should not be set there: * BOOT_ENCRYPT_X - are configs without a prompt, so it should not be modified outside of the mcuboot module * SPI_NOR and NORDIC_QSPI_NOR - are set based on the device tree configuration, so we should not set it, as it may lead to configuration and dts mismatch. Signed-off-by: Kamil Kasperczyk --- config/nrfconnect/chip-module/Kconfig.defaults | 8 ++++---- config/nrfconnect/chip-module/Kconfig.features | 4 +--- .../chip-module/Kconfig.mcuboot.defaults | 17 +---------------- .../Zephyr/ConfigurationManagerImpl.cpp | 2 +- .../nrfconnect/CHIPDevicePlatformConfig.h | 1 + 5 files changed, 8 insertions(+), 24 deletions(-) diff --git a/config/nrfconnect/chip-module/Kconfig.defaults b/config/nrfconnect/chip-module/Kconfig.defaults index 64d1b5278691ce..7e3c2a6077d5ce 100644 --- a/config/nrfconnect/chip-module/Kconfig.defaults +++ b/config/nrfconnect/chip-module/Kconfig.defaults @@ -322,13 +322,13 @@ if PSA_CRYPTO_DRIVER_CC3XX && PSA_CRYPTO_DRIVER_OBERON config PSA_USE_CC3XX_HASH_DRIVER default n -endif +endif # PSA_CRYPTO_DRIVER_CC3XX && PSA_CRYPTO_DRIVER_OBERON # Spake2+ support config MBEDTLS_MD_C default y -endif +endif # CHIP_CRYPTO_PSA if !CHIP_CRYPTO_PSA @@ -371,7 +371,7 @@ config MBEDTLS_ECP_C config MBEDTLS_ECP_DP_SECP256R1_ENABLED default y -endif +endif # !CHIP_CRYPTO_PSA config MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG default n if CHIP_WIFI @@ -491,4 +491,4 @@ config OPENTHREAD_SHELL endif # SHELL -endif \ No newline at end of file +endif # CHIP diff --git a/config/nrfconnect/chip-module/Kconfig.features b/config/nrfconnect/chip-module/Kconfig.features index 369f992c9a5070..e6a4e52d500e13 100644 --- a/config/nrfconnect/chip-module/Kconfig.features +++ b/config/nrfconnect/chip-module/Kconfig.features @@ -42,15 +42,13 @@ config CHIP_WIFI config CHIP_QSPI_NOR bool "Enable QSPI NOR feature set" + imply NORDIC_QSPI_NOR help Enables QSPI NOR flash with a set of options for configuring pages and buffer sizes. if CHIP_QSPI_NOR -config NORDIC_QSPI_NOR - default y - config NORDIC_QSPI_NOR_STACK_WRITE_BUFFER_SIZE default 16 diff --git a/config/nrfconnect/chip-module/Kconfig.mcuboot.defaults b/config/nrfconnect/chip-module/Kconfig.mcuboot.defaults index 31759beba22ffc..224dc57bfc2769 100644 --- a/config/nrfconnect/chip-module/Kconfig.mcuboot.defaults +++ b/config/nrfconnect/chip-module/Kconfig.mcuboot.defaults @@ -19,16 +19,7 @@ config MAIN_STACK_SIZE default 10240 -config BOOT_SWAP_SAVE_ENCTLV - default n - -config BOOT_ENCRYPT_RSA - default n - -config BOOT_ENCRYPT_EC256 - default n - -config BOOT_ENCRYPT_X25519 +config BOOT_ENCRYPT_IMAGE default n config BOOT_BOOTSTRAP @@ -53,9 +44,6 @@ if BOARD_NRF7002DK_NRF5340_CPUAPP config SPI default y -config SPI_NOR - default y - choice SPI_NOR_SFDP default SPI_NOR_SFDP_DEVICETREE endchoice @@ -74,9 +62,6 @@ endif # All boards beside nRF7002DK use QSPI NOR external flash if BOARD_NRF5340DK_NRF5340_CPUAPP || BOARD_NRF52840DK_NRF52840 -config NORDIC_QSPI_NOR - default y - config NORDIC_QSPI_NOR_FLASH_LAYOUT_PAGE_SIZE default 4096 diff --git a/src/platform/Zephyr/ConfigurationManagerImpl.cpp b/src/platform/Zephyr/ConfigurationManagerImpl.cpp index 639f3a9324796d..2e937c95f0f9e0 100644 --- a/src/platform/Zephyr/ConfigurationManagerImpl.cpp +++ b/src/platform/Zephyr/ConfigurationManagerImpl.cpp @@ -42,7 +42,7 @@ #ifdef CONFIG_NET_L2_OPENTHREAD #include -#endif +#endif namespace chip { namespace DeviceLayer { diff --git a/src/platform/nrfconnect/CHIPDevicePlatformConfig.h b/src/platform/nrfconnect/CHIPDevicePlatformConfig.h index 59158f374f8b9f..2e3c93289f8516 100644 --- a/src/platform/nrfconnect/CHIPDevicePlatformConfig.h +++ b/src/platform/nrfconnect/CHIPDevicePlatformConfig.h @@ -165,6 +165,7 @@ #define CHIP_DEVICE_CONFIG_CHIP_TASK_STACK_SIZE 10240 #else #define CHIP_DEVICE_CONFIG_CHIP_TASK_STACK_SIZE 6144 +#endif // CONFIG_LTO #endif // CHIP_DEVICE_CONFIG_CHIP_TASK_STACK_SIZE #define CHIP_DEVICE_CONFIG_MAX_EVENT_QUEUE_SIZE 64 From be739775e8a78950553f3b2317dc8a1651241f97 Mon Sep 17 00:00:00 2001 From: Kamil Kasperczyk Date: Fri, 26 Apr 2024 14:03:43 +0200 Subject: [PATCH 9/9] Revert "[nrfconnect] Disable Zephyr socket extensions" This reverts commit bb09061209748fe634a4b837f4db1db4f8b2d140. --- src/platform/nrfconnect/SystemPlatformConfig.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/platform/nrfconnect/SystemPlatformConfig.h b/src/platform/nrfconnect/SystemPlatformConfig.h index de2f59cb7eac27..fb544466dcdd75 100644 --- a/src/platform/nrfconnect/SystemPlatformConfig.h +++ b/src/platform/nrfconnect/SystemPlatformConfig.h @@ -66,6 +66,3 @@ struct ChipDeviceEvent; #endif // CHIP_SYSTEM_CONFIG_PACKETBUFFER_CAPACITY_MAX // ========== Platform-specific Configuration Overrides ========= - -// Disable Zephyr Socket extensions module, as the Zephyr RTOS now implements recvmsg() -#define CHIP_SYSTEM_CONFIG_USE_ZEPHYR_SOCKET_EXTENSIONS 0