This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

nrf52840 + littlefs(external flash) +mcuboot can't set mounted area(qspi + mx25r64 is ok)

Hello

Happy Christmas in advance.

I meet a trouble about using littlefs and mcuboot at nrf52840dk.

ncs1.7.1

project:littlefs

I have changed the nrf52840dk_nrf52840.overlay file

/*
 * Copyright (c) 2019 Peter Bigot Consulting, LLC
 *
 * SPDX-License-Identifier: Apache-2.0
 */

/delete-node/ &storage_partition;

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

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

&spi3 {
	compatible = "nordic,nrf-spim";
	status = "okay";
	sck-pin = <28>;
	mosi-pin = <26>;
	miso-pin = <24>;
	cs-gpios = <&gpio0 30 GPIO_ACTIVE_LOW>;

	FM25Q08B:FM25Q08B@0 {
		compatible = "jedec,spi-nor";
		reg = <0>;
		spi-max-frequency = <0x400000>;
        label = "FM25Q08B";
        jedec-id = [ C2 20 18 ];
        size = < 0x8000000 >;
		partitions {
			compatible = "fixed-partitions";
			#address-cells = <1>;
			#size-cells = <1>;
	
			lfs1_part: partition@0 {
				label = "storage";
				reg = <0x00000000 0x00200000>;
			};
		};		
	};
};

&i2c0 {
	status = "disabled";
};
&i2c1 {
	status = "disabled";
};
&spi1 {
	status = "disabled";
};
&spi2 {
	status = "disabled";
};
&spi0 {
	status = "disabled";
};
&qspi {
	status = "disabled";
};
&uart0 {
	status = "disabled";
};
&uart1 {
	status = "disabled";
};
&usbd {
	status = "disabled";
};
&led0 {
	status = "disabled";
};
&led1 {
	status = "disabled";
};
&led2 {
	status = "disabled";
};
&led3 {
	status = "disabled";
};
&pwm_led0 {
	status = "disabled";
};
&button0 {
	status = "disabled";
};
&button1 {
	status = "disabled";
};
&button2 {
	status = "disabled";
};
&button3 {
	status = "disabled";
};
&arduino_header {
	status = "disabled";
};

nrf52840dk_nrf52840.conf

#
# Copyright (c) 2019 Peter Bigot Consulting, LLC
# Copyright (c) 2019 Nordic Semiconductor ASA
#
# SPDX-License-Identifier: Apache-2.0
#

# Need this when storage is on flash
CONFIG_MPU_ALLOW_FLASH_WRITE=y

# Need this when storage is on MX25R64
# CONFIG_NORDIC_QSPI_NOR=y
# CONFIG_NORDIC_QSPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096
CONFIG_SPI=y
CONFIG_SPI_NOR=y

add pm_static.yml

external_flash:
  address: 0x0
  end_address: 0x1000000
  region: external_flash
  size: 0x1000000
littlefs_storage:
  address: 0x0
  device: FM25Q08B
  region: external_flash
  size: 0x20000

But I got wrong address I wanted.

Can you give me some advice?  thank you.

littlefs.zip

Parents
  • Hi

    You should try checking what the print gets this value from, and try making sure that this value is gotten from the correct size call from the .yml file. I'm guessing the confusion comes from both the defines are called size. One might have to be renamed to "size_2" or something along those lines.

    Best regards,

    Simon

    PS: The Holiday season is upon us, which will leave the Nordic support team understaffed until January 3rd, 2022. This means that delayed replies will occur during this time. Sorry about the inconvenience and happy Holiday

Reply
  • Hi

    You should try checking what the print gets this value from, and try making sure that this value is gotten from the correct size call from the .yml file. I'm guessing the confusion comes from both the defines are called size. One might have to be renamed to "size_2" or something along those lines.

    Best regards,

    Simon

    PS: The Holiday season is upon us, which will leave the Nordic support team understaffed until January 3rd, 2022. This means that delayed replies will occur during this time. Sorry about the inconvenience and happy Holiday

Children
  • Hi

    I have found the reason.

    When I use external flash the flash area open id always 0, but I am using pm_static.yml external_flash is the id is 0 littlefs_storage id is 1, so #define PARTITION_NODE DT_NODELABEL(lfs1) may have some problems we can use another way and chose right lable.

    lable: storage

    FS_LITTLEFS_DECLARE_DEFAULT_CONFIG(storage);
    static struct fs_mount_t lfs_storage_mnt = {
    	.type = FS_LITTLEFS,
    	.fs_data = &storage,
    	.storage_dev = (void *)FLASH_AREA_ID(storage),
    	.mnt_point = "/lfs",
    };

Related