changeset 264:57f3c72256bb

Reorg CLI functions into separate files. Update CDL. Fix macros in scripts.
author gthomas
date Tue, 06 Aug 2002 14:29:11 +0000
parents c0d53837cb68
children 96fac1fabc4c
files packages/redboot/current/ChangeLog packages/redboot/current/cdl/redboot.cdl packages/redboot/current/src/caches.c packages/redboot/current/src/cksum.c packages/redboot/current/src/crc.c packages/redboot/current/src/dump.c packages/redboot/current/src/io.c packages/redboot/current/src/main.c packages/redboot/current/src/mcmp.c packages/redboot/current/src/mfill.c
diffstat 10 files changed, 739 insertions(+), 403 deletions(-) [+]
line wrap: on
line diff
--- a/packages/redboot/current/ChangeLog
+++ b/packages/redboot/current/ChangeLog
@@ -1,3 +1,28 @@
+2002-08-06  Gary Thomas  <gary@chez-thomas.org>
+
+	* src/crc.c: POSIX crc code is now separate.
+	
+	* src/mfill.c: 
+	* src/mcmp.c: 
+	* src/dump.c: 
+	* src/cksum.c: 
+	* src/caches.c: New (split out) file(s).
+
+	* src/main.c: 
+	* cdl/redboot.cdl: Split major CLI functionality to separate
+	files, more easily controlled by CDL - inspired by Andrew.
+
+2002-08-06  Andrew Lunn  <Andrew.Lunn@ascom.ch>
+
+	* src/io.c: Fix the parsing of boot scripts to allow the use
+	  of aliases. This was broken when the ability to do startup
+	  type specific scripting was added.
+
+2002-08-05  Andrew Lunn  <Andrew.Lunn@ascom.ch>
+
+	* src/main.c: Made more of the commands conditionally compilable
+	* cdl/redboot.cdl: CDL code to control the compilation.
+	
 2002-07-30  Gary Thomas  <gary@chez-thomas.org>
 
 	* src/net/net_io.c: Handle broadcast/mask setup better (failed if
--- a/packages/redboot/current/cdl/redboot.cdl
+++ b/packages/redboot/current/cdl/redboot.cdl
@@ -43,7 +43,7 @@
 #
 # Author(s):      gthomas
 # Original data:  gthomas
-# Contributors:   Philippe Robin
+# Contributors:   Philippe Robin, Andrew Lunn
 # Date:           2000-05-01
 #
 #####DESCRIPTIONEND####
@@ -68,6 +68,11 @@ cdl_package CYGPKG_REDBOOT {
         default_value 1
     }
 
+
+    cdl_interface CYGINT_REDBOOT_LOAD_METHOD {
+        display "Methods of loading images using redboot"
+    }
+
     cdl_component CYGBLD_BUILD_REDBOOT {
         display "Build Redboot ROM ELF image"
         default_value 0
@@ -87,15 +92,7 @@ cdl_package CYGPKG_REDBOOT {
 
         requires CYGINT_ISO_STRING_MEMFUNCS 
         requires CYGINT_ISO_STRING_STRFUNCS
-
-        cdl_option CYGBLD_BUILD_REDBOOT_WITH_ZLIB {
-            display       "Include support gzip/zlib decompression"
-            active_if     CYGPKG_COMPRESS_ZLIB
-            no_define
-            default_value 1
-            implements    CYGINT_COMPRESS_ZLIB_LOCAL_ALLOC
-            compile       decompress.c
-        }
+        requires CYGINT_REDBOOT_LOAD_METHOD
 
         cdl_option CYGBLD_BUILD_REDBOOT_WITH_THREADS {
             display "Threads debugging support"
@@ -130,19 +127,57 @@ cdl_package CYGPKG_REDBOOT {
                enable rudimentary editting of the lines themselves."
         }
 
+        cdl_option CYGBLD_BUILD_REDBOOT_WITH_ZLIB {
+            display       "Include support gzip/zlib decompression"
+            active_if     CYGPKG_COMPRESS_ZLIB
+            no_define
+            default_value 1
+            implements    CYGINT_COMPRESS_ZLIB_LOCAL_ALLOC
+            compile       decompress.c
+        }
+
+        cdl_option CYGBLD_BUILD_REDBOOT_WITH_XYZMODEM {
+            display       "Include support for xyzModem downloads"
+            no_define
+            default_value 1
+            implements    CYGINT_REDBOOT_LOAD_METHOD
+            compile -library=libextras.a xyzModem.c
+        }
+
         cdl_option CYGBLD_BUILD_REDBOOT_WITH_CKSUM {
             display       "Include POSIX checksum command"
             default_value 1
+            compile -library=libextras.a cksum.c
         }
 
         cdl_option CYGBLD_BUILD_REDBOOT_WITH_MFILL {
             display       "Include memory fill command"
             default_value 1
+            compile -library=libextras.a mfill.c
         }
 
         cdl_option CYGBLD_BUILD_REDBOOT_WITH_MCMP {
             display       "Include memory compare command"
             default_value 1
+            compile -library=libextras.a mcmp.c
+        }
+
+        cdl_option CYGBLD_BUILD_REDBOOT_WITH_DUMP {
+            display       "Include memory dump command"
+            default_value 1
+            compile -library=libextras.a dump.c
+        }
+
+        cdl_option CYGBLD_BUILD_REDBOOT_WITH_CACHES {
+            display       "Include cache command"
+            default_value 1
+            compile -library=libextras.a caches.c
+        }
+
+        cdl_option CYGBLD_BUILD_REDBOOT_WITH_EXEC {
+            display       "Include exec command"
+            default_value 1
+            # Implemented within the platform HAL
         }
 
         no_define
@@ -153,7 +188,7 @@ cdl_package CYGPKG_REDBOOT {
 
         compile main.c crc.c
         compile misc_funs.c io.c parse.c ticks.c syscall.c alias.c
-        compile -library=libextras.a load.c xyzModem.c 
+        compile -library=libextras.a load.c
 
         make -priority 320 {
             <PREFIX>/bin/redboot.elf : $(PREFIX)/lib/target.ld $(PREFIX)/lib/vectors.o $(PREFIX)/lib/libtarget.a $(PREFIX)/lib/libextras.a
@@ -168,6 +203,7 @@ cdl_package CYGPKG_REDBOOT {
         flavor        bool
         active_if     CYGPKG_IO_ETH_DRIVERS
         default_value 1
+        implements    CYGINT_REDBOOT_LOAD_METHOD
         compile net/bootp.c net/udp.c net/ip.c net/pktbuf.c net/cksum.c
         compile net/enet.c net/icmp.c net/tcp.c net/timers.c net/arp.c
         compile net/net_io.c net/inet_addr.c
new file mode 100644
--- /dev/null
+++ b/packages/redboot/current/src/caches.c
@@ -0,0 +1,101 @@
+//==========================================================================
+//
+//      caches.c
+//
+//      RedBoot cache control functions
+//
+//==========================================================================
+//####ECOSGPLCOPYRIGHTBEGIN####
+// -------------------------------------------
+// This file is part of eCos, the Embedded Configurable Operating System.
+// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
+// Copyright (C) 2002 Gary Thomas
+//
+// eCos is free software; you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation; either version 2 or (at your option) any later version.
+//
+// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
+// WARRANTY; without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+// for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with eCos; if not, write to the Free Software Foundation, Inc.,
+// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+//
+// As a special exception, if other files instantiate templates or use macros
+// or inline functions from this file, or you compile this file and link it
+// with other works to produce a work based on this file, this file does not
+// by itself cause the resulting work to be covered by the GNU General Public
+// License. However the source code for this file must still be made available
+// in accordance with section (3) of the GNU General Public License.
+//
+// This exception does not invalidate any other reasons why a work based on
+// this file might be covered by the GNU General Public License.
+//
+// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
+// at http://sources.redhat.com/ecos/ecos-license/
+// -------------------------------------------
+//####ECOSGPLCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s):    gthomas
+// Contributors: gthomas
+// Date:         2002-08-06
+// Purpose:      
+// Description:  
+//              
+// This code is part of RedBoot (tm).
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+#include <redboot.h>
+#include <cyg/hal/hal_arch.h>
+#include <cyg/hal/hal_intr.h>
+#include <cyg/hal/hal_cache.h>
+
+RedBoot_cmd("cache", 
+            "Manage machine caches", 
+            "[ON | OFF]",
+            do_caches 
+    );
+
+void
+do_caches(int argc, char *argv[])
+{
+    unsigned long oldints;
+    int dcache_on=0, icache_on=0;
+
+    if (argc == 2) {
+        if (strcasecmp(argv[1], "on") == 0) {
+            HAL_DISABLE_INTERRUPTS(oldints);
+            HAL_ICACHE_ENABLE();
+            HAL_DCACHE_ENABLE();
+            HAL_RESTORE_INTERRUPTS(oldints);
+        } else if (strcasecmp(argv[1], "off") == 0) {
+            HAL_DISABLE_INTERRUPTS(oldints);
+            HAL_DCACHE_SYNC();
+            HAL_ICACHE_DISABLE();
+            HAL_DCACHE_DISABLE();
+            HAL_DCACHE_SYNC();
+            HAL_ICACHE_INVALIDATE_ALL();
+            HAL_DCACHE_INVALIDATE_ALL();
+            HAL_RESTORE_INTERRUPTS(oldints);
+        } else {
+            diag_printf("Invalid cache mode: %s\n", argv[1]);
+        }
+    } else {
+#ifdef HAL_DCACHE_IS_ENABLED
+        HAL_DCACHE_IS_ENABLED(dcache_on);
+#endif
+#ifdef HAL_ICACHE_IS_ENABLED
+        HAL_ICACHE_IS_ENABLED(icache_on);
+#endif
+        diag_printf("Data cache: %s, Instruction cache: %s\n", 
+                    dcache_on?"On":"Off", icache_on?"On":"Off");
+    }
+}
new file mode 100644
--- /dev/null
+++ b/packages/redboot/current/src/cksum.c
@@ -0,0 +1,155 @@
+//==========================================================================
+//
+//      cksum.c
+//
+//      RedBoot POSIX CRC calculation/command
+//
+//==========================================================================
+//####ECOSGPLCOPYRIGHTBEGIN####
+// -------------------------------------------
+// This file is part of eCos, the Embedded Configurable Operating System.
+// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
+// Copyright (C) 2002 Gary Thomas
+//
+// eCos is free software; you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation; either version 2 or (at your option) any later version.
+//
+// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
+// WARRANTY; without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+// for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with eCos; if not, write to the Free Software Foundation, Inc.,
+// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+//
+// As a special exception, if other files instantiate templates or use macros
+// or inline functions from this file, or you compile this file and link it
+// with other works to produce a work based on this file, this file does not
+// by itself cause the resulting work to be covered by the GNU General Public
+// License. However the source code for this file must still be made available
+// in accordance with section (3) of the GNU General Public License.
+//
+// This exception does not invalidate any other reasons why a work based on
+// this file might be covered by the GNU General Public License.
+//
+// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
+// at http://sources.redhat.com/ecos/ecos-license/
+// -------------------------------------------
+//####ECOSGPLCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s):    gthomas
+// Contributors: gthomas
+// Date:         2001-01-31
+// Purpose:      
+// Description:  
+//              
+// This code is part of RedBoot (tm).
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+#include <redboot.h>
+
+// Compute a CRC, using the POSIX 1003 definition
+
+RedBoot_cmd("cksum", 
+            "Compute a 32bit checksum [POSIX algorithm] for a range of memory", 
+            "-b <location> -l <length>",
+            do_cksum
+    );
+
+// Same basic algorithm as CRC-16, but the bits are defined in the
+// opposite order.  This computation matches the output of the
+// Linux 'cksum' program.
+
+static const unsigned long posix_crc32_tab[] = {
+  0x00000000, 0x04C11DB7, 0x09823B6E, 0x0D4326D9, 0x130476DC, 0x17C56B6B, 0x1A864DB2, 0x1E475005, 
+  0x2608EDB8, 0x22C9F00F, 0x2F8AD6D6, 0x2B4BCB61, 0x350C9B64, 0x31CD86D3, 0x3C8EA00A, 0x384FBDBD,
+  0x4C11DB70, 0x48D0C6C7, 0x4593E01E, 0x4152FDA9, 0x5F15ADAC, 0x5BD4B01B, 0x569796C2, 0x52568B75, 
+  0x6A1936C8, 0x6ED82B7F, 0x639B0DA6, 0x675A1011, 0x791D4014, 0x7DDC5DA3, 0x709F7B7A, 0x745E66CD, 
+  0x9823B6E0, 0x9CE2AB57, 0x91A18D8E, 0x95609039, 0x8B27C03C, 0x8FE6DD8B, 0x82A5FB52, 0x8664E6E5, 
+  0xBE2B5B58, 0xBAEA46EF, 0xB7A96036, 0xB3687D81, 0xAD2F2D84, 0xA9EE3033, 0xA4AD16EA, 0xA06C0B5D, 
+  0xD4326D90, 0xD0F37027, 0xDDB056FE, 0xD9714B49, 0xC7361B4C, 0xC3F706FB, 0xCEB42022, 0xCA753D95,
+  0xF23A8028, 0xF6FB9D9F, 0xFBB8BB46, 0xFF79A6F1, 0xE13EF6F4, 0xE5FFEB43, 0xE8BCCD9A, 0xEC7DD02D, 
+  0x34867077, 0x30476DC0, 0x3D044B19, 0x39C556AE, 0x278206AB, 0x23431B1C, 0x2E003DC5, 0x2AC12072, 
+  0x128E9DCF, 0x164F8078, 0x1B0CA6A1, 0x1FCDBB16, 0x018AEB13, 0x054BF6A4, 0x0808D07D, 0x0CC9CDCA, 
+  0x7897AB07, 0x7C56B6B0, 0x71159069, 0x75D48DDE, 0x6B93DDDB, 0x6F52C06C, 0x6211E6B5, 0x66D0FB02, 
+  0x5E9F46BF, 0x5A5E5B08, 0x571D7DD1, 0x53DC6066, 0x4D9B3063, 0x495A2DD4, 0x44190B0D, 0x40D816BA,
+  0xACA5C697, 0xA864DB20, 0xA527FDF9, 0xA1E6E04E, 0xBFA1B04B, 0xBB60ADFC, 0xB6238B25, 0xB2E29692, 
+  0x8AAD2B2F, 0x8E6C3698, 0x832F1041, 0x87EE0DF6, 0x99A95DF3, 0x9D684044, 0x902B669D, 0x94EA7B2A, 
+  0xE0B41DE7, 0xE4750050, 0xE9362689, 0xEDF73B3E, 0xF3B06B3B, 0xF771768C, 0xFA325055, 0xFEF34DE2, 
+  0xC6BCF05F, 0xC27DEDE8, 0xCF3ECB31, 0xCBFFD686, 0xD5B88683, 0xD1799B34, 0xDC3ABDED, 0xD8FBA05A, 
+  0x690CE0EE, 0x6DCDFD59, 0x608EDB80, 0x644FC637, 0x7A089632, 0x7EC98B85, 0x738AAD5C, 0x774BB0EB,
+  0x4F040D56, 0x4BC510E1, 0x46863638, 0x42472B8F, 0x5C007B8A, 0x58C1663D, 0x558240E4, 0x51435D53, 
+  0x251D3B9E, 0x21DC2629, 0x2C9F00F0, 0x285E1D47, 0x36194D42, 0x32D850F5, 0x3F9B762C, 0x3B5A6B9B, 
+  0x0315D626, 0x07D4CB91, 0x0A97ED48, 0x0E56F0FF, 0x1011A0FA, 0x14D0BD4D, 0x19939B94, 0x1D528623, 
+  0xF12F560E, 0xF5EE4BB9, 0xF8AD6D60, 0xFC6C70D7, 0xE22B20D2, 0xE6EA3D65, 0xEBA91BBC, 0xEF68060B, 
+  0xD727BBB6, 0xD3E6A601, 0xDEA580D8, 0xDA649D6F, 0xC423CD6A, 0xC0E2D0DD, 0xCDA1F604, 0xC960EBB3,
+  0xBD3E8D7E, 0xB9FF90C9, 0xB4BCB610, 0xB07DABA7, 0xAE3AFBA2, 0xAAFBE615, 0xA7B8C0CC, 0xA379DD7B, 
+  0x9B3660C6, 0x9FF77D71, 0x92B45BA8, 0x9675461F, 0x8832161A, 0x8CF30BAD, 0x81B02D74, 0x857130C3, 
+  0x5D8A9099, 0x594B8D2E, 0x5408ABF7, 0x50C9B640, 0x4E8EE645, 0x4A4FFBF2, 0x470CDD2B, 0x43CDC09C, 
+  0x7B827D21, 0x7F436096, 0x7200464F, 0x76C15BF8, 0x68860BFD, 0x6C47164A, 0x61043093, 0x65C52D24, 
+  0x119B4BE9, 0x155A565E, 0x18197087, 0x1CD86D30, 0x029F3D35, 0x065E2082, 0x0B1D065B, 0x0FDC1BEC,
+  0x3793A651, 0x3352BBE6, 0x3E119D3F, 0x3AD08088, 0x2497D08D, 0x2056CD3A, 0x2D15EBE3, 0x29D4F654, 
+  0xC5A92679, 0xC1683BCE, 0xCC2B1D17, 0xC8EA00A0, 0xD6AD50A5, 0xD26C4D12, 0xDF2F6BCB, 0xDBEE767C, 
+  0xE3A1CBC1, 0xE760D676, 0xEA23F0AF, 0xEEE2ED18, 0xF0A5BD1D, 0xF464A0AA, 0xF9278673, 0xFDE69BC4, 
+  0x89B8FD09, 0x8D79E0BE, 0x803AC667, 0x84FBDBD0, 0x9ABC8BD5, 0x9E7D9662, 0x933EB0BB, 0x97FFAD0C, 
+  0xAFB010B1, 0xAB710D06, 0xA6322BDF, 0xA2F33668, 0xBCB4666D, 0xB8757BDA, 0xB5365D03, 0xB1F740B4
+   };
+
+static unsigned long 
+posix_crc32(unsigned char *s, int len)
+{
+  int i;
+  unsigned long crc32val;
+  unsigned long length;
+  
+  crc32val = 0;
+  for (i = 0;  i < len;  i++) {
+      crc32val = (crc32val << 8) ^ posix_crc32_tab[((crc32val >> 24) ^ *s++) & 0xFF];
+  }
+  length = len;
+  while (length > 0) {
+      crc32val = (crc32val << 8) ^ posix_crc32_tab[((crc32val >> 24) ^ length) & 0xFF];
+      length >>= 8;
+  }
+  crc32val = ~crc32val;
+  return crc32val;
+}
+
+void
+do_cksum(int argc, char *argv[])
+{
+    struct option_info opts[2];
+    unsigned long base, len, crc;
+    bool base_set, len_set;
+
+    init_opts(&opts[0], 'b', true, OPTION_ARG_TYPE_NUM, 
+              (void **)&base, (bool *)&base_set, "base address");
+    init_opts(&opts[1], 'l', true, OPTION_ARG_TYPE_NUM, 
+              (void **)&len, (bool *)&len_set, "length");
+    if (!scan_opts(argc, argv, 1, opts, 2, 0, 0, "")) {
+        return;
+    }
+    if (!base_set || !len_set) {
+	if (load_address >= (CYG_ADDRESS)ram_start &&
+	    load_address_end < (CYG_ADDRESS)ram_end &&
+	    load_address < load_address_end) {
+	    base = load_address;
+	    len = load_address_end - load_address;
+            diag_printf("Computing cksum for area %p-%p\n",
+                        base, load_address_end);
+	} else {
+	    diag_printf("usage: cksum -b <addr> -l <length>\n");
+	    return;
+	}
+    }
+    crc = posix_crc32((unsigned char *)base, len);
+    diag_printf("POSIX cksum = %lu %lu (0x%08lx 0x%08lx)\n", crc, len, crc, len);
+}
+
--- a/packages/redboot/current/src/crc.c
+++ b/packages/redboot/current/src/crc.c
@@ -9,6 +9,7 @@
 // -------------------------------------------
 // This file is part of eCos, the Embedded Configurable Operating System.
 // Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
+// Copyright (C) 2002 Gary Thomas
 //
 // eCos is free software; you can redistribute it and/or modify it under
 // the terms of the GNU General Public License as published by the Free
@@ -182,64 +183,3 @@ crc32(unsigned char *s, int len)
   }
   return crc32val;
 }
-
-// Same basic algorithm as above, but the bits are defined in the
-// opposite order.  This computation matches the output of the
-// Linux 'cksum' program.
-
-static const unsigned long posix_crc32_tab[] = {
-  0x00000000, 0x04C11DB7, 0x09823B6E, 0x0D4326D9, 0x130476DC, 0x17C56B6B, 0x1A864DB2, 0x1E475005, 
-  0x2608EDB8, 0x22C9F00F, 0x2F8AD6D6, 0x2B4BCB61, 0x350C9B64, 0x31CD86D3, 0x3C8EA00A, 0x384FBDBD,
-  0x4C11DB70, 0x48D0C6C7, 0x4593E01E, 0x4152FDA9, 0x5F15ADAC, 0x5BD4B01B, 0x569796C2, 0x52568B75, 
-  0x6A1936C8, 0x6ED82B7F, 0x639B0DA6, 0x675A1011, 0x791D4014, 0x7DDC5DA3, 0x709F7B7A, 0x745E66CD, 
-  0x9823B6E0, 0x9CE2AB57, 0x91A18D8E, 0x95609039, 0x8B27C03C, 0x8FE6DD8B, 0x82A5FB52, 0x8664E6E5, 
-  0xBE2B5B58, 0xBAEA46EF, 0xB7A96036, 0xB3687D81, 0xAD2F2D84, 0xA9EE3033, 0xA4AD16EA, 0xA06C0B5D, 
-  0xD4326D90, 0xD0F37027, 0xDDB056FE, 0xD9714B49, 0xC7361B4C, 0xC3F706FB, 0xCEB42022, 0xCA753D95,
-  0xF23A8028, 0xF6FB9D9F, 0xFBB8BB46, 0xFF79A6F1, 0xE13EF6F4, 0xE5FFEB43, 0xE8BCCD9A, 0xEC7DD02D, 
-  0x34867077, 0x30476DC0, 0x3D044B19, 0x39C556AE, 0x278206AB, 0x23431B1C, 0x2E003DC5, 0x2AC12072, 
-  0x128E9DCF, 0x164F8078, 0x1B0CA6A1, 0x1FCDBB16, 0x018AEB13, 0x054BF6A4, 0x0808D07D, 0x0CC9CDCA, 
-  0x7897AB07, 0x7C56B6B0, 0x71159069, 0x75D48DDE, 0x6B93DDDB, 0x6F52C06C, 0x6211E6B5, 0x66D0FB02, 
-  0x5E9F46BF, 0x5A5E5B08, 0x571D7DD1, 0x53DC6066, 0x4D9B3063, 0x495A2DD4, 0x44190B0D, 0x40D816BA,
-  0xACA5C697, 0xA864DB20, 0xA527FDF9, 0xA1E6E04E, 0xBFA1B04B, 0xBB60ADFC, 0xB6238B25, 0xB2E29692, 
-  0x8AAD2B2F, 0x8E6C3698, 0x832F1041, 0x87EE0DF6, 0x99A95DF3, 0x9D684044, 0x902B669D, 0x94EA7B2A, 
-  0xE0B41DE7, 0xE4750050, 0xE9362689, 0xEDF73B3E, 0xF3B06B3B, 0xF771768C, 0xFA325055, 0xFEF34DE2, 
-  0xC6BCF05F, 0xC27DEDE8, 0xCF3ECB31, 0xCBFFD686, 0xD5B88683, 0xD1799B34, 0xDC3ABDED, 0xD8FBA05A, 
-  0x690CE0EE, 0x6DCDFD59, 0x608EDB80, 0x644FC637, 0x7A089632, 0x7EC98B85, 0x738AAD5C, 0x774BB0EB,
-  0x4F040D56, 0x4BC510E1, 0x46863638, 0x42472B8F, 0x5C007B8A, 0x58C1663D, 0x558240E4, 0x51435D53, 
-  0x251D3B9E, 0x21DC2629, 0x2C9F00F0, 0x285E1D47, 0x36194D42, 0x32D850F5, 0x3F9B762C, 0x3B5A6B9B, 
-  0x0315D626, 0x07D4CB91, 0x0A97ED48, 0x0E56F0FF, 0x1011A0FA, 0x14D0BD4D, 0x19939B94, 0x1D528623, 
-  0xF12F560E, 0xF5EE4BB9, 0xF8AD6D60, 0xFC6C70D7, 0xE22B20D2, 0xE6EA3D65, 0xEBA91BBC, 0xEF68060B, 
-  0xD727BBB6, 0xD3E6A601, 0xDEA580D8, 0xDA649D6F, 0xC423CD6A, 0xC0E2D0DD, 0xCDA1F604, 0xC960EBB3,
-  0xBD3E8D7E, 0xB9FF90C9, 0xB4BCB610, 0xB07DABA7, 0xAE3AFBA2, 0xAAFBE615, 0xA7B8C0CC, 0xA379DD7B, 
-  0x9B3660C6, 0x9FF77D71, 0x92B45BA8, 0x9675461F, 0x8832161A, 0x8CF30BAD, 0x81B02D74, 0x857130C3, 
-  0x5D8A9099, 0x594B8D2E, 0x5408ABF7, 0x50C9B640, 0x4E8EE645, 0x4A4FFBF2, 0x470CDD2B, 0x43CDC09C, 
-  0x7B827D21, 0x7F436096, 0x7200464F, 0x76C15BF8, 0x68860BFD, 0x6C47164A, 0x61043093, 0x65C52D24, 
-  0x119B4BE9, 0x155A565E, 0x18197087, 0x1CD86D30, 0x029F3D35, 0x065E2082, 0x0B1D065B, 0x0FDC1BEC,
-  0x3793A651, 0x3352BBE6, 0x3E119D3F, 0x3AD08088, 0x2497D08D, 0x2056CD3A, 0x2D15EBE3, 0x29D4F654, 
-  0xC5A92679, 0xC1683BCE, 0xCC2B1D17, 0xC8EA00A0, 0xD6AD50A5, 0xD26C4D12, 0xDF2F6BCB, 0xDBEE767C, 
-  0xE3A1CBC1, 0xE760D676, 0xEA23F0AF, 0xEEE2ED18, 0xF0A5BD1D, 0xF464A0AA, 0xF9278673, 0xFDE69BC4, 
-  0x89B8FD09, 0x8D79E0BE, 0x803AC667, 0x84FBDBD0, 0x9ABC8BD5, 0x9E7D9662, 0x933EB0BB, 0x97FFAD0C, 
-  0xAFB010B1, 0xAB710D06, 0xA6322BDF, 0xA2F33668, 0xBCB4666D, 0xB8757BDA, 0xB5365D03, 0xB1F740B4
-   };
-
-// Compute a CRC, using the POSIX 1003 definition
-
-unsigned long 
-posix_crc32(unsigned char *s, int len)
-{
-  int i;
-  unsigned long crc32val;
-  unsigned long length;
-  
-  crc32val = 0;
-  for (i = 0;  i < len;  i++) {
-      crc32val = (crc32val << 8) ^ posix_crc32_tab[((crc32val >> 24) ^ *s++) & 0xFF];
-  }
-  length = len;
-  while (length > 0) {
-      crc32val = (crc32val << 8) ^ posix_crc32_tab[((crc32val >> 24) ^ length) & 0xFF];
-      length >>= 8;
-  }
-  crc32val = ~crc32val;
-  return crc32val;
-}
new file mode 100644
--- /dev/null
+++ b/packages/redboot/current/src/dump.c
@@ -0,0 +1,158 @@
+//==========================================================================
+//
+//      dump.c
+//
+//      RedBoot dump support
+//
+//==========================================================================
+//####ECOSGPLCOPYRIGHTBEGIN####
+// -------------------------------------------
+// This file is part of eCos, the Embedded Configurable Operating System.
+// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
+// Copyright (C) 2002 Gary Thomas
+//
+// eCos is free software; you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation; either version 2 or (at your option) any later version.
+//
+// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
+// WARRANTY; without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+// for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with eCos; if not, write to the Free Software Foundation, Inc.,
+// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+//
+// As a special exception, if other files instantiate templates or use macros
+// or inline functions from this file, or you compile this file and link it
+// with other works to produce a work based on this file, this file does not
+// by itself cause the resulting work to be covered by the GNU General Public
+// License. However the source code for this file must still be made available
+// in accordance with section (3) of the GNU General Public License.
+//
+// This exception does not invalidate any other reasons why a work based on
+// this file might be covered by the GNU General Public License.
+//
+// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
+// at http://sources.redhat.com/ecos/ecos-license/
+// -------------------------------------------
+//####ECOSGPLCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s):    gthomas
+// Contributors: gthomas
+// Date:         2002-08-06
+// Purpose:      
+// Description:  
+//              
+// This code is part of RedBoot (tm).
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+#include <redboot.h>
+
+RedBoot_cmd("dump", 
+            "Display (hex dump) a range of memory", 
+            "-b <location> [-l <length>] [-s] [-1|2|4]",
+            do_dump 
+    );
+RedBoot_cmd("x", 
+            "Display (hex dump) a range of memory", 
+            "-b <location> [-l <length>] [-s] [-1|2|4]",
+            do_x
+    );
+
+void
+do_dump(int argc, char *argv[])
+{
+    struct option_info opts[6];
+    unsigned long base, len;
+    bool base_set, len_set;
+    static unsigned long _base, _len;
+    static char _size = 1;
+    bool srec_dump, set_32bit, set_16bit, set_8bit;
+    int i, n, off, cksum;
+    cyg_uint8 ch;
+
+    init_opts(&opts[0], 'b', true, OPTION_ARG_TYPE_NUM, 
+              (void **)&base, (bool *)&base_set, "base address");
+    init_opts(&opts[1], 'l', true, OPTION_ARG_TYPE_NUM, 
+              (void **)&len, (bool *)&len_set, "length");
+    init_opts(&opts[2], 's', false, OPTION_ARG_TYPE_FLG, 
+              (void **)&srec_dump, 0, "dump data using Morotola S-records");
+    init_opts(&opts[3], '4', false, OPTION_ARG_TYPE_FLG,
+              (void *)&set_32bit, (bool *)0, "dump 32 bit units");
+    init_opts(&opts[4], '2', false, OPTION_ARG_TYPE_FLG,
+              (void **)&set_16bit, (bool *)0, "dump 16 bit units");
+    init_opts(&opts[5], '1', false, OPTION_ARG_TYPE_FLG,
+              (void **)&set_8bit, (bool *)0, "dump 8 bit units");
+    if (!scan_opts(argc, argv, 1, opts, 6, 0, 0, "")) {
+        return;
+    }
+    if (!base_set) {
+        if (_base == 0) {
+            diag_printf("Dump what [location]?\n");
+            return;
+        }
+        base = _base;
+        if (!len_set) {
+            len = _len;
+            len_set = true;
+        }
+    }
+
+    if (set_32bit) {
+      _size = 4;
+    } else if (set_16bit) {
+      _size = 2;
+    } else if (set_8bit) {
+      _size = 1;
+    }
+
+    if (!len_set) {
+        len = 32;
+    }
+    if (srec_dump) {
+        off = 0;
+        while (off < len) {
+            n = (len > 16) ? 16 : len;
+            cksum = n+5;
+            diag_printf("S3%02X%08X", n+5, off+base);
+            for (i = 0;  i < 4;  i++) {
+                cksum += (((base+off)>>(i*8)) & 0xFF);
+            }
+            for (i = 0;  i < n;  i++) {
+                ch = *(cyg_uint8 *)(base+off+i);
+                diag_printf("%02X", ch);
+                cksum += ch;
+            }
+            diag_printf("%02X\n", ~cksum & 0xFF);
+            off += n;
+        }
+    } else {
+        switch( _size ) {
+        case 1:
+            diag_dump_buf((void *)base, len);
+            break;
+        case 2:
+            diag_dump_buf_16bit((void *)base, len);
+            break;
+        case 4:
+            diag_dump_buf_32bit((void *)base, len);
+            break;
+        }
+    }
+    _base = base + len;
+    _len = len;
+}
+
+// Simple alias for the dump command
+void
+do_x(int argc, char *argv[])
+{
+    do_dump(argc, argv);
+}
--- a/packages/redboot/current/src/io.c
+++ b/packages/redboot/current/src/io.c
@@ -284,8 +284,11 @@ getc_script(char *cp)
 
 	} else {
 	    *cp = *script++;
-	    if (*cp == '\n')
-		newline = true;
+	    if (*cp == '\n') {
+              newline = true;
+            } else {
+              newline = false;
+            }
 	    return true;
 	}
     }
--- a/packages/redboot/current/src/main.c
+++ b/packages/redboot/current/src/main.c
@@ -9,6 +9,7 @@
 // -------------------------------------------
 // This file is part of eCos, the Embedded Configurable Operating System.
 // Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
+// Copyright (C) 2002 Gary Thomas
 //
 // eCos is free software; you can redistribute it and/or modify it under
 // the terms of the GNU General Public License as published by the Free
@@ -68,16 +69,13 @@
 #else
 #include <cyg/hal/plf_stub.h>
 #endif
+// GDB interfaces
+extern void breakpoint(void);
 #endif
 
 // Builtin Self Test (BIST)
 externC void bist(void);
 
-#ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS
-// GDB interfaces
-extern void breakpoint(void);
-#endif
-
 // CLI command processing (defined in this file)
 RedBoot_cmd("version", 
             "Display RedBoot version information",
@@ -94,42 +92,6 @@ RedBoot_cmd("go",
             "[-w <timeout>] [entry]",
             do_go 
     );
-RedBoot_cmd("dump", 
-            "Display (hex dump) a range of memory", 
-            "-b <location> [-l <length>] [-s] [-1|2|4]",
-            do_dump 
-    );
-RedBoot_cmd("x", 
-            "Display (hex dump) a range of memory", 
-            "-b <location> [-l <length>] [-s] [-1|2|4]",
-            do_x
-    );
-#ifdef CYGBLD_BUILD_REDBOOT_WITH_CKSUM
-RedBoot_cmd("cksum", 
-            "Compute a 32bit checksum [POSIX algorithm] for a range of memory", 
-            "-b <location> -l <length>",
-            do_cksum
-    );
-#endif
-#ifdef CYGBLD_BUILD_REDBOOT_WITH_MFILL
-RedBoot_cmd("mfill", 
-            "Fill a block of memory with a pattern",
-            "-b <location> -l <length> -p <pattern> [-1|-2|-4]",
-            do_mfill
-    );
-#endif
-#ifdef CYGBLD_BUILD_REDBOOT_WITH_MCMP
-RedBoot_cmd("mcmp", 
-            "Compare two blocks of memory",
-            "-s <location> -d <location> -l <length> [-1|-2|-4]",
-            do_mcmp
-    );
-#endif
-RedBoot_cmd("cache", 
-            "Manage machine caches", 
-            "[ON | OFF]",
-            do_caches 
-    );
 #ifdef HAL_PLATFORM_RESET
 RedBoot_cmd("reset", 
             "Reset the system", 
@@ -369,42 +331,6 @@ cyg_start(void)
 }
 
 void
-do_caches(int argc, char *argv[])
-{
-    unsigned long oldints;
-    int dcache_on=0, icache_on=0;
-
-    if (argc == 2) {
-        if (strcasecmp(argv[1], "on") == 0) {
-            HAL_DISABLE_INTERRUPTS(oldints);
-            HAL_ICACHE_ENABLE();
-            HAL_DCACHE_ENABLE();
-            HAL_RESTORE_INTERRUPTS(oldints);
-        } else if (strcasecmp(argv[1], "off") == 0) {
-            HAL_DISABLE_INTERRUPTS(oldints);
-            HAL_DCACHE_SYNC();
-            HAL_ICACHE_DISABLE();
-            HAL_DCACHE_DISABLE();
-            HAL_DCACHE_SYNC();
-            HAL_ICACHE_INVALIDATE_ALL();
-            HAL_DCACHE_INVALIDATE_ALL();
-            HAL_RESTORE_INTERRUPTS(oldints);
-        } else {
-            diag_printf("Invalid cache mode: %s\n", argv[1]);
-        }
-    } else {
-#ifdef HAL_DCACHE_IS_ENABLED
-        HAL_DCACHE_IS_ENABLED(dcache_on);
-#endif
-#ifdef HAL_ICACHE_IS_ENABLED
-        HAL_ICACHE_IS_ENABLED(icache_on);
-#endif
-        diag_printf("Data cache: %s, Instruction cache: %s\n", 
-                    dcache_on?"On":"Off", icache_on?"On":"Off");
-    }
-}
-
-void
 show_help(struct cmd *cmd, struct cmd *cmd_end, char *which, char *pre)
 {
     bool show;
@@ -444,258 +370,6 @@ do_help(int argc, char *argv[])
 }
 
 void
-do_dump(int argc, char *argv[])
-{
-    struct option_info opts[6];
-    unsigned long base, len;
-    bool base_set, len_set;
-    static unsigned long _base, _len;
-    static char _size = 1;
-    bool srec_dump, set_32bit, set_16bit, set_8bit;
-    int i, n, off, cksum;
-    cyg_uint8 ch;
-
-    init_opts(&opts[0], 'b', true, OPTION_ARG_TYPE_NUM, 
-              (void **)&base, (bool *)&base_set, "base address");
-    init_opts(&opts[1], 'l', true, OPTION_ARG_TYPE_NUM, 
-              (void **)&len, (bool *)&len_set, "length");
-    init_opts(&opts[2], 's', false, OPTION_ARG_TYPE_FLG, 
-              (void **)&srec_dump, 0, "dump data using Morotola S-records");
-    init_opts(&opts[3], '4', false, OPTION_ARG_TYPE_FLG,
-              (void *)&set_32bit, (bool *)0, "dump 32 bit units");
-    init_opts(&opts[4], '2', false, OPTION_ARG_TYPE_FLG,
-              (void **)&set_16bit, (bool *)0, "dump 16 bit units");
-    init_opts(&opts[5], '1', false, OPTION_ARG_TYPE_FLG,
-              (void **)&set_8bit, (bool *)0, "dump 8 bit units");
-    if (!scan_opts(argc, argv, 1, opts, 6, 0, 0, "")) {
-        return;
-    }
-    if (!base_set) {
-        if (_base == 0) {
-            diag_printf("Dump what [location]?\n");
-            return;
-        }
-        base = _base;
-        if (!len_set) {
-            len = _len;
-            len_set = true;
-        }
-    }
-
-    if (set_32bit) {
-      _size = 4;
-    } else if (set_16bit) {
-      _size = 2;
-    } else if (set_8bit) {
-      _size = 1;
-    }
-
-    if (!len_set) {
-        len = 32;
-    }
-    if (srec_dump) {
-        off = 0;
-        while (off < len) {
-            n = (len > 16) ? 16 : len;
-            cksum = n+5;
-            diag_printf("S3%02X%08X", n+5, off+base);
-            for (i = 0;  i < 4;  i++) {
-                cksum += (((base+off)>>(i*8)) & 0xFF);
-            }
-            for (i = 0;  i < n;  i++) {
-                ch = *(cyg_uint8 *)(base+off+i);
-                diag_printf("%02X", ch);
-                cksum += ch;
-            }
-            diag_printf("%02X\n", ~cksum & 0xFF);
-            off += n;
-        }
-    } else {
-        switch( _size ) {
-        case 1:
-            diag_dump_buf((void *)base, len);
-            break;
-        case 2:
-            diag_dump_buf_16bit((void *)base, len);
-            break;
-        case 4:
-            diag_dump_buf_32bit((void *)base, len);
-            break;
-        }
-    }
-    _base = base + len;
-    _len = len;
-}
-
-// Simple alias for the dump command
-void
-do_x(int argc, char *argv[])
-{
-    do_dump(argc, argv);
-}
-
-#ifdef CYGBLD_BUILD_REDBOOT_WITH_CKSUM
-void
-do_cksum(int argc, char *argv[])
-{
-    // Compute a CRC, using the POSIX 1003 definition
-    extern unsigned long 
-        posix_crc32(unsigned char *s, int len);
-
-    struct option_info opts[2];
-    unsigned long base, len, crc;
-    bool base_set, len_set;
-
-    init_opts(&opts[0], 'b', true, OPTION_ARG_TYPE_NUM, 
-              (void **)&base, (bool *)&base_set, "base address");
-    init_opts(&opts[1], 'l', true, OPTION_ARG_TYPE_NUM, 
-              (void **)&len, (bool *)&len_set, "length");
-    if (!scan_opts(argc, argv, 1, opts, 2, 0, 0, "")) {
-        return;
-    }
-    if (!base_set || !len_set) {
-	if (load_address >= (CYG_ADDRESS)ram_start &&
-	    load_address_end < (CYG_ADDRESS)ram_end &&
-	    load_address < load_address_end) {
-	    base = load_address;
-	    len = load_address_end - load_address;
-            diag_printf("Computing cksum for area %p-%p\n",
-                        base, load_address_end);
-	} else {
-	    diag_printf("usage: cksum -b <addr> -l <length>\n");
-	    return;
-	}
-    }
-    crc = posix_crc32((unsigned char *)base, len);
-    diag_printf("POSIX cksum = %lu %lu (0x%08lx 0x%08lx)\n", crc, len, crc, len);
-}
-#endif
-
-#ifdef CYGBLD_BUILD_REDBOOT_WITH_MFILL
-void
-do_mfill(int argc, char *argv[])
-{
-    // Fill a region of memory with a pattern
-    struct option_info opts[6];
-    unsigned long base, pat;
-    long len;
-    bool base_set, len_set, pat_set;
-    bool set_32bit, set_16bit, set_8bit;
-
-    init_opts(&opts[0], 'b', true, OPTION_ARG_TYPE_NUM, 
-              (void **)&base, (bool *)&base_set, "base address");
-    init_opts(&opts[1], 'l', true, OPTION_ARG_TYPE_NUM, 
-              (void **)&len, (bool *)&len_set, "length");
-    init_opts(&opts[2], 'p', true, OPTION_ARG_TYPE_NUM, 
-              (void **)&pat, (bool *)&pat_set, "pattern");
-    init_opts(&opts[3], '4', false, OPTION_ARG_TYPE_FLG,
-              (void *)&set_32bit, (bool *)0, "fill 32 bit units");
-    init_opts(&opts[4], '2', false, OPTION_ARG_TYPE_FLG,
-              (void **)&set_16bit, (bool *)0, "fill 16 bit units");
-    init_opts(&opts[5], '1', false, OPTION_ARG_TYPE_FLG,
-              (void **)&set_8bit, (bool *)0, "fill 8 bit units");
-    if (!scan_opts(argc, argv, 1, opts, 6, 0, 0, "")) {
-        return;
-    }
-    if (!base_set || !len_set) {
-        diag_printf("usage: mfill -b <addr> -l <length> [-p <pattern>] [-1|-2|-4]\n");
-        return;
-    }
-    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;
-        }
-    } else if (set_16bit) {
-        // Fill 16 bits at a time
-        while ((len -= sizeof(cyg_uint16)) >= 0) {
-            *((cyg_uint16 *)base)++ = (cyg_uint16)pat;
-        }
-    } else {
-        // Default - 32 bits
-        while ((len -= sizeof(cyg_uint32)) >= 0) {
-            *((cyg_uint32 *)base)++ = (cyg_uint32)pat;
-        }
-    }
-}
-#endif
-
-#ifdef CYGBLD_BUILD_REDBOOT_WITH_MCMP
-void
-do_mcmp(int argc, char *argv[])
-{
-    // Fill a region of memory with a pattern
-    struct option_info opts[6];
-    unsigned long src_base, dst_base;
-    long len;
-    bool src_base_set, dst_base_set, len_set;
-    bool set_32bit, set_16bit, set_8bit;
-
-    init_opts(&opts[0], 's', true, OPTION_ARG_TYPE_NUM, 
-              (void **)&src_base, (bool *)&src_base_set, "base address");
-    init_opts(&opts[1], 'l', true, OPTION_ARG_TYPE_NUM, 
-              (void **)&len, (bool *)&len_set, "length");
-    init_opts(&opts[2], 'd', true, OPTION_ARG_TYPE_NUM, 
-              (void **)&dst_base, (bool *)&dst_base_set, "base address");
-    init_opts(&opts[3], '4', false, OPTION_ARG_TYPE_FLG,
-              (void *)&set_32bit, (bool *)0, "fill 32 bit units");
-    init_opts(&opts[4], '2', false, OPTION_ARG_TYPE_FLG,
-              (void **)&set_16bit, (bool *)0, "fill 16 bit units");
-    init_opts(&opts[5], '1', false, OPTION_ARG_TYPE_FLG,
-              (void **)&set_8bit, (bool *)0, "fill 8 bit units");
-    if (!scan_opts(argc, argv, 1, opts, 6, 0, 0, "")) {
-        return;
-    }
-    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
-        while ((len -= sizeof(cyg_uint8)) >= 0) {
-            if (*((cyg_uint8 *)src_base)++ != *((cyg_uint8 *)dst_base)++) {
-                ((cyg_uint8 *)src_base)--;
-                ((cyg_uint8 *)dst_base)--;
-                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));
-                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)--;
-                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));
-                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;
-            }
-        }
-    }
-}
-#endif
-
-void
 do_go(int argc, char *argv[])
 {
     typedef void code_fun(void);
new file mode 100644
--- /dev/null
+++ b/packages/redboot/current/src/mcmp.c
@@ -0,0 +1,131 @@
+//==========================================================================
+//
+//      mcmp.c
+//
+//      RedBoot memory compare (mcmp) routine
+//
+//==========================================================================
+//####ECOSGPLCOPYRIGHTBEGIN####
+// -------------------------------------------
+// This file is part of eCos, the Embedded Configurable Operating System.
+// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
+// Copyright (C) 2002 Gary Thomas
+//
+// eCos is free software; you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation; either version 2 or (at your option) any later version.
+//
+// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
+// WARRANTY; without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+// for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with eCos; if not, write to the Free Software Foundation, Inc.,
+// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+//
+// As a special exception, if other files instantiate templates or use macros
+// or inline functions from this file, or you compile this file and link it
+// with other works to produce a work based on this file, this file does not
+// by itself cause the resulting work to be covered by the GNU General Public
+// License. However the source code for this file must still be made available
+// in accordance with section (3) of the GNU General Public License.
+//
+// This exception does not invalidate any other reasons why a work based on
+// this file might be covered by the GNU General Public License.
+//
+// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
+// at http://sources.redhat.com/ecos/ecos-license/
+// -------------------------------------------
+//####ECOSGPLCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s):    gthomas
+// Contributors: gthomas
+// Date:         2002-08-06
+// Purpose:      
+// Description:  
+//              
+// This code is part of RedBoot (tm).
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+#include <redboot.h>
+
+RedBoot_cmd("mcmp", 
+            "Compare two blocks of memory",
+            "-s <location> -d <location> -l <length> [-1|-2|-4]",
+            do_mcmp
+    );
+
+void
+do_mcmp(int argc, char *argv[])
+{
+    // Fill a region of memory with a pattern
+    struct option_info opts[6];
+    unsigned long src_base, dst_base;
+    long len;
+    bool src_base_set, dst_base_set, len_set;
+    bool set_32bit, set_16bit, set_8bit;
+
+    init_opts(&opts[0], 's', true, OPTION_ARG_TYPE_NUM, 
+              (void **)&src_base, (bool *)&src_base_set, "base address");
+    init_opts(&opts[1], 'l', true, OPTION_ARG_TYPE_NUM, 
+              (void **)&len, (bool *)&len_set, "length");
+    init_opts(&opts[2], 'd', true, OPTION_ARG_TYPE_NUM, 
+              (void **)&dst_base, (bool *)&dst_base_set, "base address");
+    init_opts(&opts[3], '4', false, OPTION_ARG_TYPE_FLG,
+              (void *)&set_32bit, (bool *)0, "fill 32 bit units");
+    init_opts(&opts[4], '2', false, OPTION_ARG_TYPE_FLG,
+              (void **)&set_16bit, (bool *)0, "fill 16 bit units");
+    init_opts(&opts[5], '1', false, OPTION_ARG_TYPE_FLG,
+              (void **)&set_8bit, (bool *)0, "fill 8 bit units");
+    if (!scan_opts(argc, argv, 1, opts, 6, 0, 0, "")) {
+        return;
+    }
+    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
+        while ((len -= sizeof(cyg_uint8)) >= 0) {
+            if (*((cyg_uint8 *)src_base)++ != *((cyg_uint8 *)dst_base)++) {
+                ((cyg_uint8 *)src_base)--;
+                ((cyg_uint8 *)dst_base)--;
+                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));
+                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)--;
+                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));
+                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;
+            }
+        }
+    }
+}
new file mode 100644
--- /dev/null
+++ b/packages/redboot/current/src/mfill.c
@@ -0,0 +1,113 @@
+//==========================================================================
+//
+//      mfill.c
+//
+//      RedBoot memory fill (mfill) routine
+//
+//==========================================================================
+//####ECOSGPLCOPYRIGHTBEGIN####
+// -------------------------------------------
+// This file is part of eCos, the Embedded Configurable Operating System.
+// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
+// Copyright (C) 2002 Gary Thomas
+//
+// eCos is free software; you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation; either version 2 or (at your option) any later version.
+//
+// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
+// WARRANTY; without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+// for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with eCos; if not, write to the Free Software Foundation, Inc.,
+// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+//
+// As a special exception, if other files instantiate templates or use macros
+// or inline functions from this file, or you compile this file and link it
+// with other works to produce a work based on this file, this file does not
+// by itself cause the resulting work to be covered by the GNU General Public
+// License. However the source code for this file must still be made available
+// in accordance with section (3) of the GNU General Public License.
+//
+// This exception does not invalidate any other reasons why a work based on
+// this file might be covered by the GNU General Public License.
+//
+// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
+// at http://sources.redhat.com/ecos/ecos-license/
+// -------------------------------------------
+//####ECOSGPLCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s):    gthomas
+// Contributors: gthomas
+// Date:         2002-08-06
+// Purpose:      
+// Description:  
+//              
+// This code is part of RedBoot (tm).
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+#include <redboot.h>
+
+RedBoot_cmd("mfill", 
+            "Fill a block of memory with a pattern",
+            "-b <location> -l <length> -p <pattern> [-1|-2|-4]",
+            do_mfill
+    );
+
+void
+do_mfill(int argc, char *argv[])
+{
+    // Fill a region of memory with a pattern
+    struct option_info opts[6];
+    unsigned long base, pat;
+    long len;
+    bool base_set, len_set, pat_set;
+    bool set_32bit, set_16bit, set_8bit;
+
+    init_opts(&opts[0], 'b', true, OPTION_ARG_TYPE_NUM, 
+              (void **)&base, (bool *)&base_set, "base address");
+    init_opts(&opts[1], 'l', true, OPTION_ARG_TYPE_NUM, 
+              (void **)&len, (bool *)&len_set, "length");
+    init_opts(&opts[2], 'p', true, OPTION_ARG_TYPE_NUM, 
+              (void **)&pat, (bool *)&pat_set, "pattern");
+    init_opts(&opts[3], '4', false, OPTION_ARG_TYPE_FLG,
+              (void *)&set_32bit, (bool *)0, "fill 32 bit units");
+    init_opts(&opts[4], '2', false, OPTION_ARG_TYPE_FLG,
+              (void **)&set_16bit, (bool *)0, "fill 16 bit units");
+    init_opts(&opts[5], '1', false, OPTION_ARG_TYPE_FLG,
+              (void **)&set_8bit, (bool *)0, "fill 8 bit units");
+    if (!scan_opts(argc, argv, 1, opts, 6, 0, 0, "")) {
+        return;
+    }
+    if (!base_set || !len_set) {
+        diag_printf("usage: mfill -b <addr> -l <length> [-p <pattern>] [-1|-2|-4]\n");
+        return;
+    }
+    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;
+        }
+    } else if (set_16bit) {
+        // Fill 16 bits at a time
+        while ((len -= sizeof(cyg_uint16)) >= 0) {
+            *((cyg_uint16 *)base)++ = (cyg_uint16)pat;
+        }
+    } else {
+        // Default - 32 bits
+        while ((len -= sizeof(cyg_uint32)) >= 0) {
+            *((cyg_uint32 *)base)++ = (cyg_uint32)pat;
+        }
+    }
+}