How to FOTA only mcuboot over BLE

Hi,

I'm trying to FOTA over BLE firmware of mcuboot using NRF52840DK.
The project is based on the sample from Intermediate course - Lesson 8, exercise 3 (without the steps relevant to nrf53 - steps 6 to 9).
also, the project uses the NSIB, and the external flash to host the mcuboot_secondary partition.

My main goal is to be able use the dfu_mcuboot.zip file in order to not mess with the management of which slot and which bin file to flash.

With that said, I tried follow some guidelines from this ticket, where someone replied: "What I found out is that the dfu_mcuboot.zip currently doesn't work with the Device Manager App."
this ticket is old, and I hope that till then things changed, but unfortunately I still can't use the zip file. (I did use the bin files and it works well, but that is not what I need).

First question: Regarding the above ticket's answer, is there another application besides Device Manager App that can handle the zip files?

Back to my project and my attempts:
I checked the manifest.json file (inside dfu_mcuboot.zip) on both "versions" (using the CONFIG_MCUBOOT_IMGTOOL_SIGN_VERSION, and by modifying BOOT_LOG_INF inside /ncs/v2.6.1/bootloader/mcuboot/boot/zephyr/main.c - to be able to see the change between versions)

the results was:

  1. First build -
    prj.conf file:
    CONFIG_GPIO=y
    CONFIG_SECURE_BOOT=y
    
    # Enable MCUboot
    CONFIG_BOOTLOADER_MCUBOOT=y
    
    # Enable MCUMGR 
    CONFIG_MCUMGR=y
    
    # Enable MCUMGR management for both OS and Images
    CONFIG_MCUMGR_GRP_OS=y
    CONFIG_MCUMGR_GRP_IMG=y
    
    # Configure dependencies for CONFIG_MCUMGR  
    CONFIG_NET_BUF=y
    CONFIG_ZCBOR=y
    CONFIG_CRC=y
    
    # Configure dependencies for CONFIG_MCUMGR_GRP_IMG  
    CONFIG_FLASH=y
    CONFIG_IMG_MANAGER=y
    
    # Configure dependencies for CONFIG_IMG_MANAGER  
    CONFIG_STREAM_FLASH=y
    CONFIG_FLASH_MAP=y
    
    CONFIG_MAIN_STACK_SIZE=2048
    
    CONFIG_PRINTK=y
    CONFIG_NORDIC_QSPI_NOR=y
    CONFIG_NORDIC_QSPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096
    
    
    
    CONFIG_SB_SIGNING_KEY_FILE="{mypath}/custom_priv.pem"
    CONFIG_BUILD_S1_VARIANT=y
    CONFIG_SB_NUM_VER_COUNTER_SLOTS=120
    CONFIG_PM_EXTERNAL_FLASH_MCUBOOT_SECONDARY=y
    
    
    
    
    # Configure MCUMGR transport to UART
    CONFIG_MCUMGR_TRANSPORT_UART=y
    
    # Configure dependencies for CONFIG_MCUMGR_TRANSPORT_UART 
    CONFIG_BASE64=y
    
    
    CONFIG_DFU_MULTI_IMAGE=y
    
    CONFIG_NCS_SAMPLES_DEFAULTS=y
    
    CONFIG_BT=y
    CONFIG_BT_PERIPHERAL=y
    CONFIG_BT_DEVICE_NAME="NRF52840DK_LBS"
    
    # Enable the LBS service
    CONFIG_BT_LBS=y
    CONFIG_BT_LBS_POLL_BUTTON=y
    CONFIG_DK_LIBRARY=y
    
    CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=4096
    
    CONFIG_NCS_SAMPLE_MCUMGR_BT_OTA_DFU=y
    CONFIG_MCUMGR_TRANSPORT_BT_AUTHEN=n
    CONFIG_BT_SMP=y
    CONFIG_BT_DIS=y
    CONFIG_BT_DIS_PNP=n
    CONFIG_BT_BAS=y
    CONFIG_BT_HRS=y
    CONFIG_BT_DEVICE_APPEARANCE=833
    
    CONFIG_MCUBOOT_IMGTOOL_SIGN_VERSION="0.1.5+5"

    mcuboot.conf:
    CONFIG_LOG=y
    CONFIG_MCUBOOT_LOG_LEVEL_INF=y
    
    CONFIG_UART_CONSOLE=y
    
    CONFIG_SINGLE_APPLICATION_SLOT=n
    
    CONFIG_BOOT_MAX_IMG_SECTORS=256
    
    CONFIG_FW_INFO_FIRMWARE_VERSION=1
    CONFIG_BOOT_SIGNATURE_TYPE_ECDSA_P256=y
    CONFIG_BOOT_SIGNATURE_KEY_FILE="{mypath}/priv.pem"
    
    CONFIG_NORDIC_QSPI_NOR=y

    dfu_mcboot.zip -> manifest.json:
    {
        "format-version": 0,
        "time": 1721127692,
        "files": [
            {
                "version_MCUBOOT": "0.1.5+5",
                "version_B0": "1",
                "type": "mcuboot",
                "board": "nrf52840dk_nrf52840",
                "soc": "nRF52840_QIAA",
                "load_address": 36864,
                "size": 38962,
                "file": "signed_by_mcuboot_and_b0_s0_image_update.bin",
                "modtime": 1721127692
            },
            {
                "version_MCUBOOT": "0.1.5+5",
                "version_B0": "1",
                "type": "mcuboot",
                "board": "nrf52840dk_nrf52840",
                "soc": "nRF52840_QIAA",
                "load_address": 90112,
                "size": 38963,
                "file": "signed_by_mcuboot_and_b0_s1_image_update.bin",
                "modtime": 1721127692
            }
        ],
        "name": "testFOTAmcuboot",
        "firmware": {
            "zephyr": {
                "revision": "b045fa5b336a77839a3c539d345a1b17655ba475-dirty"
            },
            "nrf": {
                "revision": "eef645c4a31201df353fdff5447262d7675fa1c1-dirty"
            }
        }
    }
  2. Second code - only changed CONFIG_MCUBOOT_IMGTOOL_SIGN_VERSION="0.1.6+6" in prj.conf
    dfu_mcboot.zip -> manifest.json:
    {
        "format-version": 0,
        "time": 1721128086,
        "files": [
            {
                "version_MCUBOOT": "0.1.6+6",
                "version_B0": "1",
                "type": "mcuboot",
                "board": "nrf52840dk_nrf52840",
                "soc": "nRF52840_QIAA",
                "load_address": 36864,
                "size": 38962,
                "file": "signed_by_mcuboot_and_b0_s0_image_update.bin",
                "modtime": 1721128086
            },
            {
                "version_MCUBOOT": "0.1.6+6",
                "version_B0": "1",
                "type": "mcuboot",
                "board": "nrf52840dk_nrf52840",
                "soc": "nRF52840_QIAA",
                "load_address": 90112,
                "size": 38964,
                "file": "signed_by_mcuboot_and_b0_s1_image_update.bin",
                "modtime": 1721128086
            }
        ],
        "name": "testFOTAmcuboot",
        "firmware": {
            "zephyr": {
                "revision": "b045fa5b336a77839a3c539d345a1b17655ba475-dirty"
            },
            "nrf": {
                "revision": "eef645c4a31201df353fdff5447262d7675fa1c1-dirty"
            }
        }
    }

which makes me wonder if there is a problem/missing argument when building the project - all the attempts ended with manifest that is not aware of the old version.

Note that I tried multiple build ways:
1. new build configuration -> Pristine build for version 0.1.5+5, Pristine build for version 0.1.6+6
2. new build configuration -> Pristine build for version 0.1.5+5, normal build for version 0.1.6+6
Also, I tried to increment the CONFIG_FW_INFO_FIRMWARE_VERSION in mcuboot.conf, using the same build attempts as above.

All the attempts yield the same manifest behavior, and on the Device Manager App I got the next error when trying to FOTA - Hash not found (8)

screenshots from the Device Manager App:
after selecting the file:

after uploading:


Thanks,
Udi.

Related