Skip to content

Commit d03c8f3

Browse files
hakonfamSebastianBoe
authored andcommitted
[nrf noup] cmake: define pm.yml for settings subsystem
This pm.yml defines a partition 'settings_storage'. Signed-off-by: Håkon Øye Amundsen <[email protected]>
1 parent 52c85a1 commit d03c8f3

File tree

6 files changed

+22
-4
lines changed

6 files changed

+22
-4
lines changed

subsys/settings/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,8 @@ add_subdirectory(src)
44
zephyr_include_directories(
55
include
66
)
7+
8+
if (CONFIG_SETTINGS_FCB OR CONFIG_SETTINGS_NVS)
9+
# These settings backends require a partition in flash
10+
add_partition_manager_config(pm.yml)
11+
endif()

subsys/settings/Kconfig

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,14 @@ if SETTINGS
1616
module = SETTINGS
1717
module-str = settings
1818
source "subsys/logging/Kconfig.template.log_config"
19+
20+
# This config must be compatible with
21+
# nrf/subsys/partition_manager/Kconfig.template.partition_size
22+
config PM_PARTITION_SIZE_SETTINGS_STORAGE
23+
hex "Flash space reserved for settings storage partition"
24+
default 0x6000
25+
help
26+
Flash space set aside for the settings storage partition.
1927
endif
2028

2129
config SETTINGS_RUNTIME

subsys/settings/pm.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#include <autoconf.h>
2+
3+
settings_storage:
4+
placement: {after: [nffs_storage, mcuboot_storage, app]}
5+
size: CONFIG_PM_PARTITION_SIZE_SETTINGS_STORAGE

subsys/settings/src/settings_fcb.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#if USE_PARTITION_MANAGER
1919

2020
#include <pm_config.h>
21-
#define FLASH_AREA_STORAGE_ID PM_MCUBOOT_STORAGE_ID
21+
#define FLASH_AREA_STORAGE_ID PM_SETTINGS_STORAGE_ID
2222

2323
#else
2424

subsys/settings/src/settings_init.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#if USE_PARTITION_MANAGER
1919

2020
#include <pm_config.h>
21-
#define FLASH_AREA_STORAGE_ID PM_MCUBOOT_STORAGE_ID
21+
#define FLASH_AREA_STORAGE_ID PM_SETTINGS_STORAGE_ID
2222

2323
#else
2424

@@ -145,7 +145,7 @@ int settings_backend_init(void)
145145
size_t nvs_sector_size, nvs_size = 0;
146146
const struct flash_area *fa;
147147

148-
rc = flash_area_open(DT_FLASH_AREA_STORAGE_ID, &fa);
148+
rc = flash_area_open(FLASH_AREA_STORAGE_ID, &fa);
149149
if (rc) {
150150
return rc;
151151
}

tests/subsys/settings/fcb/src/settings_test_fcb.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
#if USE_PARTITION_MANAGER
1515

1616
#include <pm_config.h>
17-
#define FLASH_AREA_STORAGE_ID PM_MCUBOOT_STORAGE_ID
17+
#define FLASH_AREA_STORAGE_ID PM_SETTINGS_STORAGE_ID
1818

1919
#else
2020

0 commit comments

Comments
 (0)