Languages
日本語版はこちら: 実用ライブラリシリーズ:ファームウェアアップデーター
Overview
Network features on mbed is great. So there are so many mbed application in our world.
Sometime I need to update these mbed application firmware.
So I implemented a firmware update class.
You can update mbed if you put on a new firmware with version text file automatically.
It's really easy to update mbed in the distance.
Sometime I need to update these mbed application firmware.
So I implemented a firmware update class.
You can update mbed if you put on a new firmware with version text file automatically.
It's really easy to update mbed in the distance.
The library compare versions between binary on a server and local file system on mbed.
How to use it?
mbed side
- Download your firmware. (e.g.: firm.bin) http://mbed.org/media/uploads/shintamainjp/firm.bin
- Make the version text file for the firmware. (e.g.: firm.txt) http://mbed.org/media/uploads/shintamainjp/firm.txt
10You can check the sequences if logging option enabled.
Server side
- Put on a new firmware on HTTP server. (e.g.: firm.bin) http://mbed.org/media/uploads/shintamainjp/firm.bin
- Put on the version text file for the firmware (e.g.: firm.txt) http://mbed.org/media/uploads/shintamainjp/firm.txt
25
Setup the library
FirmwareUpdater fwup("http://mbed.org/media/uploads/shintamainjp/", "firm", true);
Description
exist()
- Compare version files between on a server and on a mbed.
- Return 0 if a version on a server higher than a version on a mbed.
- Download a new firmware binary file to a temporary file.
- Download a new firmware version text file to a temporary file.
- Copy these new files to .bin and .txt.
- Reset mbed.
The interfaces
The interfaces are very simple.The test program
#include "mbed.h" #include "FirmwareUpdater.h" #include "EthernetNetIf.h" EthernetNetIf eth; FirmwareUpdater fwup("http://mbed.org/media/uploads/shintamainjp/", "firm", true); // There are 2 files for the firmware. // 1. firm.txt : firmware version file. // 2. firm.bin : firmware binary file. int main() { eth.setup(); if (fwup.exist() == 0) { printf("Found a new firmware.\n"); if (fwup.execute() == 0) { printf("Update succeed.\n"); printf("Resetting this system...\n\n\n\n\n"); fwup.reset(); } else { printf("Update failed!\n"); } } // Your application ... }
0 件のコメント:
コメントを投稿