error: 'PM_storage_log_ID' undeclared here (not in a function)

I am trying to create a partition on my external flash using littlefs

Here is the line that is returning me an error

FS_LITTLEFS_DECLARE_DEFAULT_CONFIG(storage);
static struct fs_mount_t lfs_storage_mnt = {
.type = FS_LITTLEFS,
.fs_data = &storage,
//.storage_dev = (void *)FIXED_PARTITION_ID(storage_log),
.storage_dev = (void *)FLASH_AREA_ID(storage_log),

.mnt_point = "/lfs",
};

Here is the error I am receiving

r/src/main.c.obj -MF CMakeFiles/app.dir/src/main.c.obj.d -o CMakeFiles/app.dir/src/main.c.obj -c project/app/src/main.c
In file included from /home/marlon/ncs/v2.6.0/zephyr/include/zephyr/storage/flash_map.h:275,
                 from /home/marlon/ncs/v2.6.0/zephyr/include/zephyr/fs/littlefs.h:12,
                 from project/app/src/main.c:344:
/home/marlon/ncs/v2.6.0/nrf/include/flash_map_pm.h:43:22: error: 'PM_storage_log_ID' undeclared here (not in a function)
   43 | #define PM_ID(label) PM_##label##_ID
      |                      ^~~
/home/marlon/ncs/v2.6.0/nrf/include/flash_map_pm.h:43:22: note: in definition of macro 'PM_ID'
   43 | #define PM_ID(label) PM_##label##_ID
      |                      ^~~
/home/marlon/ncs/v2.6.0/nrf/include/flash_map_pm.h:49:30: note: in expansion of macro 'FIXED_PARTITION_ID'
   49 | #define FLASH_AREA_ID(label) FIXED_PARTITION_ID(label)
      |                              ^~~~~~~~~~~~~~~~~~
project/app/src/main.c:366:28: note: in expansion of macro 'FLASH_AREA_ID'
  366 |     .storage_dev = (void *)FLASH_AREA_ID(storage_log),
      |                            ^~~~~~~~~~~~~
project/app/src/main.c:362:26: warning: 'lfs_storage_mnt' defined but not used [-Wunused-variable]
  362 | static struct fs_mount_t lfs_storage_mnt = {
      |                          ^~~~~~~~~~~~~~~

WHen hovering over FLASH_AREA_ID, I have this message

identifier "PM_storage_log_ID" is undefinedC/C++(20)
#define FLASH_AREA_ID(label) FIXED_PARTITION_ID(label)

Expands to:

PM_storage_log_ID

(I have basically the same error if I use FIXED_PARTITION_ID)

This is the relevant part of my dts

&qspi {
status = "okay";
pinctrl-0 = <&qspi_default>;
pinctrl-1 = <&qspi_sleep>;
pinctrl-names = "default", "sleep";

external_flash: w25q128jv@0 {
compatible = "nordic,qspi-nor";
reg = <0>;
jedec-id = [ ef 40 18 ];
writeoc = "pp4o";
readoc = "read4io";
sck-frequency = <8000000>;
size-in-bytes = <16777216>; // 16 MB total

partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;

storage_log: partition@0 {
label = "storage_log";
reg = <0x00000000 0x00200000>;
};

external_data: partition@200000 {
label = "external_data";
reg = <0x00200000 0x00E00000>;
};
};
};
};

and this is the relevant part on my pm_static.yml

sram_primary:
address: 0x20000000
end_address: 0x20038000
region: sram_primary
size: 0x38000

volatile_app_data:
address: 0x20038000
end_address: 0x20040000
placement:
before:
- end
region: sram_primary
size: 0x8000


external_flash:
address: 0x08000000
region: external_flash
size: 0x1000000 # 16 MB
placement:
storage_log:
offset: 0x00000000
size: 0x00200000
external_data:
offset: 0x00200000
size: 0x00E00000

Related