MCUBoot says not enough free space to run swap upgrade but I still have room - how to change partition properly?

I am seeing the following error in my logs after attempting to update my device via DFU using the nRF Connect iOS app:

I: Starting bootloader
I: Primary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
I: Secondary image: magic=good, swap_type=0x3, copy_done=0x3, image_ok=0x1
I: Boot source: none
I: Swap type: perm
I: Starting swap using move algorithm.
W: Not enough free space to run swap upgrade
W: required 225280 bytes but only 221184 are available
I: Bootloader chainload address offset: 0xc000

When I compile my app it looks like it's only taking ~68% of flash, and the message is saying I only need 4096 bytes more for it to work. But, I'm not sure how to change the partitions for this to work.

Memory region Used Size Region Size %age Used
FLASH: 33384 B 48 KB 67.92%
SRAM: 23744 B 64 KB 36.23%
IDT_LIST: 0 GB 2 KB 0.00%


How would I go about fixing this so I can update via DFU?

Below is the .dts partition section for my custom board's .dts file:

&flash0 {

	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 0x32000>;
		};
		slot1_partition: partition@3e000 {
			label = "image-1";
			reg = <0x0003E000 0x32000>;
		};
		scratch_partition: partition@70000 {
			label = "image-scratch";
			reg = <0x00070000 0xa000>;
		};
		storage_partition: partition@7a000 {
			label = "storage";
			reg = <0x0007a000 0x00006000>;
		};
	};
};

If it's helpful, here is the output from "west build -t partition_manager_report":

flash_primary (0x80000 - 512kB):
+-------------------------------------------------+
| 0x0: mcuboot (0xc000 - 48kB) |
+---0xc000: mcuboot_primary (0x37000 - 220kB)-----+
| 0xc000: mcuboot_pad (0x200 - 512B) |
+---0xc200: mcuboot_primary_app (0x36e00 - 219kB)-+
| 0xc200: app (0x36e00 - 219kB) |
+-------------------------------------------------+
| 0x43000: mcuboot_secondary (0x37000 - 220kB) |
| 0x7a000: nvs_storage (0x6000 - 24kB) |
+-------------------------------------------------+

sram_primary (0x10000 - 64kB):
+-------------------------------------------+
| 0x20000000: sram_primary (0x10000 - 64kB) |
+-------------------------------------------+

Thank you for any help you can give.

Related