Mistake on this page? Email us

Integrating firmware update platform hooks with your application

The FOTA library offers platform hook callbacks that you can use to integrate platform-specific code during the FOTA flow; for example, if Client Lite shares a resource with another component of the system.

By default, FOTA provides an empty implementation for these hooks. You can override these hooks by injecting the FOTA_CUSTOM_PLATFORM macro to the build and implementing all of the callback functions listed in fota/fota_platform.h:

  • fota_platform_init_hook() - Platform init hook, which the client calls when it initializes the FOTA module.

    The client uses fota_platform_init_hook() to register custom components as described in the Implementing component update.

  • fota_platform_start_update_hook() - Platform start update hook, which the client calls when the update begins.

  • fota_platform_finish_update_hook() - Platform finish update hook, which the client calls when the update has finished.

  • fota_platform_abort_update_hook() - Platform start update hook, which the client calls if an update is aborted.

The red arrows show the application callback sequence in a good-path scenario in which the application authorizes all of the requests by calling fota_app_authorize_update()). Note that the application callbacks call fota_app_authorize_update() out of callback context to illustrate that the application can call these APIs from some event after handling ongoing business logic tasks.