Hi,
We are developing application software on the nrf9161dk that uses the little FS file system running on external FLASH. Most of the application development has been completed using NCS v2.4.0, and we are now porting the application to NCS v2.8.0.
Our application builds successfully, but when we attempt to open the FLASH file system using flash_area_open(), it returns with -2 (-ENOENT) indicating that it cannot find the partition. I have checked that the partition is properly defined in the device tree, but for some reason it is not placed in the default_flash_map defined in zephyr/subsys/storage/flash_map/flash_map_default.c.
I have duplicated this failure using spi_flash_test application privided in this ticket: nRF5340-DK: Partition Manager for external flash
To make this example work with the nrf9161dk board, I added a nrf9161dk_nrf9161.conf file in the spi_flash_test/boards folder:
# # Copyright (c) 2020 Nordic Semiconductor ASA # # SPDX-License-Identifier: Apache-2.0 # # nriedel update for nrf9161 CONFIG_FLASH=y CONFIG_FLASH_MAP=y CONFIG_FLASH_PAGE_LAYOUT=y CONFIG_FILE_SYSTEM=y CONFIG_FILE_SYSTEM_LITTLEFS=y CONFIG_PM_PARTITION_SIZE_LITTLEFS=0x10000 CONFIG_SPI=y CONFIG_SPI_NOR=y CONFIG_SPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096
I also added a device tree overlay file nrf9161dk_nrf9161.overlay:
/ { chosen { nordic,pm-ext-flash = &gd25wb256; }; // nriedel add: aliases { spi-flash0 = &gd25wb256; }; }; &gd25wb256 { status = "okay"; partitions { compatible = "fixed-partitions"; #address-cells = <1>; #size-cells = <1>; lfs_part1: partition@0 { label = "littlefs_storage"; reg = <0x00000000 0x1e84800>; }; }; };
I build normally:
west build -b nrf9161dk
Running the code on the nrf9161dk I get:
*** Booting nRF Connect SDK v2.8.0-a2386bfc8401 *** *** Using Zephyr OS v3.7.99-0bc3393fb112 *** gd25wb256e3ir@1 SPI flash testing ========================== Perform test on single sector Test 1: Flash erase Failed to retreive flash partition information -2
The full source for this modified version of the spi_flash_test application is attached.