Skip to content

Commit 41fa140

Browse files
kkasperczyk-nomarkaj-nordicDamian-NordicLipinskiPNordicSemiLuDuda
committed
[nrfconnect] Introduced several platform configuration fixes (project-chip#33194)
* [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 <marcin.kajor@nordicsemi.no> * [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 <marcin.kajor@nordicsemi.no> * [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 <marcin.kajor@nordicsemi.no> * [zephyr] Added OpenThread dependencies to a few Kconfigs Co-authored-by: Damian Krolik <damian.krolik@nordicsemi.no> * [zephyr] Lock Thread stack before factory reset 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 <patryk.lipinski@nordicsemi.no> Signed-off-by: Michał Szablowski <michal.szablowski@nordicsemi.no> * [nrfconnect] Increase default number of packet buffers and stack size 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 <lukasz.duda@nordicsemi.no> * [nrfconnect] Select Experimental for persistent subscriptions Currently, there is an issue with persistent subscriptions when multiple controllers create subscriptions. * [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 <kamil.kasperczyk@nordicsemi.no> * Revert "[nrfconnect] Disable Zephyr socket extensions" This reverts commit bb09061. --------- Signed-off-by: Marcin Kajor <marcin.kajor@nordicsemi.no> Signed-off-by: Patryk Lipinski <patryk.lipinski@nordicsemi.no> Signed-off-by: Michał Szablowski <michal.szablowski@nordicsemi.no> Signed-off-by: Łukasz Duda <lukasz.duda@nordicsemi.no> Signed-off-by: Kamil Kasperczyk <kamil.kasperczyk@nordicsemi.no> Co-authored-by: Marcin Kajor <marcin.kajor@nordicsemi.no> Co-authored-by: Damian Krolik <damian.krolik@nordicsemi.no> Co-authored-by: Patryk Lipinski <patryk.lipinski@nordicsemi.no> Co-authored-by: Łukasz Duda <lukasz.duda@nordicsemi.no> Co-authored-by: Arkadiusz Balys <arkadiusz.balys@nordicsemi.no>
1 parent d989f15 commit 41fa140

9 files changed

+35
-28
lines changed
+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
add_library(gnu17 INTERFACE)
22
target_compile_options(gnu17
33
INTERFACE
4-
$<$<COMPILE_LANGUAGE:CXX>:-std=gnu++17>
5-
-D_SYS__PTHREADTYPES_H_)
4+
$<$<COMPILE_LANGUAGE:CXX>:-std=gnu++17>)
65
target_link_libraries(app PRIVATE gnu17)

config/nrfconnect/chip-module/Kconfig

+5
Original file line numberDiff line numberDiff line change
@@ -302,4 +302,9 @@ config CHIP_FACTORY_RESET_ON_KEY_MIGRATION_FAILURE
302302
Perform factory reset of the device if the operational key for Fabric has not been migrated
303303
properly to PSA ITS storage.
304304

305+
config CHIP_PERSISTENT_SUBSCRIPTIONS
306+
default n
307+
# selecting experimental for this feature since there is an issue with multiple controllers.
308+
select EXPERIMENTAL
309+
305310
endif # CHIP

config/nrfconnect/chip-module/Kconfig.defaults

+8-4
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ if CHIP
2424
# System configuration
2525
# ==============================================================================
2626

27+
choice LIBC_IMPLEMENTATION
28+
default NEWLIB_LIBC
29+
endchoice
30+
2731
config ASSERT
2832
default y
2933

@@ -318,13 +322,13 @@ if PSA_CRYPTO_DRIVER_CC3XX && PSA_CRYPTO_DRIVER_OBERON
318322
config PSA_USE_CC3XX_HASH_DRIVER
319323
default n
320324

321-
endif
325+
endif # PSA_CRYPTO_DRIVER_CC3XX && PSA_CRYPTO_DRIVER_OBERON
322326

323327
# Spake2+ support
324328
config MBEDTLS_MD_C
325329
default y
326330

327-
endif
331+
endif # CHIP_CRYPTO_PSA
328332

329333
if !CHIP_CRYPTO_PSA
330334

@@ -367,7 +371,7 @@ config MBEDTLS_ECP_C
367371
config MBEDTLS_ECP_DP_SECP256R1_ENABLED
368372
default y
369373

370-
endif
374+
endif # !CHIP_CRYPTO_PSA
371375

372376
config MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG
373377
default n if CHIP_WIFI
@@ -487,4 +491,4 @@ config OPENTHREAD_SHELL
487491

488492
endif # SHELL
489493

490-
endif
494+
endif # CHIP

config/nrfconnect/chip-module/Kconfig.features

+1-3
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,13 @@ config CHIP_WIFI
4242

4343
config CHIP_QSPI_NOR
4444
bool "Enable QSPI NOR feature set"
45+
imply NORDIC_QSPI_NOR
4546
help
4647
Enables QSPI NOR flash with a set of options for configuring pages and
4748
buffer sizes.
4849

4950
if CHIP_QSPI_NOR
5051

51-
config NORDIC_QSPI_NOR
52-
default y
53-
5452
config NORDIC_QSPI_NOR_STACK_WRITE_BUFFER_SIZE
5553
default 16
5654

config/nrfconnect/chip-module/Kconfig.mcuboot.defaults

+1-16
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,7 @@
1919
config MAIN_STACK_SIZE
2020
default 10240
2121

22-
config BOOT_SWAP_SAVE_ENCTLV
23-
default n
24-
25-
config BOOT_ENCRYPT_RSA
26-
default n
27-
28-
config BOOT_ENCRYPT_EC256
29-
default n
30-
31-
config BOOT_ENCRYPT_X25519
22+
config BOOT_ENCRYPT_IMAGE
3223
default n
3324

3425
config BOOT_BOOTSTRAP
@@ -53,9 +44,6 @@ if BOARD_NRF7002DK_NRF5340_CPUAPP
5344
config SPI
5445
default y
5546

56-
config SPI_NOR
57-
default y
58-
5947
choice SPI_NOR_SFDP
6048
default SPI_NOR_SFDP_DEVICETREE
6149
endchoice
@@ -74,9 +62,6 @@ endif
7462
# All boards beside nRF7002DK use QSPI NOR external flash
7563
if BOARD_NRF5340DK_NRF5340_CPUAPP || BOARD_NRF52840DK_NRF52840
7664

77-
config NORDIC_QSPI_NOR
78-
default y
79-
8065
config NORDIC_QSPI_NOR_FLASH_LAYOUT_PAGE_SIZE
8166
default 4096
8267

config/zephyr/Kconfig

+5-2
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,8 @@ config CHIP_PROJECT_CONFIG
309309

310310
config CHIP_ENABLE_DNSSD_SRP
311311
bool "OpenThread Service Registration Protocol"
312-
default y if NET_L2_OPENTHREAD
312+
default y
313+
depends on NET_L2_OPENTHREAD
313314
imply OPENTHREAD_ECDSA
314315
imply OPENTHREAD_SRP_CLIENT
315316
help
@@ -318,7 +319,8 @@ config CHIP_ENABLE_DNSSD_SRP
318319

319320
config CHIP_ENABLE_DNS_CLIENT
320321
bool "OpenThread DNS client"
321-
default y if NET_L2_OPENTHREAD
322+
default y
323+
depends on NET_L2_OPENTHREAD
322324
imply OPENTHREAD_DNS_CLIENT
323325
help
324326
Enables using the OpenThread DNS client for the Matter service discovery.
@@ -413,6 +415,7 @@ config CHIP_THREAD_SSED
413415

414416
config CHIP_OPENTHREAD_CONFIG
415417
string "Custom OpenThread configuration file"
418+
depends on NET_L2_OPENTHREAD
416419
help
417420
Provides a path to an OpenThread configuration file. The path can be
418421
either absolute or relative to the application directory. When this option

src/platform/Zephyr/ConfigurationManagerImpl.cpp

+9
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@
4040
#include <zephyr/settings/settings.h>
4141
#endif
4242

43+
#ifdef CONFIG_NET_L2_OPENTHREAD
44+
#include <platform/ThreadStackManager.h>
45+
#endif
46+
4347
namespace chip {
4448
namespace DeviceLayer {
4549

@@ -179,6 +183,11 @@ void ConfigurationManagerImpl::DoFactoryReset(intptr_t arg)
179183
{
180184
ChipLogProgress(DeviceLayer, "Performing factory reset");
181185

186+
// Lock the Thread stack to avoid unwanted interaction with settings NVS during factory reset.
187+
#ifdef CONFIG_NET_L2_OPENTHREAD
188+
ThreadStackMgr().LockThreadStack();
189+
#endif
190+
182191
#ifdef CONFIG_CHIP_FACTORY_RESET_ERASE_NVS
183192
void * storage = nullptr;
184193
int status = settings_storage_get(&storage);

src/platform/nrfconnect/CHIPDevicePlatformConfig.h

+4
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,11 @@
161161
#endif // CHIP_DEVICE_CONFIG_CHIP_TASK_PRIORITY
162162

163163
#ifndef CHIP_DEVICE_CONFIG_CHIP_TASK_STACK_SIZE
164+
#if defined(CONFIG_LTO)
165+
#define CHIP_DEVICE_CONFIG_CHIP_TASK_STACK_SIZE 10240
166+
#else
164167
#define CHIP_DEVICE_CONFIG_CHIP_TASK_STACK_SIZE 6144
168+
#endif // CONFIG_LTO
165169
#endif // CHIP_DEVICE_CONFIG_CHIP_TASK_STACK_SIZE
166170

167171
#define CHIP_DEVICE_CONFIG_MAX_EVENT_QUEUE_SIZE 64

src/platform/nrfconnect/SystemPlatformConfig.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ struct ChipDeviceEvent;
4848
#define CHIP_SYSTEM_CONFIG_USE_SOCKETS 1
4949

5050
#ifndef CONFIG_ARCH_POSIX
51-
#define CHIP_SYSTEM_CONFIG_PACKETBUFFER_POOL_SIZE 8
51+
#define CHIP_SYSTEM_CONFIG_PACKETBUFFER_POOL_SIZE 15
5252
#endif
5353

5454
// ========== Platform-specific Configuration Overrides =========

0 commit comments

Comments
 (0)