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:
20:cf73b0d75bb7
Parent:
19:169aab9047bd
Child:
24:e400edb8d2ee
--- a/SWUpdate.h	Mon Jan 19 13:33:47 2015 +0000
+++ b/SWUpdate.h	Mon Jan 19 14:23:39 2015 +0000
@@ -1,6 +1,8 @@
 /// @file 
 /// Automatic Software Update via the network.
 ///
+/// Supported Platforms: mbed LPC1768.
+/// 
 /// This library provides a reasonably simple interface to updating sofware
 /// semi-automatically via the network. It does that by querying a web server 
 /// upon which you have placed an updated version of the embedded software 
@@ -9,6 +11,49 @@
 /// will try to download the software. If that succeeds, then it can
 /// optionally reboot to activate the new software.
 ///
+/// @code
+/// +-----------+
+/// | Compiler  |
+/// +-----------+
+///      V                           +------------------+
+/// +-----------+                    |Web Server        |
+/// |myprog.bin |------------------->| /mbed/myprog.bin |
+/// +-----------+        +-----------|                  |
+///                      V           |                  |
+///                +-----------+     |                  |
+///                |perl script|---->| /mbed/myprog.txt |
+///                +-----------+     +------------------+
+///                                           A
+/// +---------------+                         #
+/// |mbed appliance |<====== network =========#======...
+/// +---------------+
+///
+///     mbed                       server    
+///      |                           |
+///      +-- http Get(myprog.txt) -->|
+///      |<-- file(myprog.txt) ------+
+///      |                           |
+///      |---+                       |
+///      |  v58 newer than v57       |
+///      |<--+                       |
+///      |                           |
+///      +-- http Get(myprog.bin) -->|
+///      |<-- file(myprog.bin) ------+
+///      |<-- file(myprog.bin) ------+
+///      |<-- file(myprog.bin) ------+
+///      | (save as myprog58.bin)    |
+///      |                           |
+///      |---+                       |
+///      | integrity ck ok?          |
+///      |<--+                       |
+///      |                           |
+///      |---+                       |
+///      | unlink other .bin files   |
+///      | and reboot                |
+///      |<--+                       |
+///      |                           |
+/// @endcode
+///
 /// While the name shown in the examples here is "myprog", this is unimportant.
 /// Your application will have a name of your choosing, which you will 
 /// use in the API.
@@ -27,17 +72,17 @@
 ///
 /// The files of interest on the local file system are as follows:
 ///
-///   @li myprog23.bin - The actual application binary file that is currently
-///             executing. In this case, this is the 23rd version that
+///   @li myprog58.bin - The actual application binary file that is currently
+///             executing. In this case, this is the 58th version that
 ///             has been installed. You can go to 99 after which you might
 ///             want to start over.
 ///   @li myprog.ver - A text file, maintained by this software update
 ///             application, that was downloaded from the server with
-///             application version 23. 
+///             application version 58. 
 ///
 /// If "myprog.ver" does not exist, it will assume that the server has a 
 /// newer application, so it will be downloaded and activated (even if all
-/// it does is to replace the existing myprog23.bin file).
+/// it does is to replace the existing myprog58.bin file).
 ///
 /// Web Server Files:
 ///
@@ -51,7 +96,7 @@
 ///             that of the binary file.
 ///
 /// The myprog.txt file shall have 3 comma-separated numbers in it.
-///   version,checksum,filesize (e.g. "23,41384,107996").
+///   version,checksum,filesize (e.g. "58,41384,107996").
 ///
 ///   @li version is a simple number. If the number is different than
 ///             what is stored on the local file system, then the program