How can I compile my custom hook functions into MCUboot?

As shown in the figure, MCUboot has a boot_go_hook function. I'd like to define this function in my own project and compile it into MCUboot. Since I'm using single slot DFU, firmware updates on the FLASH need to be handled within MCUboot. With this custom hook function, I can use a custom serial communication protocol and led effect to update the app firmware without modifying the NCS code.

Parents
  • Hello,

    The boot_hook_go() function is meant to be overridden, so you can use it to run your own firmware update protocol, like your custom serial communication and LED effects. Normally, MCUboot would enter its built-in serial recovery mode right after this point by calling boot_serial_enter(), but in your case, you can replace that with your own logic.

    Just make sure your protocol downloads the new image correctly to flash, and then reboots the device. After the reboot, MCUboot will take care of verifying the image and booting into it.

    Alternatively, if you want more flexibility, you could look into using MCUboot’s firmware loader mode. That approach uses a separate image to handle the firmware update instead of doing it directly in MCUboot.

    Kind Regards,

    Abhijith

Reply
  • Hello,

    The boot_hook_go() function is meant to be overridden, so you can use it to run your own firmware update protocol, like your custom serial communication and LED effects. Normally, MCUboot would enter its built-in serial recovery mode right after this point by calling boot_serial_enter(), but in your case, you can replace that with your own logic.

    Just make sure your protocol downloads the new image correctly to flash, and then reboots the device. After the reboot, MCUboot will take care of verifying the image and booting into it.

    Alternatively, if you want more flexibility, you could look into using MCUboot’s firmware loader mode. That approach uses a separate image to handle the firmware update instead of doing it directly in MCUboot.

    Kind Regards,

    Abhijith

Children
No Data
Related