This is the mail archive of the
ecos-patches@sources.redhat.com
mailing list for the eCos project.
RedBoot: avoid unnecessary flash erase in fis init
- From: Jonathan Larmour <jlarmour at jifvik dot org>
- To: ecos-patches at ecos dot sourceware dot org
- Date: Tue, 31 Aug 2004 20:43:57 +0100
- Subject: RedBoot: avoid unnecessary flash erase in fis init
Index: ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos/packages/redboot/current/ChangeLog,v
retrieving revision 1.202
diff -u -5 -p -r1.202 ChangeLog
--- ChangeLog 27 Aug 2004 13:27:40 -0000 1.202
+++ ChangeLog 31 Aug 2004 19:43:54 -0000
@@ -1,5 +1,10 @@
+2004-08-31 Jonathan Larmour <jifl@eCosCentric.com>
+
+ * src/flash.c (fis_init): Avoid potentially unnecessary erase
+ attempt at end of flash.
+
2004-08-27 Peter Korsgaard <jacmet@sunsite.dk>
* doc/redboot_cmds.sgml: Fixed a minor typo with fis list
2004-08-17 Andrew Lunn <andrew.lunn@ascom.ch>
Index: src/flash.c
===================================================================
RCS file: /cvs/ecos/ecos/packages/redboot/current/src/flash.c,v
retrieving revision 1.67
diff -u -5 -p -r1.67 flash.c
--- src/flash.c 25 Jun 2004 15:49:43 -0000 1.67
+++ src/flash.c 31 Aug 2004 19:43:54 -0000
@@ -420,16 +420,18 @@ fis_init(int argc, char *argv[])
diag_printf(" initialization failed %p: %s\n",
err_addr, flash_errmsg(stat));
}
erase_start += (erase_size + flash_block_size);
#endif
- // Lastly, anything at the end
- erase_size = ((CYG_ADDRESS)flash_end - erase_start) + 1;
- if ((stat = flash_erase((void *)erase_start, erase_size,
- (void **)&err_addr)) != 0) {
- diag_printf(" initialization failed at %p: %s\n",
- err_addr, flash_errmsg(stat));
+ // Lastly, anything at the end, if there is any
+ if ( erase_start < (((CYG_ADDRESS)flash_end)+1) ) {
+ erase_size = ((CYG_ADDRESS)flash_end - erase_start) + 1;
+ if ((stat = flash_erase((void *)erase_start, erase_size,
+ (void **)&err_addr)) != 0) {
+ diag_printf(" initialization failed at %p: %s\n",
+ err_addr, flash_errmsg(stat));
+ }
}
#ifndef CYGDAT_REDBOOT_FIS_MAX_FREE_CHUNKS
// In this case, 'fis free' works by scanning for erased blocks. Since the
// "-f" option was not supplied, there may be areas which are not used but
// don't appear to be free since they are not erased - thus the warning