FOTA Update
FOTA stands for Firmware Over the Air, allowing you to update the on-board sketch binary using Wi-Fi.
The LHTTPUpdate library allows you to download a FOTA binary from a given HTTP URL, and apply it to LinkIt 7697.
Example
Upgrade your LinkIt 7697 Arduino BSP to v0.10.5 or later version.
Select LinkIt 7697 from Tools > Board menu.
Open Examples > LHTTPUpdate > LHTTPUpdate
Change the ssid and pass according to your Wi-Fi AP setting:
Click Upload to upload the sketch to LinkIt 7697
After upload, open the Serial Monitor
You should see the following message:
This means the example is now downloading the new binary from the URL http://download.labs.mediatek.com/resource/fota_example.bin
Press RST button to reboot and replace on-board binary with the downloaded sketch binary(fota_example.bin)
It may take sometime for the update process to complete. After complete, the board starts blinking - and the on-board sketch binary is now updated.
How It Works
The sketch downloads the "FOTA binary" from http://download.labs.mediatek.com/resource/fota_example.bin, using the following call:
The FOTA binary is a processed sketch binary. It is compressed and checksum to ensure that corruptions can be detected during the update process.
During the update() method, the FOTA binary is written in to the FOTA region of the on-board flash. The on-board flash layout is shown below:
After finish downloading the FOTA binary, the update() method flags the FOTA region as ready to update.
After the system reboots, the bootloader detects new binaries in the FOTA region, uncompress and verifies it, and write the new binary to the CM4 firmware region.
And completes the FOTA operation.
How to Generate FOTA Binary
As we mentioned, the FOTA binary is a processed sketch binary. You can follow these steps to generate the FOTA binary:
Download the FOTA ROM Package tool from https://docs.labs.mediatek.com/resource/mt7687-mt7697/en/downloads#Downloads-Tools.
Export your sketch binary by selecting Sketch > Export Compiled Binary from the IDE menu.
Follow the instruction of the FOTA ROM Package to process the sketch binary. We show the instructions of the Windows version below.
Windows FOTA ROM Package Tool
We denote the FOTA ROM Package root folder as $FOTA_ROOT.
Copy $FOTA_ROOT\_ini\template\mt7697\FOTARomPacker.ini to _ini
Modify $FOTA_ROOT\_ini\FOTARomPacker.ini
Modify the File attribute.
Do not change the Start_Address, Partiion_Size and Is_Compressed option. These settings must match the flash layout of LinkIt 7697.
Copy the sketch binary to $FOTA_ROOT\_Load\mt7697
Execute the script gen_image.bat
The generated FOTA binary is located in the _Output folder
After generating the FOTA binary, you can then host the binary in a HTTP server and use LHTTPUpdate.update() to download and apply the FOTA binary.
Last updated