Skip to content

Commit

Permalink
[nrfconnect] Introduced several platform configuration fixes (project…
Browse files Browse the repository at this point in the history
…-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 <[email protected]>

* [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 <[email protected]>

* [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 <[email protected]>

* [zephyr] Added OpenThread dependencies to a few Kconfigs

Co-authored-by: Damian Krolik <[email protected]>

* [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 <[email protected]>
Signed-off-by: Michał Szablowski <[email protected]>

* [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 <[email protected]>

* [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 <[email protected]>

* Revert "[nrfconnect] Disable Zephyr socket extensions"

This reverts commit bb09061.

---------

Signed-off-by: Marcin Kajor <[email protected]>
Signed-off-by: Patryk Lipinski <[email protected]>
Signed-off-by: Michał Szablowski <[email protected]>
Signed-off-by: Łukasz Duda <[email protected]>
Signed-off-by: Kamil Kasperczyk <[email protected]>
Co-authored-by: Marcin Kajor <[email protected]>
Co-authored-by: Damian Krolik <[email protected]>
Co-authored-by: Patryk Lipinski <[email protected]>
Co-authored-by: Łukasz Duda <[email protected]>
Co-authored-by: Arkadiusz Balys <[email protected]>
  • Loading branch information
6 people committed May 8, 2024
1 parent e777ef7 commit c2811d8
Show file tree
Hide file tree
Showing 9 changed files with 35 additions and 28 deletions.
3 changes: 1 addition & 2 deletions config/nrfconnect/app/enable-gnu-std.cmake
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
add_library(gnu17 INTERFACE)
target_compile_options(gnu17
INTERFACE
$<$<COMPILE_LANGUAGE:CXX>:-std=gnu++17>
-D_SYS__PTHREADTYPES_H_)
$<$<COMPILE_LANGUAGE:CXX>:-std=gnu++17>)
target_link_libraries(app PRIVATE gnu17)
5 changes: 5 additions & 0 deletions config/nrfconnect/chip-module/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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
12 changes: 8 additions & 4 deletions config/nrfconnect/chip-module/Kconfig.defaults
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ if CHIP
# System configuration
# ==============================================================================

choice LIBC_IMPLEMENTATION
default NEWLIB_LIBC
endchoice

config ASSERT
default y

Expand Down Expand Up @@ -318,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

Expand Down Expand Up @@ -367,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
Expand Down Expand Up @@ -487,4 +491,4 @@ config OPENTHREAD_SHELL

endif # SHELL

endif
endif # CHIP
4 changes: 1 addition & 3 deletions config/nrfconnect/chip-module/Kconfig.features
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
17 changes: 1 addition & 16 deletions config/nrfconnect/chip-module/Kconfig.mcuboot.defaults
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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

Expand Down
7 changes: 5 additions & 2 deletions config/zephyr/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.
Expand Down Expand Up @@ -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
Expand Down
9 changes: 9 additions & 0 deletions src/platform/Zephyr/ConfigurationManagerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@
#include <zephyr/settings/settings.h>
#endif

#ifdef CONFIG_NET_L2_OPENTHREAD
#include <platform/ThreadStackManager.h>
#endif

namespace chip {
namespace DeviceLayer {

Expand Down Expand Up @@ -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);
Expand Down
4 changes: 4 additions & 0 deletions src/platform/nrfconnect/CHIPDevicePlatformConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,11 @@
#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 // CONFIG_LTO
#endif // CHIP_DEVICE_CONFIG_CHIP_TASK_STACK_SIZE

#define CHIP_DEVICE_CONFIG_MAX_EVENT_QUEUE_SIZE 64
Expand Down
2 changes: 1 addition & 1 deletion src/platform/nrfconnect/SystemPlatformConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

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

0 comments on commit c2811d8

Please sign in to comment.