DFU using USB file system (not serial emulation)?

My project has a nrf5340+external flash, and an external USB-C connector. The device exposes a USB file system (FAT) which is hosted on the external flash partition, and appears as an external disk when connected to a host. This all works well and is used to update config, image files etc for the device to use.

I would like to be able to do application / network firmware updates by simply copying the new image (hex or bin) to this file system and rebooting. Has anyone done this? I'm guessing it involves using MCUBoot bootloader and copying the image into the secondary image slot somehow? I also want to put the secondard image slot on my external flash as won't have space on the internal flash - even better would be if MCUBoot could take the image directly from the file in the FS....

by the way, to be clear, I do NOT want to use the 'DFU over USB serial emulation' method, as this requires the user to install the specific tool to the host machine, which may not be available for their host or may not be allowed by IT policy (or by their level of expertise...). 

thanks for any pointers!

  • Your request is to have multiple image confirm in mcuboot.c and the implementation of the same functionality in dfu_target , correct? 

    Yes, thats right. It would be much more coherent to have the confirmation function the dfu_target module (given dfu_target always does the DFU as 'test', it is required to do the confirmation post DFU)

    Currenrly I can do the multi-image confirm using the mcuboot.c exposed function, but there is NO boot_is_img_confirmed_multi() function available which  would mean it has to be confirmed every boot by the app.. I have dealt with the issue just now by using the existing boot_is_img_confirmed() for image 0 , and the mcuboot_swap_type_multi() function to detect if the other images are confirmed:

    /** check if a specific image is confirmed ok
     * This should be a function in mcuboot.c/bootutil_public.c
    */
    static bool _boot_is_img_confirmed_multi(int image_index) {
        // Only got a 'proper' fn to check for confirmed for image 0, otherwise we use a hack
        if (image_index==0) {
            return boot_is_img_confirmed();
        }
        // Check what mcuboot says it would do on next boot - if any action other than NONE then the image is not confirmed
        return (mcuboot_swap_type_multi(image_index)==BOOT_SWAP_TYPE_NONE);

    }

    But this should be in mcuboot.c and check the swap image ok status properly...

  • Thanks Brian. I have forwarded the request to the team. Will keep you updated. 

Related