Building a firmware image for update on an Mbed OS device
This tutorial explains how to build a full firmware image for a supported Mbed OS device that you can update using the Device Management Update client (if the device is connected to Device Management), and how to flash this image to your device.
There are other tutorials for:
- Building a delta image for Mbed OS devices.
- Building a firmware image for the Raspberry Pi 3.
Prerequisites
You need a supported target running Mbed OS. For a list of all supported targets and configurations, see device requirements.
You also need to:
- Prepare your development environment.
- Integrate the Device Management Update client into your user application. Alternatively, you can use the
mbed-cloud-client-example
example application. - Be familiar with the process of connecting an Mbed OS device to Device Management.
Compiling the firmware image
You need to build the application into an image that can be installed on the device. This firmware image includes the:
- User application.
- Update client.
- Operating system.
Compile the example application for K64F (or change the target accordingly):
mbed compile -m K64F -t GCC_ARM
The command creates two firmware images:
- The full image, which combines the application with the bootloader and metadata, and is used for the initial programming of the device:
BUILD/K64F/GCC_ARM/mbed-cloud-client-example.bin
- The update image, which contains only the application and is used for updating the device:
BUILD/K64F/GCC_ARM/mbed-cloud-client-example_update.bin
.
Note: You only need to install the image on the device if it currently does not have your application and Update client installed. If you have previously installed your application and Update client on the device and connected it to Device Management, you can update the firmware using a manifest file and an update campaign.
You should modify the command to reference your device and preferred tool chain. Read more about the firmware image.
Installing the firmware image
You need to install the initial firmware on the device. Installing this image on your device enables you to remotely update its firmware.
- Connect the device to your computer. It appears as a mass storage device.
- Copy the compiled initial firmware image to the device. For more information on how to program the device, see Flashing the binary to the device.
- Reset the device.
- The device connects to Device Management, and is ready to receive firmware updates remotely.
- The device registers with Device Management, and reports an endpoint name. Make a note of this, as you need this to update the device.
- Now that you have a device that can be remotely updated, you can create a manifest file, which enables you to deliver updates to remote devices.