From ae47c5a062fd7919ec27644c4db2ea2bdbdebe6b Mon Sep 17 00:00:00 2001 From: liquidraver <504870+liquidraver@users.noreply.github.com> Date: Mon, 9 Mar 2026 12:58:59 +0100 Subject: [PATCH] update all boards with storage revert --- zephcore/ARCHITECTURE.md | 23 +++++++++++++----- .../esp32/lilygo_tlora_c6/board.overlay | 24 ++++++------------- .../boards/esp32/station_g2/board.overlay | 16 ++++--------- .../boards/esp32/xiao_esp32c3/board.overlay | 16 ++++--------- .../boards/esp32/xiao_esp32c6/board.overlay | 16 ++++--------- .../boards/nrf54l/xiao_nrf54l15/board.overlay | 19 ++++----------- 6 files changed, 43 insertions(+), 71 deletions(-) diff --git a/zephcore/ARCHITECTURE.md b/zephcore/ARCHITECTURE.md index 56b74b2..6844104 100644 --- a/zephcore/ARCHITECTURE.md +++ b/zephcore/ARCHITECTURE.md @@ -357,8 +357,9 @@ Power: `powersaving on/off` ### 7.2 DataStore (`adapters/datastore/`) -- **Internal**: LittleFS on flash (`/lfs`) +- **Internal**: LittleFS on flash (`/lfs`), 256-byte cache for reduced flash I/O - **External**: Optional LittleFS on QSPI (`/ext`) with auto-migration +- **BLE bonds**: File-based settings on LittleFS (`/lfs/settings/`) — all platforms (no NVS) - **Prefs**: 93-byte binary format, Arduino-compatible, field-by-field I/O - **Contacts**: 152-byte records, stored on external flash if available - **Channels**: 68-byte records (4 pad + 32 name + 32 secret) @@ -381,7 +382,7 @@ Power: `powersaving on/off` ### 7.5 Board (`adapters/board/`) -- Battery ADC with optional regulator-gated voltage divider, 8-sample average +- Battery ADC with optional regulator-gated voltage divider, 8-sample average (boards with `zephyr,user` ADC node; MG24 has no battery divider, ADC disabled) - UF2 bootloader entry via GPREGRET magic (0x57 = UF2, 0xA8 = BLE DFU) - TX LED bracketing for LoRa transmissions - Bootloader version detection via flash memory scan @@ -442,7 +443,14 @@ prj.conf (base: console, logging) - **Radio**: `ZEPHCORE_RADIO_NATIVE` (SX126x, default) vs `ZEPHCORE_RADIO_LR1110` - **Features**: Display, buzzer, buttons, multi-tap, Doom (auto-enabled from DT) -### 9.3 Patches +### 9.3 Platform Notes + +- **nRF52840**: Zephyr open-source BLE controller, UF2 bootloader, partial flash erase for BLE coexistence +- **nRF54L15**: Same BLE controller as nRF52, CMSIS-DAP via SAMD11 bridge, no native USB +- **ESP32**: Espressif proprietary BLE blob, 32KB heap, asserts disabled (blob IRQ false positives) +- **EFR32MG24**: SiLabs proprietary BLE blob, 32KB heap, SEMAILBOX enabled for hardware TRNG/crypto entropy, ADC disabled (no battery divider), CMSIS-DAP via onboard SAMD11 + +### 9.4 Patches | Patch | Risk | Purpose | |-------|------|---------| @@ -451,12 +459,14 @@ prj.conf (base: console, logging) | 0005-gnss-air530z-easy | MEDIUM | EASY ephemeris + removes PM (prevents deadlocks) | | 0006-blobs-py | LOW | Fix `west blobs fetch` KeyError | -### 9.4 Flash Partition Layouts +### 9.5 Flash Partition Layouts **nRF52840 SD v6**: SoftDevice 152KB → App 696KB → LFS 128KB → UF2 48KB **nRF52840 SD v7**: SoftDevice 156KB → App 692KB → LFS 128KB → UF2 48KB -**ESP32 (4MB)**: Boot + App → NVS 8KB → LFS 184KB -**nRF54L15**: MCUboot 64KB → App 1272KB → NVS 8KB → LFS 84KB +**ESP32 (4MB)**: Boot + App → LFS 192KB +**ESP32-S3 (16MB)**: Boot + App → LFS 384KB +**nRF54L15**: MCUboot 64KB → App 1272KB → LFS 92KB +**EFR32MG24**: MCUboot 48KB → App 1344KB → LFS 144KB --- @@ -573,6 +583,7 @@ Over USB CDC: V3 framing: `[2B LE length] [1B opcode] [payload...]` | `/lfs/adv_blobs` or `/ext/adv_blobs` | Advert cache | Fixed-size blob records | | `/lfs/repeater/acl` | Client ACL | 136B × N records | | `/lfs/repeater/regions2` | Region map | Header + 164B × N entries | +| `/lfs/settings/` | BLE bonds + Zephyr settings | File-based settings (all platforms) | ### Preferences Binary Layout (93 bytes) diff --git a/zephcore/boards/esp32/lilygo_tlora_c6/board.overlay b/zephcore/boards/esp32/lilygo_tlora_c6/board.overlay index 897dca4..1756939 100644 --- a/zephcore/boards/esp32/lilygo_tlora_c6/board.overlay +++ b/zephcore/boards/esp32/lilygo_tlora_c6/board.overlay @@ -20,10 +20,6 @@ led0 = &user_led; }; - chosen { - zephyr,settings-partition = &storage_partition; - }; - leds { compatible = "gpio-leds"; user_led: led_0 { @@ -62,25 +58,19 @@ }; /* - * Flash partitions — split default storage into NVS + LittleFS. - * Standard ESP32 4MB layout: - * 0x3B0000 - 0x3B2000 (8KB) NVS (BLE bonds) - * 0x3B2000 - 0x3E0000 (184KB) LittleFS (identity, contacts) + * Flash partitions — repartition default ESP32 layout. + * Default storage_partition is 192KB at 0x3B0000. + * + * 0x3B0000 - 0x3E0000 (192KB) LittleFS (identity, contacts, channels, BLE bonds) */ /delete-node/ &storage_partition; &flash0 { partitions { - /* NVS 8KB for BLE bonds + settings */ - storage_partition: partition@3b0000 { - label = "storage"; - reg = <0x3B0000 0x2000>; - }; - - /* LittleFS 184KB for DataStore */ - lfs_partition: partition@3b2000 { + /* LittleFS 192KB for DataStore + file-based BLE settings */ + lfs_partition: partition@3b0000 { label = "lfs"; - reg = <0x3B2000 0x2E000>; + reg = <0x3B0000 0x30000>; }; }; }; diff --git a/zephcore/boards/esp32/station_g2/board.overlay b/zephcore/boards/esp32/station_g2/board.overlay index 8d11f86..8b8174e 100644 --- a/zephcore/boards/esp32/station_g2/board.overlay +++ b/zephcore/boards/esp32/station_g2/board.overlay @@ -21,7 +21,6 @@ }; chosen { - zephyr,settings-partition = &storage_partition; zephyr,display = &oled; }; @@ -89,7 +88,8 @@ * 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. - * Split into: NVS 8 KB (BLE bonds) + LittleFS 376 KB (DataStore). + * + * 0xFA0000 - 0x1000000 (384KB) LittleFS (identity, contacts, channels, BLE bonds) */ /delete-node/ &slot0_lpcore_partition; /delete-node/ &slot1_lpcore_partition; @@ -99,16 +99,10 @@ &flash0 { partitions { - /* NVS 8 KB for BLE bonds + settings */ - storage_partition: partition@fa0000 { - label = "storage"; - reg = <0xFA0000 0x2000>; - }; - - /* LittleFS 376 KB for DataStore (identity, contacts, channels, etc.) */ - lfs_partition: partition@fa2000 { + /* LittleFS 384KB for DataStore + file-based BLE settings */ + lfs_partition: partition@fa0000 { label = "lfs"; - reg = <0xFA2000 0x5E000>; + reg = <0xFA0000 0x60000>; }; }; }; diff --git a/zephcore/boards/esp32/xiao_esp32c3/board.overlay b/zephcore/boards/esp32/xiao_esp32c3/board.overlay index c9b39b4..a826d04 100644 --- a/zephcore/boards/esp32/xiao_esp32c3/board.overlay +++ b/zephcore/boards/esp32/xiao_esp32c3/board.overlay @@ -23,7 +23,6 @@ chosen { zephyr,console = &usb_serial; zephyr,shell-uart = &usb_serial; - zephyr,settings-partition = &storage_partition; }; }; @@ -57,22 +56,17 @@ /* * Flash partitions — repartition default ESP32 layout. * Default storage_partition is 192KB at 0x3B0000. - * Split into: NVS 8KB (BLE bonds) + LittleFS 184KB (identity, contacts, etc.) + * + * 0x3B0000 - 0x3E0000 (192KB) LittleFS (identity, contacts, channels, BLE bonds) */ /delete-node/ &storage_partition; &flash0 { partitions { - /* NVS 8KB for BLE bonds + settings */ - storage_partition: partition@3b0000 { - label = "storage"; - reg = <0x3B0000 0x2000>; - }; - - /* LittleFS 184KB for DataStore */ - lfs_partition: partition@3b2000 { + /* LittleFS 192KB for DataStore + file-based BLE settings */ + lfs_partition: partition@3b0000 { label = "lfs"; - reg = <0x3B2000 0x2E000>; + reg = <0x3B0000 0x30000>; }; }; }; diff --git a/zephcore/boards/esp32/xiao_esp32c6/board.overlay b/zephcore/boards/esp32/xiao_esp32c6/board.overlay index 4e701b0..9e7a1b3 100644 --- a/zephcore/boards/esp32/xiao_esp32c6/board.overlay +++ b/zephcore/boards/esp32/xiao_esp32c6/board.overlay @@ -23,7 +23,6 @@ chosen { zephyr,console = &usb_serial; zephyr,shell-uart = &usb_serial; - zephyr,settings-partition = &storage_partition; }; }; @@ -57,22 +56,17 @@ /* * Flash partitions — repartition default ESP32 layout. * Default storage_partition is 192KB at 0x3B0000. - * Split into: NVS 8KB (BLE bonds) + LittleFS 184KB (identity, contacts, etc.) + * + * 0x3B0000 - 0x3E0000 (192KB) LittleFS (identity, contacts, channels, BLE bonds) */ /delete-node/ &storage_partition; &flash0 { partitions { - /* NVS 8KB for BLE bonds + settings */ - storage_partition: partition@3b0000 { - label = "storage"; - reg = <0x3B0000 0x2000>; - }; - - /* LittleFS 184KB for DataStore */ - lfs_partition: partition@3b2000 { + /* LittleFS 192KB for DataStore + file-based BLE settings */ + lfs_partition: partition@3b0000 { label = "lfs"; - reg = <0x3B2000 0x2E000>; + reg = <0x3B0000 0x30000>; }; }; }; diff --git a/zephcore/boards/nrf54l/xiao_nrf54l15/board.overlay b/zephcore/boards/nrf54l/xiao_nrf54l15/board.overlay index f5ee864..b852181 100644 --- a/zephcore/boards/nrf54l/xiao_nrf54l15/board.overlay +++ b/zephcore/boards/nrf54l/xiao_nrf54l15/board.overlay @@ -20,10 +20,6 @@ aliases { lora0 = &lora; }; - - chosen { - zephyr,settings-partition = &storage_partition; - }; }; /* Disable I2C22 — default pins P1.10/P1.11 (D4/D5) conflict with NSS/RXEN */ @@ -67,8 +63,7 @@ * * 0x00000 - 0x10000 (64KB) MCUboot (reserved, even if unused) * 0x10000 - 0x14E000 (1272KB) Application (slot0 — expanded into slot1 space) - * 0x14E000 - 0x150000 (8KB) NVS storage (BLE bonds) — 2 sectors × 4KB - * 0x150000 - 0x165000 (84KB) LittleFS (identity, contacts, channels) + * 0x14E000 - 0x165000 (92KB) LittleFS (identity, contacts, channels, BLE bonds) */ /delete-node/ &slot0_partition; /delete-node/ &slot1_partition; @@ -82,16 +77,10 @@ reg = <0x10000 0x13E000>; /* 1272KB */ }; - /* NVS 8KB for BLE bonds + settings (2 × 4KB sectors) */ - storage_partition: partition@14e000 { - label = "storage"; - reg = <0x14E000 0x2000>; - }; - - /* LittleFS 84KB for DataStore */ - lfs_partition: partition@150000 { + /* LittleFS 92KB for DataStore + file-based BLE settings */ + lfs_partition: partition@14e000 { label = "lfs"; - reg = <0x150000 0x15000>; + reg = <0x14E000 0x17000>; }; }; };