Christophe Coutand wrote:
Code is not executing properly if CYGFUN_IO_FLASH_BLOCK_FROM_FIS is
enable and CYGFUN_IO_FLASH_BLOCK_FROM_DEVOFFSET is disable.

Good catch, thanks for the patch! I've simplified it a little, and so checked in the below.

Jifl

Index: ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos/packages/io/flash/current/ChangeLog,v
retrieving revision 1.51
diff -u -5 -p -r1.51 ChangeLog
--- ChangeLog   20 Feb 2009 22:06:15 -0000      1.51
+++ ChangeLog   15 May 2010 16:40:34 -0000
@@ -1,5 +1,11 @@
+2010-05-15  Christophe Coutand <[email protected]>
+
+       * src/flashiodev.c (flashiodev_lookup): Fix wrong code execution if
+       CYGFUN_IO_FLASH_BLOCK_FROM_FIS is enabled and
+       CYGFUN_IO_FLASH_BLOCK_FROM_DEVOFFSET is disabled.
+
 2009-02-20  Jonathan Larmour  <[email protected]>

        * include/flash.h: Reinstate printf arg to cyg_flash_init, but it
        will now be officially required to be set to NULL.
        * src/flash.c (cyg_flash_init): Act on printf arg again (even though
Index: src/flashiodev.c
===================================================================
RCS file: /cvs/ecos/ecos/packages/io/flash/current/src/flashiodev.c,v
retrieving revision 1.12
diff -u -5 -p -r1.12 flashiodev.c
--- src/flashiodev.c    20 Feb 2009 22:06:15 -0000      1.12
+++ src/flashiodev.c    15 May 2010 16:40:34 -0000
@@ -245,11 +245,14 @@ flashiodev_lookup(struct cyg_devtab_entr
                                         &size))
return -ENODEV; // If the previous call worked, then this failing would be very wrong.
         start = flash_base;
         end = flash_base + size - 1;
         valid = true;
-    } else
+    }
+# ifdef CYGFUN_IO_FLASH_BLOCK_FROM_DEVOFFSET
+    else
+# endif
 #endif // ifdef CYGFUN_IO_FLASH_BLOCK_FROM_FIS
 #ifdef CYGFUN_IO_FLASH_BLOCK_FROM_DEVOFFSET
     // Next, support device numbers with offsets encoded in path name
// Note that for now we assume < 10 flash devices. I think this is reasonable
     // to avoid unnecessary code. It can be changed later if needed.

--
------["The best things in life aren't things."]------      Opinions==mine

Reply via email to