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.

Revision:
16:de99e872fc9d
Parent:
15:49cc43dcbbf6
Child:
17:1d318666246c
--- a/SWUpdate.h	Sat Jun 28 19:46:46 2014 +0000
+++ b/SWUpdate.h	Sat Jul 05 16:06:55 2014 +0000
@@ -106,8 +106,8 @@
 
 // This defines the maximum string length for a fully qualified
 // filename. Usually, this will be pretty short 
-// (e.g. "/local/myprog.bin"), but we want to be generous.
-#define SW_MAX_FQFN 30
+// (e.g. "/local/myprog.bin"), which should be 19 max with 8.3 filename.
+#define SW_MAX_FQFN 20
 
 // This defines the maximum string length for the url, including
 // the base filename of interest.
@@ -139,6 +139,13 @@
 /// server URL that is hosting the embedded software. We also give it 
 /// the "root" name of the file of interest, which permits you to
 /// have different applications served from the same location. 
+/// 
+/// Note that the root name can be a long filename, as is typically 
+/// produced from the cloud-based build process. This name will
+/// be truncated to the first 6 characters when installed on the
+/// mbed local file system, in order to retain space for a 2-digit
+/// version number.
+///
 /// One optional parameter lets you decide what happens if a new 
 /// version is installed - automatically reboot to launch it, or
 /// return to the calling program which may perform a more orderly
@@ -147,7 +154,7 @@
 /// @code
 ///     ...
 ///     if (NowIsTheTimeToCheckForSoftwareUpdates()) {
-///         if (SWUP_OK == SoftwareUpdate("http://192.168.1.200", "myprog", DEFER_REBOOT)) {
+///         if (SWUP_OK == SoftwareUpdate("http://192.168.1.200/path/to/file", "myprog_LPC1768", DEFER_REBOOT)) {
 ///             printf("Software updated, rebooting now...\r\n");
 ///             wait_ms(5000);
 ///             mbed_reset();