Little FS configured to mount on the external flash gets mounted in the internal flash

Hi,

I'm currently working with a nrf6191 on a custom board using Zephyr and I would like to use little FS as my file system.

So far I've set the configuration and overlay for it to work on the external flash, but whenever I start the program, and I write whatever logs which should be saved using littlefs are located in the internal flash. I can see that it is on the internal flash because whenever I erase and program the same FW version again, the file is not present anymore.

Another test I ran was to directly read the external flash, where I could see that there were no logs.

My overlay is the following one:

/delete-node/ &storage_partition;

&spi_main {
    ext_flash: w25q16@1 {
        compatible = "jedec,spi-nor";
        status = "okay";
        reg = <1>;
        spi-max-frequency = <800000>;
        size = <16777216>;
        has-dpd;
        t-enter-dpd = <10000>;
        t-exit-dpd = <35000>;
    };
};

&ext_flash{
    partitions {
        compatible = "fixed-partitions";
        #address-cells = <1>;
        #size-cells = <1>;
        lfs1_part: partition@D0000{
            label = "littlefs_storage";
            reg = <0x000D0000 0x00130000>;
        };
    };
};

/{
    fstab{
        compatible = "zephyr,fstab";
        lfs1: lfs1{
            compatible = "zephyr,fstab,littlefs";
            mount-point="/lfs1";
            partition=<&lfs1_part>;
            automount;
            read-size = <256>;      
            prog-size = <256>;      
            cache-size = <512>;    
            lookahead-size = <128>;
            block-cycles = <512>;
        };
    };

    chosen {
        nordic,pm-ext-flash = &ext_flash;
    };
};

And my configuration is as it follows:

#File System Configuration
CONFIG_FILE_SYSTEM=y
CONFIG_FILE_SYSTEM_LITTLEFS=y
CONFIG_FILE_SYSTEM_SHELL=y
CONFIG_FS_LITTLEFS_FC_HEAP_SIZE=8192

#Flash necessary configs
CONFIG_SPI=y
CONFIG_SPI_NOR=y
CONFIG_SPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096

CONFIG_FLASH=y
CONFIG_FLASH_MAP=y
CONFIG_FLASH_PAGE_LAYOUT=y


CONFIG_IOTVEN_CEUQ_LITTLEFS=y
CONFIG_IOTVEN_CEUQ_LITTLEFS_SHELL_COMMANDS=y
CONFIG_IOTVEN_CEUQ_LITTLEFS_MANUAL_MOUNTING=y

CONFIG_SHELL=y
CONFIG_SHELL_BACKENDS=y
CONFIG_SHELL_BACKEND_SERIAL=y

I'm setting the littlefs partition so far behind in the memory because I am reserving the addresses from 0x00000000 to 0x000C0000 for the secondary to update, and so far that has worked.

When I write the .bin file I download through HTTP on the external flash on the region I declare in:

mcuboot_secondary:
  region: external_flash
  address: 0x00000
  size: 0xc0000

It gets written and when I reset it gets updated, therefore I know that the external flash gets recognized.

My external flash is a EN25QH128A whose size is 16MB. I am setting this size because of another custom board that only has 2MB, so the system will be compatible.

So far I got that the littlefs system has worked, but only on the internal flash.

I'm probably missing something on the configuration or while mounting (although I have automount active).

Thank you very much in advance for your help.

Best regards,

Daniel Ovejero Trigo 

Related