NCS v3.4.0 (DTS-based partitioning): How to place MCUboot secondary slot in external flash without Partition Manager?

Hi,

I am using NCS v3.4.0 with the following setup:

  • Board: nrf7002dk/nrf5340/cpuapp/ns
  • SDK version: NCS v3.4.0

I have two related questions:


Issue 1: MCUboot secondary slot in external flash without Partition Manager

Since NCS v3.4.0 deprecates Partition Manager in favor of DTS-based partitioning, I am trying to migrate my project accordingly.

However, I need to place the MCUboot secondary slot in external flash, and the Kconfig option SB_CONFIG_PM_EXTERNAL_FLASH_MCUBOOT_SECONDARY=y depends on PARTITION_MANAGER, so it cannot be used without Partition Manager:

SB_CONFIG_PM_EXTERNAL_FLASH_MCUBOOT_SECONDARY was assigned the value y, but got the value n. Missing dependencies: PARTITION_MANAGER

Could you please tell me how to place the MCUboot secondary slot in external flash using DTS-based partitioning instead of Partition Manager?


Issue 2: Memory Report Partitions tab missing in VS Code

Since migrating to DTS-based partitioning in NCS v3.4.0, the Partitions tab is no longer shown in the nRF Connect for VS Code Memory Report.

I have confirmed that:

  • partitions.yml is not generated in the build directory
  • Running west build -t partition_manager_report results in:
    ninja: error: unknown target 'partition_manager_report'

This confirms that Partition Manager is completely disabled in my project. Is the Partitions tab in Memory Report planned to be updated to support DTS-based partitioning?


Thank you!

