Documentation

Mistake on this page? Email us

Tutorial: End to end firmware update using Device Management Client Lite

Tip: If you cannot access some of the repositories referenced in this section, please contact us to request access.

This section covers updating firmware using Device Management Client Lite.

If you want to update devices using Device Management Client, refer to Device Management Update documentation.

There are two methods for updating the firmware on your device using Device Management Client Lite:

  • Through the Device Management Portal.
  • Using the RESTful APIs:
    • Directly with HTTP APIs.
    • Using the Device Management SDK.
    • Using the manifest tool.

Both methods use the Update feature built into Device Management Client Lite.

In this guide, we explain how to update the firmware using the manifest tool.

The workflow for this guide is:

  1. Set up the device to receive firmware updates.
  2. Update the firmware application remotely using Device Management:
    1. Create a new update image.
    2. Upload the new image.
    3. Create and upload a manifest and key table.
    4. Create a device filter.
    5. Create and start an update campaign.
    6. Monitor the campaign's progress, and confirm its successful completion.

Set up the device to receive firmware updates

To set up your device to receive firmware updates please see the Device Management Client Lite tutorial.

Update the device with new image

Create and upload a update image

  1. Create a new update image with any changes you may require and recompile.

  2. Connect to Device Management Portal and log in with your credentials.

  3. Open the Firmware update menu.

  4. Open the Images menu.

  5. Click Upload image.

  6. Enter a Name and a Description

  7. Click Choose file, and upload the new update image to Device Management. You can see the update image in the output of mbed compile. For example:

    Image: ./BUILD/K64F/GCC_ARM/mbed-client-lite-example-restricted_update.bin
    
  8. Once your update image upload completes, it is visible in the Images list. Copy the URL of the update image.

Create and upload a manifest

  1. Create a manifest using the command:

    manifest-tool create -p <payload file> -u <file url> -o k64_mini-test.manifest --mac --psk-table table.proto --psk-table-encoding protobuf -k .update-certificates/default.master.psk
    

    The is the same update image which was uploaded to Device Management Portal.

    The file URL is (you got this from Device Management Portal in previous steps when you uploaded the update image) for example:

    http://firmware-catalog-media-9eb5.s3.dualstack.eu-west-1.amazonaws.com/mbed-client-lite-example-restricted_update_Sw9dfTZ.bin
    
  2. Upload the manifest and key table to the Device Management Portal. Use the following curl command:

    curl -H "Authorization: bearer <api key>" -F "datafile=@k64_mini-test.manifest" -F "key_table=@table.proto" https://api.us-east-1.mbedcloud.com/v3/firmware-manifests
    
    

    You can also upload it in Device Management Portal under Firmware update > Manifests.

Create a device filter

Device filters allow you to target specific devices for update. Create a device filter in Device Management Portal now to use it in your update campaign later.

  1. Open the Device directory menu.
  2. Click More.
  3. Click Add another.
  4. Add a filter on Device name (in this case, the device shown is the only one that has a name).
  5. To add mode filtering rules, click again Add another.
  6. Click Save, give your filter a name and click Save filter.
  7. The new filter is automatically applied to the page, and only devices with the selected attributes appear.

Create and manage an update campaign

Update campaigns combine a device filter and a manifest to advertise an update to your device. Create an update campaign in Device Management Portal:

  1. Open the Firmware update menu.
  2. Open the Update campaigns menu.
  3. Click New campaign.
  4. Enter a Name and a Description.
  5. Select the manifest you just uploaded from the dropdown menu.
  6. Select the filter you created from the filter dropdown menu.
  7. Click Finish.
  8. The campaign is in the draft state.
  9. When you are ready to start the update process, click Start.
  10. When the update process starts, you see the progress in stages. Wait until your the device is updated. On the device side, you can see the progress and notifications as soon as the firmware update starts.
  11. When the update completes and the application starts running, the device reconnects and campaign Phase changes to Stopped. The update process is now completed.

You have successfully updated your device's firmware using Device Management Portal.