mirror of
https://github.com/liquidraver/ZephCore.git
synced 2026-09-01 20:09:17 +00:00
activate NVS on ESP
This commit is contained in:
@@ -68,6 +68,16 @@ CONFIG_HEAP_MEM_POOL_SIZE=32768
|
||||
# Station G2 (16MB) overrides in board.conf.
|
||||
CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y
|
||||
|
||||
# ========== BLE bonds: dedicated NVS partition (not /lfs) ==========
|
||||
# Bonds live in their own `storage_partition` NVS region (defined per board in
|
||||
# board.overlay), isolated from the /lfs LittleFS volume that holds identity/
|
||||
# prefs/contacts. This overrides the file-backed default in zephcore_common.conf
|
||||
# (loaded earlier): a busy bond store can no longer corrupt /lfs. Every ESP32
|
||||
# board.overlay defines a storage_partition, so this is safe platform-wide.
|
||||
CONFIG_SETTINGS_FILE=n
|
||||
CONFIG_NVS=y
|
||||
CONFIG_SETTINGS_NVS=y
|
||||
|
||||
# ========== Debug ==========
|
||||
# CONFIG_ASSERT disabled for ESP32: Espressif's closed-source BLE controller
|
||||
# blob leaves IRQs in a state that triggers false "Context switching while
|
||||
|
||||
@@ -116,10 +116,35 @@
|
||||
/delete-node/ &storage_partition;
|
||||
/delete-node/ &scratch_partition;
|
||||
/delete-node/ &coredump_partition;
|
||||
/delete-node/ &slot0_partition;
|
||||
/delete-node/ &slot1_partition;
|
||||
|
||||
/ {
|
||||
chosen {
|
||||
zephyr,settings-partition = &storage_partition;
|
||||
};
|
||||
};
|
||||
|
||||
&flash0 {
|
||||
partitions {
|
||||
/* LittleFS 384KB for DataStore + file-based BLE settings */
|
||||
/* App slots — both trimmed 8KB so slot0 == slot1 (16KB total freed
|
||||
* for the NVS partition below), keeping MCUboot swap-mode compatible,
|
||||
* not just overwrite-only. slot0 start (0x20000) unchanged. */
|
||||
slot0_partition: partition@20000 {
|
||||
label = "image-0";
|
||||
reg = <0x20000 0x3BE000>;
|
||||
};
|
||||
slot1_partition: partition@3de000 {
|
||||
label = "image-1";
|
||||
reg = <0x3DE000 0x3BE000>;
|
||||
};
|
||||
/* BLE bond store — 16KB NVS, isolated from /lfs (see esp32_common.conf).
|
||||
* Carved from the end of slot1 so lfs stays byte-identical. */
|
||||
storage_partition: partition@79c000 {
|
||||
label = "storage";
|
||||
reg = <0x79C000 0x4000>;
|
||||
};
|
||||
/* LittleFS 384KB for DataStore (identity, prefs, contacts) */
|
||||
lfs_partition: partition@7a0000 {
|
||||
label = "lfs";
|
||||
reg = <0x7A0000 0x60000>;
|
||||
|
||||
@@ -88,10 +88,35 @@
|
||||
/delete-node/ &storage_partition;
|
||||
/delete-node/ &scratch_partition;
|
||||
/delete-node/ &coredump_partition;
|
||||
/delete-node/ &slot0_partition;
|
||||
/delete-node/ &slot1_partition;
|
||||
|
||||
/ {
|
||||
chosen {
|
||||
zephyr,settings-partition = &storage_partition;
|
||||
};
|
||||
};
|
||||
|
||||
&flash0 {
|
||||
partitions {
|
||||
/* LittleFS 384 KB for DataStore + file-based BLE settings */
|
||||
/* App slots — both trimmed 8KB so slot0 == slot1 (16KB total freed
|
||||
* for the NVS partition below), keeping MCUboot swap-mode compatible,
|
||||
* not just overwrite-only. slot0 start (0x20000) unchanged. */
|
||||
slot0_partition: partition@20000 {
|
||||
label = "image-0";
|
||||
reg = <0x20000 0x7BE000>;
|
||||
};
|
||||
slot1_partition: partition@7de000 {
|
||||
label = "image-1";
|
||||
reg = <0x7DE000 0x7BE000>;
|
||||
};
|
||||
/* BLE bond store — 16KB NVS, isolated from /lfs (see esp32_common.conf).
|
||||
* Carved from the end of slot1 so lfs stays byte-identical. */
|
||||
storage_partition: partition@f9c000 {
|
||||
label = "storage";
|
||||
reg = <0xF9C000 0x4000>;
|
||||
};
|
||||
/* LittleFS 384 KB for DataStore (identity, prefs, contacts) */
|
||||
lfs_partition: partition@fa0000 {
|
||||
label = "lfs";
|
||||
reg = <0xFA0000 0x60000>;
|
||||
|
||||
@@ -88,10 +88,35 @@
|
||||
/delete-node/ &storage_partition;
|
||||
/delete-node/ &scratch_partition;
|
||||
/delete-node/ &coredump_partition;
|
||||
/delete-node/ &slot0_partition;
|
||||
/delete-node/ &slot1_partition;
|
||||
|
||||
/ {
|
||||
chosen {
|
||||
zephyr,settings-partition = &storage_partition;
|
||||
};
|
||||
};
|
||||
|
||||
&flash0 {
|
||||
partitions {
|
||||
/* LittleFS 384 KB for DataStore + file-based BLE settings */
|
||||
/* App slots — both trimmed 8KB so slot0 == slot1 (16KB total freed
|
||||
* for the NVS partition below), keeping MCUboot swap-mode compatible,
|
||||
* not just overwrite-only. slot0 start (0x20000) unchanged. */
|
||||
slot0_partition: partition@20000 {
|
||||
label = "image-0";
|
||||
reg = <0x20000 0x7BE000>;
|
||||
};
|
||||
slot1_partition: partition@7de000 {
|
||||
label = "image-1";
|
||||
reg = <0x7DE000 0x7BE000>;
|
||||
};
|
||||
/* BLE bond store — 16KB NVS, isolated from /lfs (see esp32_common.conf).
|
||||
* Carved from the end of slot1 so lfs stays byte-identical. */
|
||||
storage_partition: partition@f9c000 {
|
||||
label = "storage";
|
||||
reg = <0xF9C000 0x4000>;
|
||||
};
|
||||
/* LittleFS 384 KB for DataStore (identity, prefs, contacts) */
|
||||
lfs_partition: partition@fa0000 {
|
||||
label = "lfs";
|
||||
reg = <0xFA0000 0x60000>;
|
||||
|
||||
@@ -234,10 +234,35 @@
|
||||
/delete-node/ &storage_partition;
|
||||
/delete-node/ &scratch_partition;
|
||||
/delete-node/ &coredump_partition;
|
||||
/delete-node/ &slot0_partition;
|
||||
/delete-node/ &slot1_partition;
|
||||
|
||||
/ {
|
||||
chosen {
|
||||
zephyr,settings-partition = &storage_partition;
|
||||
};
|
||||
};
|
||||
|
||||
&flash0 {
|
||||
partitions {
|
||||
/* LittleFS 384KB for DataStore + file-based BLE settings */
|
||||
/* App slots — both trimmed 8KB so slot0 == slot1 (16KB total freed
|
||||
* for the NVS partition below), keeping MCUboot swap-mode compatible,
|
||||
* not just overwrite-only. slot0 start (0x20000) unchanged. */
|
||||
slot0_partition: partition@20000 {
|
||||
label = "image-0";
|
||||
reg = <0x20000 0x3BE000>;
|
||||
};
|
||||
slot1_partition: partition@3de000 {
|
||||
label = "image-1";
|
||||
reg = <0x3DE000 0x3BE000>;
|
||||
};
|
||||
/* BLE bond store — 16KB NVS, isolated from /lfs (see esp32_common.conf).
|
||||
* Carved from the end of slot1 so lfs stays byte-identical. */
|
||||
storage_partition: partition@79c000 {
|
||||
label = "storage";
|
||||
reg = <0x79C000 0x4000>;
|
||||
};
|
||||
/* LittleFS 384KB for DataStore (identity, prefs, contacts) */
|
||||
lfs_partition: partition@7a0000 {
|
||||
label = "lfs";
|
||||
reg = <0x7A0000 0x60000>;
|
||||
|
||||
@@ -64,14 +64,27 @@
|
||||
* 0x3B0000 - 0x3E0000 (192KB) LittleFS (identity, contacts, channels, BLE bonds)
|
||||
*/
|
||||
/delete-node/ &storage_partition;
|
||||
/delete-node/ &scratch_partition;
|
||||
|
||||
/ {
|
||||
chosen {
|
||||
zephyr,settings-partition = &storage_partition;
|
||||
};
|
||||
};
|
||||
|
||||
&flash0 {
|
||||
partitions {
|
||||
/* LittleFS 192KB for DataStore + file-based BLE settings */
|
||||
/* LittleFS 192KB for DataStore (identity, prefs, contacts) */
|
||||
lfs_partition: partition@3b0000 {
|
||||
label = "lfs";
|
||||
reg = <0x3B0000 0x30000>;
|
||||
};
|
||||
/* BLE bond store — 16KB NVS, isolated from /lfs (see esp32_common.conf).
|
||||
* Placed in the unused scratch region just above lfs (lfs unchanged). */
|
||||
storage_partition: partition@3e0000 {
|
||||
label = "storage";
|
||||
reg = <0x3E0000 0x4000>;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -86,20 +86,51 @@
|
||||
|
||||
/*
|
||||
* Flash partitions — repartition default ESP32-S3 16 MB layout.
|
||||
* Default storage_partition is 192 KB at 0xFB0000.
|
||||
* Delete unused partitions (lpcore, scratch, coredump) to reclaim space.
|
||||
*
|
||||
* 0xFA0000 - 0x1000000 (384KB) LittleFS (identity, contacts, channels, BLE bonds)
|
||||
* 0x7E0000 - 0xF9C000 (~7.7MB) OTA image-1 (slot1, trimmed 16KB)
|
||||
* 0xF9C000 - 0xFA0000 (16KB) NVS BLE bonds (storage_partition)
|
||||
* 0xFA0000 - 0x1000000 (384KB) LittleFS (identity, contacts, channels)
|
||||
*
|
||||
* Bonds live in the NVS storage_partition (isolated) instead of /lfs, so
|
||||
* settings-write churn can't corrupt identity/prefs/contacts. The NVS
|
||||
* region is carved from the end of slot1 (unused in the default simple-boot
|
||||
* build) so lfs_partition stays byte-identical — existing user data survives.
|
||||
*/
|
||||
/delete-node/ &slot0_lpcore_partition;
|
||||
/delete-node/ &slot1_lpcore_partition;
|
||||
/delete-node/ &storage_partition;
|
||||
/delete-node/ &scratch_partition;
|
||||
/delete-node/ &coredump_partition;
|
||||
/delete-node/ &slot0_partition;
|
||||
/delete-node/ &slot1_partition;
|
||||
|
||||
/ {
|
||||
chosen {
|
||||
zephyr,settings-partition = &storage_partition;
|
||||
};
|
||||
};
|
||||
|
||||
&flash0 {
|
||||
partitions {
|
||||
/* LittleFS 384KB for DataStore + file-based BLE settings */
|
||||
/* App slots — both trimmed 8KB so slot0 == slot1 (16KB total freed
|
||||
* for the NVS partition below), keeping MCUboot swap-mode compatible,
|
||||
* not just overwrite-only. slot0 start (0x20000) unchanged. */
|
||||
slot0_partition: partition@20000 {
|
||||
label = "image-0";
|
||||
reg = <0x20000 0x7BE000>;
|
||||
};
|
||||
slot1_partition: partition@7de000 {
|
||||
label = "image-1";
|
||||
reg = <0x7DE000 0x7BE000>;
|
||||
};
|
||||
/* BLE bond store — 16KB NVS, isolated from /lfs. label "storage"
|
||||
* so the existing formatter/factory-reset paths erase it too. */
|
||||
storage_partition: partition@f9c000 {
|
||||
label = "storage";
|
||||
reg = <0xF9C000 0x4000>;
|
||||
};
|
||||
/* LittleFS 384KB for DataStore (identity, prefs, contacts) */
|
||||
lfs_partition: partition@fa0000 {
|
||||
label = "lfs";
|
||||
reg = <0xFA0000 0x60000>;
|
||||
|
||||
@@ -30,6 +30,13 @@
|
||||
* but we leave them to avoid changing the partition map.
|
||||
*/
|
||||
/delete-node/ &storage_partition;
|
||||
/delete-node/ &scratch_partition;
|
||||
|
||||
/ {
|
||||
chosen {
|
||||
zephyr,settings-partition = &storage_partition;
|
||||
};
|
||||
};
|
||||
|
||||
&flash0 {
|
||||
partitions {
|
||||
@@ -38,6 +45,12 @@
|
||||
label = "lfs";
|
||||
reg = <0x3B0000 0x30000>;
|
||||
};
|
||||
/* BLE bond store — 16KB NVS, isolated from /lfs (see esp32_common.conf).
|
||||
* Placed in the unused scratch region just above lfs (lfs unchanged). */
|
||||
storage_partition: partition@3e0000 {
|
||||
label = "storage";
|
||||
reg = <0x3E0000 0x4000>;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -152,6 +152,13 @@
|
||||
* LittleFS, same as ttgo_lora32. The 4MB AMP layout keeps its MCUboot slots.
|
||||
*/
|
||||
/delete-node/ &storage_partition;
|
||||
/delete-node/ &scratch_partition;
|
||||
|
||||
/ {
|
||||
chosen {
|
||||
zephyr,settings-partition = &storage_partition;
|
||||
};
|
||||
};
|
||||
|
||||
&flash0 {
|
||||
partitions {
|
||||
@@ -160,6 +167,12 @@
|
||||
label = "lfs";
|
||||
reg = <0x3B0000 0x30000>;
|
||||
};
|
||||
/* BLE bond store — 16KB NVS, isolated from /lfs (see esp32_common.conf).
|
||||
* Placed in the unused scratch region just above lfs (lfs unchanged). */
|
||||
storage_partition: partition@3e0000 {
|
||||
label = "storage";
|
||||
reg = <0x3E0000 0x4000>;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -60,14 +60,27 @@
|
||||
* 0x3B0000 - 0x3E0000 (192KB) LittleFS (identity, contacts, channels, BLE bonds)
|
||||
*/
|
||||
/delete-node/ &storage_partition;
|
||||
/delete-node/ &scratch_partition;
|
||||
|
||||
/ {
|
||||
chosen {
|
||||
zephyr,settings-partition = &storage_partition;
|
||||
};
|
||||
};
|
||||
|
||||
&flash0 {
|
||||
partitions {
|
||||
/* LittleFS 192KB for DataStore + file-based BLE settings */
|
||||
/* LittleFS 192KB for DataStore (identity, prefs, contacts) */
|
||||
lfs_partition: partition@3b0000 {
|
||||
label = "lfs";
|
||||
reg = <0x3B0000 0x30000>;
|
||||
};
|
||||
/* BLE bond store — 16KB NVS, isolated from /lfs (see esp32_common.conf).
|
||||
* Placed in the unused scratch region just above lfs (lfs unchanged). */
|
||||
storage_partition: partition@3e0000 {
|
||||
label = "storage";
|
||||
reg = <0x3E0000 0x4000>;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -60,14 +60,27 @@
|
||||
* 0x3B0000 - 0x3E0000 (192KB) LittleFS (identity, contacts, channels, BLE bonds)
|
||||
*/
|
||||
/delete-node/ &storage_partition;
|
||||
/delete-node/ &scratch_partition;
|
||||
|
||||
/ {
|
||||
chosen {
|
||||
zephyr,settings-partition = &storage_partition;
|
||||
};
|
||||
};
|
||||
|
||||
&flash0 {
|
||||
partitions {
|
||||
/* LittleFS 192KB for DataStore + file-based BLE settings */
|
||||
/* LittleFS 192KB for DataStore (identity, prefs, contacts) */
|
||||
lfs_partition: partition@3b0000 {
|
||||
label = "lfs";
|
||||
reg = <0x3B0000 0x30000>;
|
||||
};
|
||||
/* BLE bond store — 16KB NVS, isolated from /lfs (see esp32_common.conf).
|
||||
* Placed in the unused scratch region just above lfs (lfs unchanged). */
|
||||
storage_partition: partition@3e0000 {
|
||||
label = "storage";
|
||||
reg = <0x3E0000 0x4000>;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -73,10 +73,35 @@
|
||||
/delete-node/ &storage_partition;
|
||||
/delete-node/ &scratch_partition;
|
||||
/delete-node/ &coredump_partition;
|
||||
/delete-node/ &slot0_partition;
|
||||
/delete-node/ &slot1_partition;
|
||||
|
||||
/ {
|
||||
chosen {
|
||||
zephyr,settings-partition = &storage_partition;
|
||||
};
|
||||
};
|
||||
|
||||
&flash0 {
|
||||
partitions {
|
||||
/* LittleFS 384KB for DataStore + file-based BLE settings */
|
||||
/* App slots — both trimmed 8KB so slot0 == slot1 (16KB total freed
|
||||
* for the NVS partition below), keeping MCUboot swap-mode compatible,
|
||||
* not just overwrite-only. slot0 start (0x20000) unchanged. */
|
||||
slot0_partition: partition@20000 {
|
||||
label = "image-0";
|
||||
reg = <0x20000 0x1BE000>;
|
||||
};
|
||||
slot1_partition: partition@1de000 {
|
||||
label = "image-1";
|
||||
reg = <0x1DE000 0x1BE000>;
|
||||
};
|
||||
/* BLE bond store — 16KB NVS, isolated from /lfs (see esp32_common.conf).
|
||||
* Carved from the end of slot1 so lfs stays byte-identical. */
|
||||
storage_partition: partition@39c000 {
|
||||
label = "storage";
|
||||
reg = <0x39C000 0x4000>;
|
||||
};
|
||||
/* LittleFS 384KB for DataStore (identity, prefs, contacts) */
|
||||
lfs_partition: partition@3a0000 {
|
||||
label = "lfs";
|
||||
reg = <0x3A0000 0x60000>;
|
||||
|
||||
Reference in New Issue
Block a user