Parents
  • Hi,

    In the migration notes there are some helpful tools that can convert an existing partition-manager project into a dts based project: https://nrfconnectdocs.nordicsemi.com/ncs/latest/nrf/releases_and_maturity/migration/migration_partitions.html#migrate-your-project-to-dts-partitioning 

    Could you please tell me how to place the MCUboot secondary slot in external flash using DTS-based partitioning instead of Partition Manager?

    Here's a sample dts from the nrf for desktop sample that shows how to configure the internal and external flash in DTS

    /* In your board overlay or memory_map.dtsi */
    
    / {
        chosen {
            nordic,pm-ext-flash = &mx25r64;
        };
    };
    
    /* Internal flash partitions */
    &flash0 {
        partitions {
            compatible = "fixed-partitions";
            #address-cells = <1>;
            #size-cells = <1>;
    
            boot_partition: partition@0 {
                label = "mcuboot";
                reg = <0x00000000 0x0000c000>;
            };
    
            slot0_partition: partition@c000 {
                label = "image-0";
                reg = <0x0000c000 0x00076000>;
            };
    
            storage_partition: partition@f8000 {
                label = "storage";
                reg = <0x000f8000 0x00008000>;
            };
        };
    };
    
    /* External flash: secondary slot placed here */
    &mx25r64 {
        status = "okay";
    
        partitions {
            compatible = "fixed-partitions";
            #address-cells = <1>;
            #size-cells = <1>;
    
            slot1_partition: partition@0 {
                label = "image-1";
                reg = <0x00000000 0x00076000>; /* same size as slot0 */
            };
        };
    };

    Is the Partitions tab in Memory Report planned to be updated to support DTS-based partitioning?

    I will check with the VS Code team to verify.

    Kind regards,
    Andreas

  • Hi,

    I tried to migrate to DTS-based partitioning following the migration guide, but I was unable to get it working. I'm sharing what I found during the investigation, hoping to get some guidance.

    Environment:

    • NCS v3.4.0
    • nRF7002DK
    • MCUboot + DTS-based partitioning (without Partition Manager)
    • Wi-Fi patches in external flash (mx25r64)

    What I found:

    1. I had the nrf70-fw-patch-ext-flash snippet enabled in my build configuration. This snippet applies fw-patch-ext-flash.overlay, which defines nrf70_wifi_fw_partition at partition@0 in mx25r64. This conflicted with my own overlay where I was also trying to define nrf70_wifi_fw_partition, causing a duplicate label error. Removing the snippet resolved this conflict.

    2. After removing the snippet, I added the partition definitions to both the application overlay and the MCUboot overlay. However, I still get the following build error:

    ```

    C:/ncs/v3.4.0/bootloader/mcuboot/boot/zephyr/include/sysflash/sysflash.h: In function '__flash_area_ids_for_slot':
    C:/ncs/v3.4.0/zephyr/include/zephyr/devicetree.h:197:36: error: 'DT_N_NODELABEL_slot2_partition_PARTITION_ID' undeclared (first use in this function); did you mean 'DT_N_NODELABEL_slot1_partition'?
    C:/ncs/v3.4.0/zephyr/include/zephyr/devicetree.h:197:36: error: 'DT_N_NODELABEL_slot3_partition_PARTITION_ID' undeclared (first use in this function); did you mean 'DT_N_NODELABEL_slot1_partition'?

    ```

    My current application overlay:

    /delete-node/ &slot0_partition;
    /delete-node/ &slot1_partition;
    /delete-node/ &storage_partition;
    
    / {
    	chosen {
    		nordic,pm-ext-flash = &mx25r64;
    	};
    };
    
    &flash0 {
    	partitions {
    		boot_partition: partition@0 {
    			compatible = "zephyr,mapped-partition";
    			label = "mcuboot";
    			reg = <0x0 0x10000>;
    		};
    
    		slot0_partition: partition@10000 {
    			compatible = "zephyr,mapped-partition";
    			label = "image-0";
    			reg = <0x10000 0xec000>;
    		};
    
    		storage_partition: partition@fc000 {
    			compatible = "zephyr,mapped-partition";
    			label = "storage";
    			reg = <0xfc000 0x2000>;
    		};
    	};
    };
    
    &mx25r64 {
    	partitions {
    		compatible = "fixed-partitions";
    		#address-cells = <1>;
    		#size-cells = <1>;
    
    		nrf70_wifi_fw_partition: nrf70_fw_partition: slot2_partition: partition@0 {
    			label = "image-2";
    			reg = <0x0 0x20000>;
    		};
    
    		slot1_partition: partition@20000 {
    			label = "image-1";
    			reg = <0x20000 0xec000>;
    		};
    
    		slot3_partition: partition@10c000 {
    			label = "image-3";
    			reg = <0x10c000 0x20000>;
    		};
    	};
    };

    My current MCUboot overlay:

    / {
    	chosen {
    		nordic,pm-ext-flash = &mx25r64;
    		zephyr,code-partition = &boot_partition;
    	};
    };
    
    &flash0 {
    	partitions {
    		boot_partition: partition@0 {
    			compatible = "zephyr,mapped-partition";
    			label = "mcuboot";
    			reg = <0x0 0x10000>;
    		};
    
    		slot0_partition: partition@10000 {
    			compatible = "zephyr,mapped-partition";
    			label = "image-0";
    			reg = <0x10000 0xec000>;
    		};
    
    		storage_partition: partition@fc000 {
    			compatible = "zephyr,mapped-partition";
    			label = "storage";
    			reg = <0xfc000 0x2000>;
    		};
    	};
    };
    
    &mx25r64 {
    	partitions {
    		compatible = "fixed-partitions";
    		#address-cells = <1>;
    		#size-cells = <1>;
    
    		nrf70_wifi_fw_partition: nrf70_fw_partition: slot2_partition: partition@0 {
    			label = "image-2";
    			reg = <0x0 0x20000>;
    		};
    
    		slot1_partition: partition@20000 {
    			label = "image-1";
    			reg = <0x20000 0xec000>;
    		};
    
    		slot3_partition: partition@10c000 {
    			label = "image-3";
    			reg = <0x10c000 0x20000>;
    		};
    	};
    };

    For now, I have decided to stay with PM-based partitioning since I am using v3.4.0 LTS and need to move forward with a new project. However, I would appreciate any guidance on the correct approach for DTS-based partitioning with external flash on nRF7002DK.

    Thank you!

  • Hi Yoshihara,

    I will have a closer look at it today and see if I can provide a better reference. To expand a bit, which are you looking for:

    1. A sample showing the dts based partitioning in NCS v3.4.0
    2. How to port an application from 3.3.0 with partition manager into 3.4.0 with dts partitioning?

    Kind regards,
    Andreas

  • Hi again,

    Apologies for the wait.

    There are some mismatch in between the overlays for the application and the bootloader, i.e they don't share the same image of how the memory layout is set up. If you have a working partition manager build, I think my recommendation is to use this script to migrate it to an overlay based design: https://nrfconnectdocs.nordicsemi.com/ncs/latest/nrf/releases_and_maturity/migration/migration_partitions.html#migrate-your-project-to-dts-partitioning 

    Here's an example over how to configure it for the applicaiton overlay:

    /delete-node/ &slot0_partition;
    /delete-node/ &slot1_partition;
    /delete-node/ &storage_partition;
    
    &flash0 {
    	partitions {
    		boot_partition: partition@0 {
    			label = "mcuboot";
    			reg = <0x0 0x10000>;
    		};
    		slot0_partition: partition@10000 {
    			label = "image-0";
    			reg = <0x10000 0xe8000>;
    		};
    		storage_partition: partition@f8000 {
    			label = "storage";
    			reg = <0xf8000 0x8000>;
    		};
    	};
    };
    
    &mx25r64 {
    	status = "okay";
    	partitions {
    		compatible = "fixed-partitions";
    		#address-cells = <1>;
    		#size-cells = <1>;
    
    		slot1_partition: partition@0 {          /* app secondary */
    			label = "image-1";
    			reg = <0x0 0xe8000>;               /* == slot0 size */
    		};
    
    		nrf70_wifi_fw_partition: partition@e8000 {
    			label = "nrf70-wifi-fw";
    			reg = <0xe8000 0x40000>;
    		};
    	};
    };

    A couple of other comments:
    MCUboot the same overview, enable the qspi driver with CONFIG_NORDIC_QSPI_NOR=y. Increase CONFIG_BOOT_MAX_IMG_SECTORS  since you are using an external flash which increases the slots.

    Do not enable the nrf70-fw-patch-ext-flash snippet if you define nrf70_wifi_fw_partition yourself if you are using the snippet you list, this will give you a duplication error.

    If you do want network-core DFU, add slot2_partition(image-2) and slot3_partition(image-3) as well. Otherwise make sure only the app image is updatable so MCUboot doesn't reference slot2/slot3.

    Kind regards,
    Andreas

