I am trying to get DFU FOTA over BLE to work using external flash on an nRF52840 DK with NCS 2.5.2. I followed multiple sources, but I am unsure about the correct configuration.
1. Configuration Steps
I started by adding these to prj.conf
CONFIG_BOOTLOADER_MCUBOOT=y CONFIG_NCS_SAMPLE_MCUMGR_BT_OTA_DFU=y
This already causes compilation errors, but I will get back to that later.
You can get the same errors by modifying the fs_sample and adding:
CONFIG_BT=y CONFIG_BT_PERIPHERAL=y CONFIG_BOOTLOADER_MCUBOOT=y CONFIG_NCS_SAMPLE_MCUMGR_BT_OTA_DFU=y
2. Partition configuration
I have seen projects using pm_static.yml and others defining partitions in overlay, but I am not sure what the difference is.
Here is my pm_static.yml
external_flash:
address: 0xf4000
end_address: 0x800000
region: external_flash
size: 0x70c000
mcuboot_secondary:
address: 0x00000
device: MX25R64
end_address: 0xf4000
region: external_flash
size: 0xf4000
At the same time, my overlay file contains:
&mx25r64 {
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
/* 8MB external storage partition */
external_partition: partition@0 {
reg = <0x00000000 0x0800000>;
};
};
};
/ {
msc_disk0 {
status = "okay";
compatible = "zephyr,flash-disk";
partition = <&external_partition>;
disk-name = "NAND";
/* cache-size == page erase size */
cache-size = <4096>;
};
};
/ {
chosen {
nordic,pm-ext-flash = &mx25r64;
};
};
CONFIG_FLASH=y CONFIG_NORDIC_QSPI_NOR=y CONFIG_BOOT_MAX_IMG_SECTORS=256 CONFIG_LOG=y CONFIG_LOG_MODE_MINIMAL=y CONFIG_MCUBOOT_LOG_LEVEL_WRN=y CONFIG_CBPRINTF_NANO=y CONFIG_NORDIC_QSPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096
484 | PM_FOREACH_AFFILIATED_TO_disk(DEFINE_FLASHDISKS_CACHE)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
524 | PM_FOREACH_AFFILIATED_TO_disk(DEFINE_FLASHDISKS_DEVICE)
| ^~~~~~~~~~~~~~~~~~~~~~~~