This is the mail archive of the ecos-patches@sources.redhat.com 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: redboot patch to make it compiling with gcc4 and higher


On Fri, 2004-12-03 at 05:00, Andrea Michelotti wrote:
> Hi Andrew,
> I found time to correct my mistakes (I hope).
> Here's the patch .

Applied, with some formatting changes (as attached).

p.s. are spaces more expensive in Italy?  I find code that's
been all scrunched up (no spaces) really hard to read.

-- 
Gary Thomas <gary@mlbassoc.com>
MLB Associates
Index: redboot/current/ChangeLog
===================================================================
RCS file: /misc/cvsfiles/ecos/packages/redboot/current/ChangeLog,v
retrieving revision 1.216
diff -u -5 -p -r1.216 ChangeLog
--- redboot/current/ChangeLog	9 Nov 2004 19:12:54 -0000	1.216
+++ redboot/current/ChangeLog	3 Dec 2004 12:06:50 -0000
@@ -1,5 +1,12 @@
+2004-12-01  Andrea Michelotti  <amichelotti@atmel.com>
+
+	* main.c :
+	* mfill.c: 
+	* mcmp.c : Changes required for use with GCC v4 - cast as lvalue
+	is no longer supported.
+
 2004-11-09  Ian Campbell  <icampbell@arcom.com>
 
 	* cdl/redboot.cdl, doc/redboot_cmds.sgml, src/iomem.c: Add support
 	for iopeek and iopoke commands to allow access to the I/O regions.
 
Index: redboot/current/src/main.c
===================================================================
RCS file: /misc/cvsfiles/ecos/packages/redboot/current/src/main.c,v
retrieving revision 1.60
diff -u -5 -p -r1.60 main.c
--- redboot/current/src/main.c	1 Sep 2004 21:21:30 -0000	1.60
+++ redboot/current/src/main.c	3 Dec 2004 12:04:54 -0000
@@ -238,10 +238,11 @@ static void error_handler(void)
 
 
 //
 // This is the main entry point for RedBoot
 //
+
 void
 cyg_start(void)
 {
     int res = 0;
     bool prompt = true;
@@ -322,10 +323,11 @@ cyg_start(void)
         cyg_plf_memory_segment(seg, &mem_segments[seg].start, &mem_segments[seg].end);
     }
 #endif
 
 #ifdef CYGSEM_REDBOOT_PLF_STARTUP
+
     cyg_plf_redboot_startup();
 #endif
     do_version(0,0);
 
 #ifdef CYGFUN_REDBOOT_BOOT_SCRIPT
@@ -390,12 +392,11 @@ cyg_start(void)
                 }
     
                 CYGACC_CALL_IF_SET_CONSOLE_COMM(cur);
 
                 // set up a temporary context that will take us to the trampoline
-                HAL_THREAD_INIT_CONTEXT((CYG_ADDRESS)workspace_end,
-                                        breakpoint, trampoline, 0);
+                HAL_THREAD_INIT_CONTEXT(workspace_end,breakpoint, trampoline,0);
 
                 // switch context to trampoline (get GDB stubs started)
                 HAL_THREAD_SWITCH_CONTEXT(&saved_context, &workspace_end);
 
                 gdb_active = false;
@@ -592,11 +593,11 @@ do_go(int argc, char *argv[])
 	HAL_DCACHE_SYNC();
     }
     HAL_ICACHE_INVALIDATE_ALL();
     HAL_DCACHE_INVALIDATE_ALL();
     // set up a temporary context that will take us to the trampoline
-    HAL_THREAD_INIT_CONTEXT((CYG_ADDRESS)workspace_end, entry, trampoline, 0);
+    HAL_THREAD_INIT_CONTEXT(workspace_end, entry, trampoline, 0);
 
     // switch context to trampoline
     HAL_THREAD_SWITCH_CONTEXT(&saved_context, &workspace_end);
 
     // we get back here by way of return_to_redboot()
Index: redboot/current/src/mcmp.c
===================================================================
RCS file: /misc/cvsfiles/ecos/packages/redboot/current/src/mcmp.c,v
retrieving revision 1.2
diff -u -5 -p -r1.2 mcmp.c
--- redboot/current/src/mcmp.c	24 Feb 2004 14:15:15 -0000	1.2
+++ redboot/current/src/mcmp.c	3 Dec 2004 12:13:47 -0000
@@ -88,44 +88,48 @@ do_mcmp(int argc, char *argv[])
     }
     if (!src_base_set || !dst_base_set || !len_set) {
         diag_printf("usage: mcmp -s <addr> -d <addr> -l <length> [-1|-2|-4]\n");
         return;
     }
