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

Can the mcuboot flash partitions be changed?

Hi,

   in the .dts file,partitions is 

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

		boot_partition: partition@0 {
			label = "mcuboot";
			reg = <0x00000000 0xc000>;
		};
		slot0_partition: partition@c000 {
			label = "image-0";
			reg = <0x0000C000 0xd000>;
		};
		slot1_partition: partition@19000 {
			label = "image-1";
			reg = <0x00019000 0xd000>;
		};
		scratch_partition: partition@26000 {
			label = "image-scratch";
			reg = <0x00026000 0x3000>;
		};
		storage_partition: partition@29000 {
			label = "storage";
			reg = <0x00029000 0x00007000>;
		};
	};

Can it be changed to the following?

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

                slot0_partition: partition@0 {
                        label = "image-0";
                        reg = <0x0000000 0x0d000>;
                };
                slot1_partition: partition@d000 {
                        label = "image-1";
                        reg = <0x0000d000 0xd000>;
                };
                scratch_partition: partition@1a000 {
                        label = "image-scratch";
                        reg = <0x0001a000 0x3000>;
                };
                storage_partition: partition@1d000 {
                        label = "storage";
                        reg = <0x0001d000 0x00007000>;
                };

                boot_partition: partition@24000 {
                        label = "mcuboot";
                        reg = <0x00024000 0xc000>;
                };
        };

This modification does not compile.

What should be paid attention to when modifying, can you provide a demo?

Parents
  • hi,

        I want to use mcuboot on nrf5 sdk(Softdevice + APP+ mcuboot) so that I can upgrade to NCS(APP + mcuboot). Since the starting address of the softdevice starts from 0, in order to avoid conflicts, modify the location of mcuboot.

Reply
  • hi,

        I want to use mcuboot on nrf5 sdk(Softdevice + APP+ mcuboot) so that I can upgrade to NCS(APP + mcuboot). Since the starting address of the softdevice starts from 0, in order to avoid conflicts, modify the location of mcuboot.

Children
  • I tried to change the Mcuboot of bootloader\ Mcuboot \boot\zephyr\pm.yml to after: [app]. After the modification, the placement of the Mcuboot did change, but the program did not run.

  • Hi, 

    Jim said:
    I want to use mcuboot on nrf5 sdk(Softdevice + APP+ mcuboot) so that I can upgrade to NCS(APP + mcuboot). Since the starting address of the softdevice starts from 0, in order to avoid conflicts, modify the location of mcuboot.

    Are you looking for updating from nRF5 bootloader to NCS mcuboot via BLE DFU?

    The NCS MCUboot is placed at address 0x0 by default, the same place as where the MBR used to reside. It's however possible to relocate it with the partition manager. There is an experiment a little while ago to see if we could do DFU from nRF5 SDK 17 to NCS v.1.7.1. Attached below are the projects. 

    Memory layout (defined by pm_static.yml)

    $ west build -b nrf52840dk_nrf52840 // West command to build peripheral_uart sample (MCUboot is automatically built as a child image, see Multi-image builds

    $ west build -t rom_report // Ninja build target to display flash layout as shown below

    FOTA/DFU from nRF5 SDK to NCS test:

    dfu_nRF5_NCS1.7.1.zip

    Some quick notes about the test:

    1. The test updates MCUboot and the zephyr application image in one go by calling it a Softdevice+bootloader (SoftDevice and bootloader) update to overwrite the softdevice with the zephyr app. However, it did require some minor modifications to the existing bootloader to make it accept zephyr application as a Softdevice image. The following is the medications (the modified nRF5 SDK provided in the attachment):

    nrf_bootloader_fw_activation.c, in function sd_activate():

    if (SD_MAGIC_NUMBER_GET(src_addr) != SD_MAGIC_NUMBER)
    {
        NRF_LOG_ERROR("Source address does not contain a valid SoftDevice.")
        //return NRF_ERROR_INTERNAL;     << commented out this line
    }

    nrf_dfu_validation.c, in function softdevice_info_ok():

    static bool softdevice_info_ok(uint32_t sd_start_addr, uint32_t sd_size)
    {
        bool result = true;
    
        if (SD_MAGIC_NUMBER_GET(sd_start_addr) != SD_MAGIC_NUMBER)
        {
            NRF_LOG_ERROR("The SoftDevice does not contain the magic number identifying it as a SoftDevice.");
            //result = false; //hack to accept zephyr images
        }

    2. The flash protection mechanism in MCUboot assumes that the mcuboot_primary slot is always placed after the mcuboot partition. It disabled flash protection to get around this limitation by the mcuboot.conf under child_image folder.

    CONFIG_FPROTECT=n

    3. It needs to update the modified nRF5 bootloader first to accept the MCUboot and the zephyr application image, then update to the NCS application with MCUboot. 

    Please let me know if you need any detail or further support.    

    Regards,
    Amanda

  •    Thank you very much for your reply.

  • hi, 

        According to the examples provided, it is indeed possible to upgrade from nRF5 SDK to NCS. After upgrading to NCS, in the example of NCS_peripheral_uart_DFU, only CONFIG_BT_DEVICE_NAME was modified, and app_update.bin was obtained to upgrade, but the upgrade could not be successful. Which part went wrong?

  • Hi, 

    Are your using nRF Connect Desktop/BLE or mobile app to update? For nRF Connect mobile app, try to refresh the service. 

    Jim said:
    but the upgrade could not be successful.

    Please elaborate in more detail. Do you have any error log from the app?

    -Amanda

Related