HI
I am using the NCS 3.0.0 SDK and want to use FCB to store sensor data only in external flash.
Therefore, I added external flash to the pm_static.yaml file in the project, along with some internal RRAM partitions for MCUboot and OTA.
external_storage: address: 0x0 region: external_flash size: 0x800000
And in the project's overlay file, I added:
/ {
chosen {
nordic,pm-ext-flash = &mx25r64;
};
};
After performing a pristine build, the memory report shows the external_flash partition, and external_storage also exists. Then, I called:
int rc = flash_area_open(FLASH_AREA_ID(external_storage), &log_fa); if (rc) { printk("flash no device\n"); return -ENODEV; }
But I found that the external_storage partition cannot be found. Using:
for (int i = 0; i < flash_map_entries; i++) { printk("Entry %d: ID=%d, Device=%s, Offset=0x%x, Size=0x%x\n", i, flash_map[i].fa_id, flash_map[i].fa_dev ? flash_map[i].fa_dev->name : "NULL", flash_map[i].fa_off, flash_map[i].fa_size); k_sleep(K_MSEC(1000)); }
to print all partitions, I still don't see external_storage.
-
What is the issue here?
-
I opened the pm_config.h file and found:
#define PM_EXTERNAL_STORAGE_OFFSET 0x0 #define PM_EXTERNAL_STORAGE_ADDRESS 0x0 #define PM_EXTERNAL_STORAGE_END_ADDRESS 0x800000 #define PM_EXTERNAL_STORAGE_SIZE 0x800000 #define PM_EXTERNAL_STORAGE_NAME external_storage #define PM_EXTERNAL_STORAGE_ID 0 #define PM_external_storage_ID PM_EXTERNAL_STORAGE_ID #define PM_external_storage_IS_ENABLED 1 #define PM_0_LABEL EXTERNAL_STORAGE #define PM_EXTERNAL_STORAGE_DEV DT_CHOSEN(nordic_pm_ext_flash) #define PM_EXTERNAL_STORAGE_DEFAULT_DRIVER_KCONFIG CONFIG_NORDIC_QSPI_NOR
This partition does exist, but I noticed that in:
const struct flash_area default_flash_map[] = { FLASH_MAP_PM_LIST };
The FLASH_MAP_PM_LIST needs to add elements based on PM_EXTERNAL_STORAGE_DEFAULT_DRIVER_KCONFIG. Does CONFIG_NORDIC_QSPI_NOR need to be defined? I defined CONFIG_NORDIC_QSPI_NOR = y, but after compilation, it actually shows as n. How should I add it? Also, if my flash doesn't support QSPI, will defining this cause problems?
Thanks!