-    // No checks here    
+
+    
+
     if (set_8bit) {
-        // Compare 8 bits at a time
+        cyg_uint8 *s = (cyg_uint8 *)src_base;
+        cyg_uint8 *d = (cyg_uint8 *)dst_base;
         while ((len -= sizeof(cyg_uint8)) >= 0) {
-            if (*((cyg_uint8 *)src_base)++ != *((cyg_uint8 *)dst_base)++) {
-                ((cyg_uint8 *)src_base)--;
-                ((cyg_uint8 *)dst_base)--;
+            if (*s++ != *d++) {
+                s--;
+                d--;
                 diag_printf("Buffers don't match - %p=0x%02x, %p=0x%02x\n",
-                            src_base, *((cyg_uint8 *)src_base),
-                            dst_base, *((cyg_uint8 *)dst_base));
+                            s, *s, d, *d);
                 return;
             }
+
         }
     } else if (set_16bit) {
-        // Compare 16 bits at a time
-        while ((len -= sizeof(cyg_uint16)) >= 0) {
-            if (*((cyg_uint16 *)src_base)++ != *((cyg_uint16 *)dst_base)++) {
-                ((cyg_uint16 *)src_base)--;
-                ((cyg_uint16 *)dst_base)--;
+	cyg_uint16 *s = (cyg_uint16 *)src_base;
+	cyg_uint16 *d = (cyg_uint16 *)dst_base;
+	while ((len -= sizeof(cyg_uint16)) >= 0) {
+            if (*s++ != *d++) { 
+                s--;
+                d--;
                 diag_printf("Buffers don't match - %p=0x%04x, %p=0x%04x\n",
-                            src_base, *((cyg_uint16 *)src_base),
-                            dst_base, *((cyg_uint16 *)dst_base));
+                            s, *s, d, *d);
                 return;
             }
-        }
+
+	}
     } else {
-        // Default - 32 bits
-        while ((len -= sizeof(cyg_uint32)) >= 0) {
-            if (*((cyg_uint32 *)src_base)++ != *((cyg_uint32 *)dst_base)++) {
-                ((cyg_uint32 *)src_base)--;
-                ((cyg_uint32 *)dst_base)--;
-                diag_printf("Buffers don't match - %p=0x%08x, %p=0x%08x\n",
-                            src_base, *((cyg_uint32 *)src_base),
-                            dst_base, *((cyg_uint32 *)dst_base));
-                return;
-            }
-        }
+      cyg_uint32 *s = (cyg_uint32 *)src_base;
+      cyg_uint32 *d = (cyg_uint32 *)dst_base;
+      while ((len -= sizeof(cyg_uint32)) >= 0) {
+	if (*s++ != *d++) {
+	  s--;
+	  d--;
+	  diag_printf("Buffers don't match - %p=0x%08x, %p=0x%08x\n",
+		      s, *s, d, *d);
+	  return;
+	}
+      }
     }
 }
Index: redboot/current/src/mfill.c
===================================================================
RCS file: /misc/cvsfiles/ecos/packages/redboot/current/src/mfill.c,v
retrieving revision 1.2
diff -u -5 -p -r1.2 mfill.c
--- redboot/current/src/mfill.c	24 Feb 2004 14:15:15 -0000	1.2
+++ redboot/current/src/mfill.c	3 Dec 2004 12:13:28 -0000
@@ -92,22 +92,22 @@ do_mfill(int argc, char *argv[])
     }
     if (!pat_set) {
         pat = 0;
     }
     // No checks here    
+
     if (set_8bit) {
-        // Fill 8 bits at a time
-        while ((len -= sizeof(cyg_uint8)) >= 0) {
-            *((cyg_uint8 *)base)++ = (cyg_uint8)pat;
-        }
+        cyg_uint8 *p = (cyg_uint8 *)base;
+        while ((len -= sizeof(cyg_uint8)) >= 0)
+            *p++ = (cyg_uint8)pat;
     } else if (set_16bit) {
-        // Fill 16 bits at a time
-        while ((len -= sizeof(cyg_uint16)) >= 0) {
-            *((cyg_uint16 *)base)++ = (cyg_uint16)pat;
-        }
+        cyg_uint16 *p = (cyg_uint16 *)base;
+        while ((len -= sizeof(cyg_uint16)) >= 0)
+            *p++ = (cyg_uint16)pat;
     } else {
-        // Default - 32 bits
-        while ((len -= sizeof(cyg_uint32)) >= 0) {
-            *((cyg_uint32 *)base)++ = (cyg_uint32)pat;
-        }
+        cyg_uint32 *p = (cyg_uint32 *)base;
+        while ((len -= sizeof(cyg_uint32)) >= 0)
+            *p++ = (cyg_uint32)pat;
     }
+    
 }
+

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