Reply
  • Hi again,

    Apologies for the wait.

    There are some mismatch in between the overlays for the application and the bootloader, i.e they don't share the same image of how the memory layout is set up. If you have a working partition manager build, I think my recommendation is to use this script to migrate it to an overlay based design: https://nrfconnectdocs.nordicsemi.com/ncs/latest/nrf/releases_and_maturity/migration/migration_partitions.html#migrate-your-project-to-dts-partitioning 

    Here's an example over how to configure it for the applicaiton overlay:

    /delete-node/ &slot0_partition;
    /delete-node/ &slot1_partition;
    /delete-node/ &storage_partition;
    
    &flash0 {
    	partitions {
    		boot_partition: partition@0 {
    			label = "mcuboot";
    			reg = <0x0 0x10000>;
    		};
    		slot0_partition: partition@10000 {
    			label = "image-0";
    			reg = <0x10000 0xe8000>;
    		};
    		storage_partition: partition@f8000 {
    			label = "storage";
    			reg = <0xf8000 0x8000>;
    		};
    	};
    };
    
    &mx25r64 {
    	status = "okay";
    	partitions {
    		compatible = "fixed-partitions";
    		#address-cells = <1>;
    		#size-cells = <1>;
    
    		slot1_partition: partition@0 {          /* app secondary */
    			label = "image-1";
    			reg = <0x0 0xe8000>;               /* == slot0 size */
    		};
    
    		nrf70_wifi_fw_partition: partition@e8000 {
    			label = "nrf70-wifi-fw";
    			reg = <0xe8000 0x40000>;
    		};
    	};
    };

    A couple of other comments:
    MCUboot the same overview, enable the qspi driver with CONFIG_NORDIC_QSPI_NOR=y. Increase CONFIG_BOOT_MAX_IMG_SECTORS  since you are using an external flash which increases the slots.

    Do not enable the nrf70-fw-patch-ext-flash snippet if you define nrf70_wifi_fw_partition yourself if you are using the snippet you list, this will give you a duplication error.

    If you do want network-core DFU, add slot2_partition(image-2) and slot3_partition(image-3) as well. Otherwise make sure only the app image is updatable so MCUboot doesn't reference slot2/slot3.

    Kind regards,
    Andreas

Children
No Data
Related