This is the mail archive of the mailing list for the eCos project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

AW: contributing a failsafe update meachanism for FIS from within ecos applications


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


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)  

//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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]