Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of SWUpdate by
Revision 14:0e012d53c6df, committed 2014-06-27
- Comitter:
- WiredHome
- Date:
- Fri Jun 27 20:57:23 2014 +0000
- Parent:
- 13:cf76c2bd3dfc
- Child:
- 15:49cc43dcbbf6
- Commit message:
- bin file must be 8-chars total, so revised the example to have a shorter filename, and sequence number to be 2 digit, not 3.
Changed in this revision
| SWUpdate.cpp | Show annotated file Show diff for this revision Revisions of this file |
| SWUpdate.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/SWUpdate.cpp Sat Jun 21 19:39:27 2014 +0000
+++ b/SWUpdate.cpp Fri Jun 27 20:57:23 2014 +0000
@@ -11,7 +11,7 @@
extern "C" void mbed_reset();
-//#define DEBUG "SWup"
+#define DEBUG "SWup"
#include <cstdio>
#if (defined(DEBUG) && !defined(TARGET_LPC11U24))
#define DBG(x, ...) std::printf("[DBG %s %3d] "x"\r\n", DEBUG, __LINE__, ##__VA_ARGS__);
@@ -101,7 +101,7 @@
struct dirent *p;
bool noFailed = true;
- snprintf(curbin, SW_MAX_FQFN, "%s%03d.bin", name, ver);
+ snprintf(curbin, SW_MAX_FQFN, "%s%02d.bin", name, ver);
INFO("Remove bin files excluding {%s}", curbin);
d = opendir("/local/");
// Get a directory handle
@@ -164,7 +164,7 @@
INFO(" file size: %d", fsize);
if (inst_ver != latest_ver) {
INFO(" Downloading firmware ver %d ...", latest_ver);
- sprintf(fwfn, "/local/%s%03d.BIN", name, latest_ver);
+ sprintf(fwfn, "/local/%s%02d.BIN", name, latest_ver);
snprintf(fqurl, 150, "%s/%s.bin", url, name);
HTTPFile latest(fwfn);
--- a/SWUpdate.h Sat Jun 21 19:39:27 2014 +0000 +++ b/SWUpdate.h Fri Jun 27 20:57:23 2014 +0000 @@ -13,11 +13,17 @@ /// Your application will have a name of your choosing, which you will /// use in the API. /// +/// @note Your binary file name should not exceed 6 characters. This leaves +/// room for a 2-digit sequence number. Since this is using the local +/// file system, it does not support long filenames when accessed from +/// the mbed. So, SomeLongFile23.bin becomes somefi~1.bin and is then +/// erased, leaving no file. +/// /// Local File System Files: /// /// The files of interest on the local file system are as follows: /// -/// @li myprog_23.bin - The actual application binary file that is currently +/// @li myprog23.bin - The actual application binary file that is currently /// executing. In this case, this is the 23rd version that /// has been installed. You can go to 99 after which you might /// want to start over. @@ -27,7 +33,7 @@ /// /// 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 myprog_23.bin file). +/// it does is to replace the existing myprog23.bin file). /// /// Web Server Files: /// @@ -53,9 +59,9 @@ /// Variations: /// /// Within that single web server folder, you could have several apps - -/// @li SensorNode.bin, SensorNode.txt -/// @li SensorNode_B.bin, SensorNode_B.txt -/// @li SensorDisplay.bin, SensorDisplay.txt +/// @li Sensor.bin, Sensor.txt +/// @li SensrB.bin, SensrB.txt +/// @li SensrD.bin, SensrD.txt /// /// In this example, perhaps your first version was called SensorNode, but /// with a small hardware design change, you have a new "model B" version. @@ -96,8 +102,8 @@ // This defines the maximum string length for a fully qualified // filename. Usually, this will be pretty short -// (e.g. "/local/myprogramname.bin"), but we want to be generous. -#define SW_MAX_FQFN 80 +// (e.g. "/local/myprog.bin"), but we want to be generous. +#define SW_MAX_FQFN 30 // This defines the maximum string length for the url, including // the base filename of interest.
