This is the mail archive of the
ecos-devel@sources.redhat.com
mailing list for the eCos project.
AW: contributing a failsafe update meachanism for FIS from within ecos applications
- From: "Neundorf, Alexander" <Alexander dot Neundorf at jenoptik dot com>
- To: "Andrew Lunn" <andrew at lunn dot ch>
- Cc: <ecos-devel at sources dot redhat dot com>
- Date: Wed, 20 Oct 2004 09:07:02 +0200
- Subject: AW: contributing a failsafe update meachanism for FIS from within ecos applications
Hi,
one more word to the actual firmware update, the code which does the actual update later on looks like this:
#define FIS_START <insert your flash start address here>
#define FIS_APP_1 0x040000 //fixed location of firmware image 1
#define FIS_APP_1 0x240000 //fixed location of firmware image 2
-----------------
CYG_ADDRESS addr=FIS_START+FIS_APP_1;
fis_image_desc* img=FisFS::getEntry("/myapp");
if (img!=0)
{
//find out which image is currently running
//and choose the other address for the new image
if (img->flash_base==FIS_START+FIS_APP_1)
addr=FIS_START+FIS_APP_2;
else
addr=FIS_START+FIS_APP_1;
}
//write the image and create a backup
int res=FisFS::createImage("/myapp", firmwareImageBuffer,
addr, 0x20000, maxLength,
0x20040, size, true);
------
And the fis boot script looks like this:
fis load myapp; go
So after createImage() was successfully, the old /myapp is renamed to /myapp~, and redboot will find the new image under the name /myapp.
If createImage() fails, redboot will still read the "old" fis table where /myapp is still the unchanged old firmware image.
Bye
Alex