MCUboot with partition foo

I want to use mcuboot together with LittleFS/NVS and a custom partition foo with my own flash storage routines. It works as long CONFIG_BOOTLOADER_MCUBOOT=n. 

But with CONFIG_BOOTLOADER_MCUBOOT=y it does not recognise the foo partition. In contrast, it does with the usual partitions like storage

#if DT_HAS_FIXED_PARTITION_LABEL(foo)
  #define FLASH_TEST_ID DT_FIXED_PARTITION_ID(foo)
  #define FLASH_TEST_OFFSET FLASH_AREA_OFFSET(FLASH_TEST_ID)
  #define FLASH_TEST_SIZE FLASH_AREA_SIZE(FLASH_TEST_ID)
#else
  #error "foo" partition is not defined
#endif

In devicetree_unfixed.h there is no difference between foo and storage. In the pm_config.h the are only entries for storage but none for foo. That seems to be the root of the problem.

#define PM_LITTLEFS_STORAGE_OFFSET 0xfa000
#define PM_LITTLEFS_STORAGE_ADDRESS 0xfa000
#define PM_LITTLEFS_STORAGE_END_ADDRESS 0x100000
#define PM_LITTLEFS_STORAGE_SIZE 0x6000
#define PM_LITTLEFS_STORAGE_NAME littlefs_storage
#define PM_LITTLEFS_STORAGE_ID 7
#define PM_littlefs_storage_ID PM_LITTLEFS_STORAGE_ID
#define PM_littlefs_storage_IS_ENABLED 1

In the dts is following definition

&flash0 {

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

		boot_partition: partition@0 {
			label = "mcuboot";
			reg = <0x000000000 0x0000C000>;
		};
		slot0_partition: partition@c000 {
			label = "image-0";
			reg = <0x0000C000 0x00067000>;
		};
		slot1_partition: partition@73000 {
			label = "image-1";
			reg = <0x00073000 0x00067000>;
		};
		scratch_partition: partition@da000 {
			label = "image-scratch";
			reg = <0x000da000 0x0001c000>;
		};

		/*
		 * Foo partion to experiment with dedicated storage
		 */
		foo_partition: partition@ea000 {
			label = "foo";
			reg = <0x000ea000 0x00002000>;
		};

		/*
		 * Storage partition will be used by FCB/LittleFS/NVS
		 * if enabled.
		 */
		storage_partition: partition@85000 {
			label = "storage";
			reg = <0x00085000 0x00008000>;
		};
	};
};

What can I configure to get the foo partition to pm_config.h?

Do I have to use pm_static.yml even with the partitions defined in the dts file? I do not use pm_static.yml yet. 

Related