This is the mail archive of the ecos-patches@sourceware.org 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]

Re: FlashV2 conflict


Andrew Lunn wrote:
On Fri, Apr 06, 2007 at 09:17:46AM -0600, Gary Thomas wrote:
There are some things in RedBoot (fs/fileio.c) which aren't
quite right when built using the trunk.  In particular, there
is use of CYGPKG_IO_FLASH_BLOCK_DEVICE_LEGACY which seems to
be only on the FLASHv2 branch.

What's the best way to fix this?  The attached patches make
file I/O to JFFS2 work on the trunk again for me.

Hi Gary


It looks like Jifl's merge in of eCosCentric's code broke it. My
guess is that eCosCentrics private tree has flashv2 as default, so
they would not of noticed the breakage.

Sorry about that.


I think it would be best if eCosCentric fixed this, so there is one
fix for both the public and their private tree. If say after a week
there is no fix from eCosCentric we take your patch.

We merge in stuff from anoncvs in due course anyway.


99% of Gary's patch is whitespace change so it's a bit hard to check through it (generally I think it's better to commit those separately to functional changes so version diffs don't get too confusing). So I'll commit a tweaked version of the fixes of substance in Gary's patch, and Gary can commit the whitespace changes separately.

I think rather than remove the use of CYGPKG_IO_FLASH_BLOCK_DEVICE_LEGACY I'd try and make it work with both - somewhat crudely, but it's only temporary until flashv2 is merged.

Attached patch committed.

Jifl
--
--["No sense being pessimistic, it wouldn't work anyway"]-- Opinions==mine
Index: ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos/packages/redboot/current/ChangeLog,v
retrieving revision 1.252
diff -u -5 -p -r1.252 ChangeLog
--- ChangeLog	24 Jan 2007 10:23:35 -0000	1.252
+++ ChangeLog	11 Apr 2007 13:48:58 -0000
@@ -1,5 +1,13 @@
+2007-04-11  Gary Thomas  <gary@mlbassoc.com>
+2007-04-11  Jonathan Larmour  <jifl@eCosCentric.com>
+
+	* src/fs/fileio.c: Temporary kludge to treat flash correctly if either
+	flash v1 or flash v2 used with this file.
+	(do_mount): silence warning. Include accidentally omitted printf arg.
+	(do_list): silence warning.
+
 2007-01-22  Peter Korsgaard  <peter.korsgaard@barco.com>
 
 	* src/load.c (do_load): Reset entry address before load so
 	go/exec commands will fail after an incomplete upload.
 
Index: src/fs/fileio.c
===================================================================
RCS file: /cvs/ecos/ecos/packages/redboot/current/src/fs/fileio.c,v
retrieving revision 1.7
diff -u -5 -p -r1.7 fileio.c
--- src/fs/fileio.c	20 Jul 2006 20:27:47 -0000	1.7
+++ src/fs/fileio.c	11 Apr 2007 13:48:58 -0000
@@ -62,10 +62,11 @@
 #include <stdio.h>
 #include <fcntl.h>
 #include <unistd.h>
 #include <string.h>
 #ifdef CYGPKG_IO_FLASH
+#include <pkgconf/io_flash.h>
 #include <cyg/io/io.h>
 #include <cyg/io/flash.h>
 #include <cyg/io/config_keys.h>
 #endif
 #include <cyg/io/devtab.h>
@@ -106,10 +107,21 @@ static struct
 //==========================================================================
 
 static void do_mount(int argc, char *argv[]);
 static void do_umount(int argc, char *argv[]);
 
+/* Temporary hack until flashv2 merged to trunk. We can't tell whether we're
+ * working with flash v1 or v2 from the package version. So if legacy device isn't
+ * defined we check whether, if there is a block device, there's a tell-tale define
+ * that only exists with the v1 version.
+ */
+#if !defined(CYGPKG_IO_FLASH_BLOCK_DEVICE_LEGACY) && \
+     defined(CYGPKG_IO_FLASH_BLOCK_DEVICE) && \
+     defined(CYGINT_IO_FLASH_BLOCK_CFG_1)
+# define CYGPKG_IO_FLASH_BLOCK_DEVICE_LEGACY 1
+#endif
+
 #ifdef CYGPKG_IO_FLASH_BLOCK_DEVICE_LEGACY
 #define FLASHPART "[-f <partition>] "
 #else
 #define FLASHPART
 #endif
@@ -172,24 +184,24 @@ do_mount(int argc, char *argv[])
         return;
     }
     
 #ifdef CYGPKG_IO_FLASH_BLOCK_DEVICE_LEGACY
     if (part_set) {
-        int len;
+        cyg_uint32 len;
         cyg_io_handle_t h;
 
         if (dev_set && strcmp(dev_str, CYGDAT_IO_FLASH_BLOCK_DEVICE_NAME_1)) {
             err_printf("fs mount: May only set one of <device> or <partition>\n");
             return;
         }
 
         dev_str = CYGDAT_IO_FLASH_BLOCK_DEVICE_NAME_1;
-        len = strlen(part_str);
+        len = (cyg_uint32)strlen(part_str);
 
         err = cyg_io_lookup(dev_str, &h);
         if (err < 0) {
-            err_printf("fs mount: cyg_io_lookup of \"%s\" returned %d\n", err);
+            err_printf("fs mount: cyg_io_lookup of \"%s\" returned %d\n", dev_str, err);
             return;
         }
         err = cyg_io_set_config(h, CYG_IO_SET_CONFIG_FLASH_FIS_NAME,
                                 part_str, &len);
         if (err < 0) {
@@ -340,11 +352,11 @@ do_list(int argc, char * argv[])
           diag_printf("%s%s%s",    // Ho, humm, have to hard code the shifts
                       rwx[(sbuf.st_mode & S_IRWXU) >> 16],
                       rwx[(sbuf.st_mode & S_IRWXG) >> 19],
                       rwx[(sbuf.st_mode & S_IRWXO) >> 22]);
           diag_printf(" %2d size %6d %s\n",
-                      sbuf.st_nlink,sbuf.st_size, 
+                      sbuf.st_nlink,(int)sbuf.st_size, 
                       entry->d_name);
      }
      
      closedir(dirp);
      return;

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