This commit is contained in:
2026-05-11 12:18:14 +02:00
parent 5d20d2820a
commit fca4aeb115
7 changed files with 27 additions and 16 deletions

View File

@@ -1,5 +1,6 @@
#include <zephyr/fs/littlefs.h>
#include <zephyr/fs/fs.h>
#include <zephyr/storage/flash_map.h>
#include <zephyr/sys/byteorder.h>
#include <zephyr/logging/log.h>
#include <zephyr/pm/device.h>
@@ -11,7 +12,14 @@
LOG_MODULE_REGISTER(fs_mgmt, CONFIG_FS_MGMT_LOG_LEVEL);
#define FS_PARTITION_ID FLASH_AREA_ID(littlefs_storage)
/* Prefer external LittleFS partition when present, otherwise internal storage partition. */
#if DT_NODE_EXISTS(DT_NODELABEL(ext_flash_lfs))
#define FS_PARTITION_ID FIXED_PARTITION_ID(ext_flash_lfs)
#elif DT_NODE_EXISTS(DT_NODELABEL(storage_partition))
#define FS_PARTITION_ID FIXED_PARTITION_ID(storage_partition)
#else
#error "No compatible LittleFS partition node label found (expected ext_flash_lfs or storage_partition)"
#endif
FS_LITTLEFS_DECLARE_DEFAULT_CONFIG(fs_storage_data);
#define EXTERNAL_FLASH_NODE DT_ALIAS(external_flash)