Software Update via Ethernet - the mbed application can pull down an updated application binary from a web server and activate that binary. This library works only with the LPC1768, as it relies on the magic-chip boot-loader mechanism.

Dependents:   WattEye X10Svr PUB_SWUpdate

Success!! With this library, a network connection, and a web server hosting a new binary image, you can update the mbed firmware over the air (FOTA) - well, at least via Ethernet so far.

As of March 2015, it has been tested with the following mbed official libraries:

And a custom derivation:

  • HTTPClient v33, v32, which includes a custom HTTPFile.

Part of the update process involves checking the integrity of the downloaded binary file, for both a checksum and the program (file) size. To create this additional information, a small perl script is used (the important part is only 20 lines of code). See the documentation in the header file.

After the new binary is successfully downloaded, the checksum and the size are evaluated and if correct, then the old binary file is removed (this is the only way to cause the new binary to activate).

The mbed can then be automatically reset to activate the new image, or this may be deferred in case there is some other process necessary for an orderly restart.

Details are in the SWUpdate header file, and PUB_SWUpdate is a publicly accessible demonstration program for this library.

Committer:
WiredHome
Date:
Sat Jun 14 15:59:02 2014 +0000
Revision:
1:208de08b1a19
Parent:
0:e221363f7942
Child:
2:ef2ac9627546
Unconditionally try to remove the old bin file when a new one has been downloaded.; Add a few more warning messages.; Provide a placeholder for an integrity check of the new download.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
WiredHome 0:e221363f7942 1
WiredHome 0:e221363f7942 2 #include "mbed.h"
WiredHome 0:e221363f7942 3
WiredHome 0:e221363f7942 4 #ifndef SWUPDATE_H
WiredHome 0:e221363f7942 5 #define SWUPDATE_H
WiredHome 0:e221363f7942 6
WiredHome 1:208de08b1a19 7 /// After downloading, the user can choose what happens next.
WiredHome 0:e221363f7942 8 typedef enum {
WiredHome 0:e221363f7942 9 DEFER_REBOOT,
WiredHome 0:e221363f7942 10 AUTO_REBOOT
WiredHome 0:e221363f7942 11 } Reboot_T;
WiredHome 0:e221363f7942 12
WiredHome 1:208de08b1a19 13 /// This API performs some processing to see if a web server
WiredHome 1:208de08b1a19 14 /// has an updated version of software. If it does, then it
WiredHome 1:208de08b1a19 15 /// will try to download it. If that succeeds, then it can
WiredHome 1:208de08b1a19 16 /// optionally reboot to activate the new software.
WiredHome 1:208de08b1a19 17 ///
WiredHome 1:208de08b1a19 18 /// @todo check the freshly downloaded sw integrity. Since we have
WiredHome 1:208de08b1a19 19 /// to remove the old .bin file before the new one will execute,
WiredHome 1:208de08b1a19 20 /// it is in the device' best interest to ensure that new one
WiredHome 1:208de08b1a19 21 /// is a good one.
WiredHome 1:208de08b1a19 22 ///
WiredHome 1:208de08b1a19 23 /// @param url is a pointer to a text string of the url from which to download.
WiredHome 1:208de08b1a19 24 /// @param name is the base filename of the binary file.
WiredHome 1:208de08b1a19 25 /// @param reboot determines whether to automatically reboot to activate the new bin.
WiredHome 1:208de08b1a19 26 ///
WiredHome 0:e221363f7942 27 bool SoftwareUpdate(const char *url, const char * name, Reboot_T reboot = DEFER_REBOOT);
WiredHome 0:e221363f7942 28
WiredHome 0:e221363f7942 29 #endif // SWUPDATE_H