refer to demo: demo/fota
The demo is to receive upgrade firmware from the server to upgrade firmware or to receive firmware upgrade from the serial port upgrade.
It should be noted that upgrading is based on differential upgrade. Every upgrade must be upgraded on the basis of the last firmware.
./build.bat cleanto clean project
edit code： Use serial or http server through comment or uncomment code
// FOTA_UartTest(); FOTASERVER_Test();
If use http server, edit server address e.g.:
#define SOFT_VERSION "V3.0" #define FOTA_HTTP_SERVER "http://test.ai-thinker.com/csdk/fota/%stonew.pack"
V3.0tonew.packis the new upgrade pack name
./build.bat demo fotacompile old version firmware,
fota_*_debug_ota.lodcan be find in
hex/fotafolder, back up
old.lod,and back up
edit new version code,e.g.:
#define SOFT_VERSION "V3.0"
#define SOFT_VERSION "V3.1"
Compile new version,
./build.bat demo fota, and we get the same new firmware
Generate a upgrade package:
./build.bat fota old.lod new.lod V3.0tonew.pack, the fourth parameter is the name of upgrade package, must the same as the upgrade link in the code(
Download the old version firmware(
fota_*_debug.lod) to hardware, and wait auto upgrade from http server; If use serial should send upgrade file to serial. It will auto reboot after upgrade success. Then we can see the versioin upgrade to V3.1 from V3.0