Skip to content

Commit b529f8a

Browse files
ArekBalysNordicadigie
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 <[email protected]> (cherry picked from commit 9a4ea8e) Signed-off-by: Adrian Gielniewski <[email protected]>
1 parent c04df5d commit b529f8a

File tree

5 files changed

+25
-7
lines changed

5 files changed

+25
-7
lines changed

config/nrfconnect/chip-module/CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,13 @@ if (CONFIG_CHIP_PW_RPC)
218218
matter_add_gn_arg("pw_build_LINK_DEPS" [\"${PIGWEED_DIR}/pw_assert:impl\",\ \"${PIGWEED_DIR}/pw_log:impl\"])
219219
endif()
220220

221+
# Inform users that they use not-optimized settings backend for the nRF54LX series.
222+
if(CONFIG_SOC_SERIES_NRF54LX AND CONFIG_SETTINGS_NVS)
223+
message(WARNING "
224+
The nRF54L series is not optimized for the NVS settings backend due to RRAM specifications.
225+
Consider using the CONFIG_SETTINGS_ZMS Kconfig option, which is recommended for this type of non-volatile memory.")
226+
endif()
227+
221228
matter_generate_args_tmp_file()
222229

223230
# ==============================================================================

config/nrfconnect/chip-module/Kconfig

Lines changed: 8 additions & 4 deletions
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

@@ -313,9 +317,9 @@ config CHIP_DEVICE_GENERATE_ROTATING_DEVICE_UID
313317
endif # CHIP_FACTORY_DATA_BUILD
314318

315319
# See config/zephyr/Kconfig for full definition
316-
config CHIP_FACTORY_RESET_ERASE_NVS
317-
bool
320+
config CHIP_FACTORY_RESET_ERASE_SETTINGS
318321
default y
322+
depends on NVS || ZMS
319323
depends on !CHIP_CRYPTO_PSA_MIGRATE_DAC_PRIV_KEY
320324

321325
config CHIP_LOG_SIZE_OPTIMIZATION

config/nrfconnect/chip-module/Kconfig.defaults

Lines changed: 4 additions & 1 deletion
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

Lines changed: 2 additions & 2 deletions
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

Lines changed: 4 additions & 0 deletions
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)