Skip to content

Commit 9a4ea8e

Browse files
ArekBalysNordicrlubos
authored andcommitted
[nrf toup][nrfconnect] Enable ZMS in nrfconnect if RRAM is in use.
Disabled NVS and enabled ZMS fs backend for all devices that uses RRAM. Signed-off-by: Arkadiusz Balys <arkadiusz.balys@nordicsemi.no>
1 parent 0c49058 commit 9a4ea8e

File tree

5 files changed

+25
-7
lines changed

5 files changed

+25
-7
lines changed

config/nrfconnect/chip-module/CMakeLists.txt

+7
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,13 @@ if (CONFIG_CHIP_PW_RPC)
210210
matter_add_gn_arg("pw_build_LINK_DEPS" [\"${PIGWEED_DIR}/pw_assert:impl\",\ \"${PIGWEED_DIR}/pw_log:impl\"])
211211
endif()
212212

213+
# Inform users that they use not-optimized settings backend for the nRF54LX series.
214+
if(CONFIG_SOC_SERIES_NRF54LX AND CONFIG_SETTINGS_NVS)
215+
message(WARNING "
216+
The nRF54L series is not optimized for the NVS settings backend due to RRAM specifications.
217+
Consider using the CONFIG_SETTINGS_ZMS Kconfig option, which is recommended for this type of non-volatile memory.")
218+
endif()
219+
213220
matter_generate_args_tmp_file()
214221

215222
# ==============================================================================

config/nrfconnect/chip-module/Kconfig

+8-4
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,12 @@
1717
rsource "../../zephyr/Kconfig"
1818

1919
config CHIP
20-
imply NVS_LOOKUP_CACHE
21-
imply NVS_LOOKUP_CACHE_FOR_SETTINGS
20+
imply NVS if !SOC_FLASH_NRF_RRAM
21+
imply NVS_LOOKUP_CACHE if !SOC_FLASH_NRF_RRAM
22+
imply NVS_LOOKUP_CACHE_FOR_SETTINGS if !SOC_FLASH_NRF_RRAM
23+
imply ZMS if SOC_FLASH_NRF_RRAM
24+
imply ZMS_LOOKUP_CACHE if SOC_FLASH_NRF_RRAM
25+
imply ZMS_LOOKUP_CACHE_FOR_SETTINGS if SOC_FLASH_NRF_RRAM
2226

2327
if CHIP
2428

@@ -322,9 +326,9 @@ config CHIP_DEVICE_GENERATE_ROTATING_DEVICE_UID
322326
endif # CHIP_FACTORY_DATA_BUILD
323327

324328
# See config/zephyr/Kconfig for full definition
325-
config CHIP_FACTORY_RESET_ERASE_NVS
326-
bool
329+
config CHIP_FACTORY_RESET_ERASE_SETTINGS
327330
default y
331+
depends on NVS || ZMS
328332
depends on !CHIP_CRYPTO_PSA_MIGRATE_DAC_PRIV_KEY
329333

330334
config CHIP_LOG_SIZE_OPTIMIZATION

config/nrfconnect/chip-module/Kconfig.defaults

+4-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,10 @@ config COMMON_LIBC_MALLOC_ARENA_SIZE
6767
default -1
6868

6969
config NVS_LOOKUP_CACHE_SIZE
70-
default 512
70+
default 512 if NVS
71+
72+
config ZMS_LOOKUP_CACHE_SIZE
73+
default 512 if ZMS
7174

7275
# ==============================================================================
7376
# Zephyr networking configuration

docs/guides/nrfconnect_examples_configuration.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -207,8 +207,8 @@ set the `CONFIG_CHIP_NFC_COMMISSIONING` option.
207207
By default, the factory reset procedure implemented in the Matter stack removes
208208
Matter-related settings only. If your application does not depend on any
209209
device-lifelong data stored in the non-volatile storage, set the
210-
`CONFIG_CHIP_FACTORY_RESET_ERASE_NVS` option to fully erase the NVS partition at
211-
the factory reset. This approach is more robust and regains the original NVS
210+
`CONFIG_CHIP_FACTORY_RESET_ERASE_SETTINGS` option to fully erase the non-volatile settings partition at
211+
the factory reset. This approach is more robust and regains the original non-volatile
212212
performance in case it has been polluted with unwanted entries.
213213
214214
#### Logging

src/platform/nrfconnect/FactoryDataProvider.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,10 @@ CHIP_ERROR FactoryDataProvider<FlashFactoryData>::MoveDACPrivateKeyToSecureStora
160160
}
161161

162162
#ifdef CONFIG_CHIP_CRYPTO_PSA_MIGRATE_DAC_PRIV_KEY
163+
#ifdef CONFIG_CHIP_FACTORY_RESET_ERASE_SETTINGS
164+
#error "Do not use both CONFIG_CHIP_FACTORY_RESET_ERASE_SETTINGS and CONFIG_CHIP_CRYPTO_PSA_MIGRATE_DAC_PRIV_KEY kconfig options " \
165+
"because you will permanently lose the DAC private key from the device."
166+
#endif
163167
// Check once again if the saved key has attributes set before removing it from the factory data set.
164168
VerifyOrReturnError(psa_get_key_attributes(mDACPrivKeyId, &attributes) == PSA_SUCCESS, CHIP_ERROR_INTERNAL);
165169

0 commit comments

Comments
 (0)