Define partition on extern flash

Hi,

I'm using NCS 2.2.0 with on a Actinius Icarus Bee board. The board has an external flash w25q64 chip and I'm trying to place the storage partition on the external flash.

I have created an overlay file like this:

/delete-node/ &storage_partition;

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

		storage_partition: partition@0 {
			label = "storage";
			reg = <0x00000000 0x00040000>;
		};
	};
};

The partition does not show up when I create a list of flash areas.

Any idea how to configure this?

Thanks 

Andre

Parents
  • Hi Andre,

    I tried to add your configurations to the hello world sample, and I can see the storage partition in the devicetree after the build.
    How do you see that  the following?

    The partition does not show up when I create a list of flash areas.

    Do you have the Partition Manager enabled in your build?
    Maybe this overwrites your manual devicetree partitioning?

    Regards,
    Sigurd Hellesvik

  • Hi Sigurd

    here is the gist of what I'm doing. I lookup the storage partition in the device tree to print some data about it. In addition I iterate over all flash areas (that is probably redundant).

    #define STORAGE_PARTITION		storage_partition
    #define STORAGE_PARTITION_ID	FIXED_PARTITION_ID(STORAGE_PARTITION)
    
    void flash_area_cb(const struct flash_area *fa, void *user_data) {
    	LOG_INF("device name: %s id: %d offset: 0x%lx size:%d", fa->fa_dev->name, fa->fa_id, fa->fa_off, fa->fa_size);
    }
    
    void main(void) {
    
    	/* Lookup storage partition */
    	unsigned int partition_id = STORAGE_PARTITION_ID;
    	const struct flash_area *pfa;
    
    	int rc = flash_area_open(partition_id, &pfa);
    	if (rc != 0) {
    		LOG_ERR("Error opening flash area %d: %d", partition_id, rc);
    		return;
    	}
    
    	LOG_INF("storage_partition flash Area ID %u: %s @ 0x%x (size: %u bytes)", partition_id, 
    		pfa->fa_dev->name, (unsigned int)pfa->fa_off, (unsigned int)pfa->fa_size);
    
    	flash_area_close(pfa);
    
    
    	/* List of flash areas */
    	flash_area_foreach(&flash_area_cb, (void*) NULL);
    }
    

    Here is the output:

    [00:00:00.546,112] <inf> main: storage_partition flash Area ID 12: flash-controller@39000 @ 0xf8000 (size: 8192 bytes)
    [00:00:00.557,403] <inf> main: device name: flash-controller@39000 id: 0 offset: 0x0 size:49152
    [00:00:00.566,680] <inf> main: device name: flash-controller@39000 id: 1 offset: 0xc000 size:16384
    [00:00:00.576,202] <inf> main: device name: flash-controller@39000 id: 2 offset: 0x10000 size:512
    [00:00:00.585,662] <inf> main: device name: flash-controller@39000 id: 3 offset: 0x10000 size:458752
    [00:00:00.595,367] <inf> main: device name: flash-controller@39000 id: 4 offset: 0x10000 size:49664
    [00:00:00.604,980] <inf> main: device name: flash-controller@39000 id: 5 offset: 0x10200 size:458240
    [00:00:00.614,685] <inf> main: device name: flash-controller@39000 id: 6 offset: 0x10200 size:49152
    [00:00:00.624,328] <inf> main: device name: flash-controller@39000 id: 7 offset: 0x1c200 size:409088
    [00:00:00.634,033] <inf> main: device name: flash-controller@39000 id: 8 offset: 0x1c200 size:409088
    [00:00:00.643,737] <inf> main: device name: flash-controller@39000 id: 9 offset: 0x80000 size:458752
    [00:00:00.653,442] <inf> main: device name: flash-controller@39000 id: 10 offset: 0xf0000 size:32768
    [00:00:00.663,177] <inf> main: device name: flash-controller@39000 id: 11 offset: 0xf8000 size:8192
    [00:00:00.672,790] <inf> main: device name: flash-controller@39000 id: 12 offset: 0xf8000 size:8192
    [00:00:00.682,403] <inf> main: device name: flash-controller@39000 id: 13 offset: 0xfa000 size:24576

    I would expect the storage partition to use the w25q64 device but instead it used the flash-controller device.

    Also I'm deleting the original storage partition in my overlay file, this does not seem to have any effect.

    I can see in build/zephyr/include/generated/autoconf.h that the partition manager is enabled:

    CONFIG_PARTITION_MANAGER_ENABLED 1
    I'm not sure how the partition manager plays into this scenario, I need to read this up!
    Thanks
    Andre

Reply
  • Hi Sigurd

    here is the gist of what I'm doing. I lookup the storage partition in the device tree to print some data about it. In addition I iterate over all flash areas (that is probably redundant).

    #define STORAGE_PARTITION		storage_partition
    #define STORAGE_PARTITION_ID	FIXED_PARTITION_ID(STORAGE_PARTITION)
    
    void flash_area_cb(const struct flash_area *fa, void *user_data) {
    	LOG_INF("device name: %s id: %d offset: 0x%lx size:%d", fa->fa_dev->name, fa->fa_id, fa->fa_off, fa->fa_size);
    }
    
    void main(void) {
    
    	/* Lookup storage partition */
    	unsigned int partition_id = STORAGE_PARTITION_ID;
    	const struct flash_area *pfa;
    
    	int rc = flash_area_open(partition_id, &pfa);
    	if (rc != 0) {
    		LOG_ERR("Error opening flash area %d: %d", partition_id, rc);
    		return;
    	}
    
    	LOG_INF("storage_partition flash Area ID %u: %s @ 0x%x (size: %u bytes)", partition_id, 
    		pfa->fa_dev->name, (unsigned int)pfa->fa_off, (unsigned int)pfa->fa_size);
    
    	flash_area_close(pfa);
    
    
    	/* List of flash areas */
    	flash_area_foreach(&flash_area_cb, (void*) NULL);
    }
    

    Here is the output:

    [00:00:00.546,112] <inf> main: storage_partition flash Area ID 12: flash-controller@39000 @ 0xf8000 (size: 8192 bytes)
    [00:00:00.557,403] <inf> main: device name: flash-controller@39000 id: 0 offset: 0x0 size:49152
    [00:00:00.566,680] <inf> main: device name: flash-controller@39000 id: 1 offset: 0xc000 size:16384
    [00:00:00.576,202] <inf> main: device name: flash-controller@39000 id: 2 offset: 0x10000 size:512
    [00:00:00.585,662] <inf> main: device name: flash-controller@39000 id: 3 offset: 0x10000 size:458752
    [00:00:00.595,367] <inf> main: device name: flash-controller@39000 id: 4 offset: 0x10000 size:49664
    [00:00:00.604,980] <inf> main: device name: flash-controller@39000 id: 5 offset: 0x10200 size:458240
    [00:00:00.614,685] <inf> main: device name: flash-controller@39000 id: 6 offset: 0x10200 size:49152
    [00:00:00.624,328] <inf> main: device name: flash-controller@39000 id: 7 offset: 0x1c200 size:409088
    [00:00:00.634,033] <inf> main: device name: flash-controller@39000 id: 8 offset: 0x1c200 size:409088
    [00:00:00.643,737] <inf> main: device name: flash-controller@39000 id: 9 offset: 0x80000 size:458752
    [00:00:00.653,442] <inf> main: device name: flash-controller@39000 id: 10 offset: 0xf0000 size:32768
    [00:00:00.663,177] <inf> main: device name: flash-controller@39000 id: 11 offset: 0xf8000 size:8192
    [00:00:00.672,790] <inf> main: device name: flash-controller@39000 id: 12 offset: 0xf8000 size:8192
    [00:00:00.682,403] <inf> main: device name: flash-controller@39000 id: 13 offset: 0xfa000 size:24576

    I would expect the storage partition to use the w25q64 device but instead it used the flash-controller device.

    Also I'm deleting the original storage partition in my overlay file, this does not seem to have any effect.

    I can see in build/zephyr/include/generated/autoconf.h that the partition manager is enabled:

    CONFIG_PARTITION_MANAGER_ENABLED 1
    I'm not sure how the partition manager plays into this scenario, I need to read this up!
    Thanks
    Andre

Children
Related