changeset 172:cd45958b28ff

Merge from eCos master repository on 2001-07-20-10:24:43-BST
author jlarmour
date Fri, 20 Jul 2001 10:23:16 +0000
parents 42f843b391aa
children 547dc35af910
files packages/ecos.db packages/fs/rom/current/ChangeLog packages/fs/rom/current/cdl/romfs.cdl packages/fs/rom/current/support/file2c.tcl packages/fs/rom/current/support/mk_romfs.c packages/fs/rom/current/tests/fileio1.c packages/fs/rom/current/tests/testromfs/etc/hosts packages/fs/rom/current/tests/testromfs/etc/inetd packages/fs/rom/current/tests/testromfs/etc/passwd packages/fs/rom/current/tests/testromfs/mnt/thing packages/fs/rom/current/tests/testromfs/var/foobar packages/hal/arm/arch/current/ChangeLog packages/hal/arm/arch/current/src/hal_mk_defs.c packages/hal/arm/arch/current/src/vectors.S packages/hal/arm/e7t/current/include/hal_platform_ints.h packages/hal/arm/e7t/current/include/plf_stub.h packages/hal/arm/edb7xxx/current/ChangeLog packages/hal/arm/edb7xxx/current/src/edb7xxx_misc.c packages/hal/i386/pcmb/current/ChangeLog packages/hal/i386/pcmb/current/include/pcmb_intr.h packages/hal/mips/arch/current/ChangeLog packages/hal/mips/arch/current/src/redboot_linux_exec.c packages/hal/sh/sh3/current/ChangeLog packages/hal/sh/sh3/current/include/mod_7729.h packages/hal/sh/sh3/current/src/var_misc.c packages/hal/sh/sh4/current/ChangeLog packages/hal/sh/sh4/current/src/var_misc.c packages/infra/current/ChangeLog packages/infra/current/include/cyg_type.h packages/io/fileio/current/ChangeLog packages/io/fileio/current/src/devfs.cxx packages/io/flash/current/ChangeLog packages/io/flash/current/cdl/io_flash.cdl packages/io/flash/current/include/flash.h packages/isoinfra/current/ChangeLog packages/isoinfra/current/include/stdlib.h packages/language/c/libc/stdio/current/ChangeLog packages/language/c/libc/stdio/current/include/stream.inl packages/redboot/current/ChangeLog packages/redboot/current/cdl/redboot.cdl packages/redboot/current/src/flash.c packages/redboot/current/src/io.c packages/redboot/current/src/net/net_io.c packages/redboot/current/src/version.c packages/services/memalloc/common/current/ChangeLog packages/services/memalloc/common/current/src/heapgen.tcl
diffstat 46 files changed, 533 insertions(+), 85 deletions(-) [+]
line wrap: on
line diff
--- a/packages/ecos.db
+++ b/packages/ecos.db
@@ -1278,7 +1278,7 @@ package CYGPKG_HAL_I386 {
 }
 
 package CYGPKG_HAL_I386_GENERIC {
-	alias		{ "i386 Generic target" hal_i386_generic }
+	alias		{ "i386 generic target" hal_i386_generic }
 	directory	hal/i386/generic
 	script		hal_i386_generic.cdl
 	hardware
--- a/packages/fs/rom/current/ChangeLog
+++ b/packages/fs/rom/current/ChangeLog
@@ -1,3 +1,14 @@
+2001-07-20  Jonathan Larmour  <jlarmour@redhat.com>
+
+	* tests/fileio1.c (main): Get this to actually pass! Remove
+	kernel dependency.
+	* cdl/fileio.cdl: Get CDL dependencies better. Don't use
+	fixed base address. Make test building an option. Build mk_romfs
+	and use it to construct a test romfs.
+	* support/mk_romfs.c: fix trivial typo
+	* tests/testromfs: Directory hierarchy added for constructing test
+	ROMFS.
+
 2001-07-13  Richard Panton (richard.panton@3glab.com)
 
 	* support/mk_romfs.c: Convert between host FS file modes and eCos
--- a/packages/fs/rom/current/cdl/romfs.cdl
+++ b/packages/fs/rom/current/cdl/romfs.cdl
@@ -48,32 +48,49 @@ cdl_package CYGPKG_FS_ROM {
     requires       CYGPKG_IO_FILEIO
 
     requires       CYGPKG_ISOINFRA
-    requires       CYGPKG_ERROR
     requires       CYGINT_ISO_ERRNO
     requires       CYGINT_ISO_ERRNO_CODES
 
     compile        -library=libextras.a romfs.c
 
-    cdl_option CYGNUM_FS_ROM_BASE_ADDRESS {
-	display		"Base of the ROM filesystem in memory"
-	flavor		data
-	default_value	{ 0x50040000 }
-	description	"Set this value to the base address of the ROM
-		filesystem in memory."
-    }
-
     # ----------------------------------------------------------------
     # Tests
 
-    cdl_option CYGPKG_FS_ROM_TESTS {
-	display "ROM FS tests"
-	flavor  data
-	no_define
-	calculated { "tests/fileio1.c" }
-            description   "
-                This option specifies the set of tests for the ROM FS package."
+    cdl_component CYGTST_ROMFS_BUILD_TESTS {
+        display       "Build ROMFS tests"
+        flavor        bool
+        no_define
+        default_value 0
+        requires      CYGINT_LIBC_STARTUP_CONTEXT
+        requires      CYGINT_ISO_STDIO_FORMATTED_IO
+        requires      CYGINT_ISO_STRERROR
+        description   "
+                This option enables the building of the ROMFS tests."
+
+        # FIXME: host compiler/flags should be provided by config system
+        make -priority 100 {
+            <PREFIX>/bin/mk_romfs: <PACKAGE>/support/mk_romfs.c
+            @mkdir -p "$(dir $@)"
+            @cc -g -O2 -o $@ $<
         }
     
+        make -priority 100 {
+            <PREFIX>/include/cyg/romfs/testromfs.h : $(PREFIX)/bin/mk_romfs <PACKAGE>/support/file2c.tcl
+            $(PREFIX)/bin/mk_romfs $(REPOSITORY)/$(PACKAGE)/tests/testromfs testromfs.bin
+            @mkdir -p "$(dir $@)"
+            sh $(REPOSITORY)/$(PACKAGE)/support/file2c.tcl testromfs.bin $@
+        }
+    
+    
+        cdl_option CYGPKG_FS_ROM_TESTS {
+            display "ROM FS tests"
+            flavor  data
+            no_define
+            calculated { "tests/fileio1.c" }
+                description   "
+                    This option specifies the set of tests for the ROM FS package."
+        }
+    }
 }
 
 # End of romfs.cdl
new file mode 100644
--- /dev/null
+++ b/packages/fs/rom/current/support/file2c.tcl
@@ -0,0 +1,119 @@
+#!/bin/sh
+# these lines restart using the tcl shell \
+  exec sh -c "if ( echo | tclsh ) 2>/dev/null ; then \
+      exec tclsh \"${0}\" ${1+${*}} ; \
+    elif ( echo | cygtclsh80 ) 2>/dev/null ; then \
+      exec cygtclsh80 \"${0}\" ${1+${*}} ; \
+    else \
+      echo Could not find TCL interpreter ; \
+      exit 1 ; \
+    fi"
+
+#===============================================================================
+#
+#    file2c.tcl
+#
+#    Convert a file into a header that can be #included from C.
+#
+#===============================================================================
+#####COPYRIGHTBEGIN####
+#                                                                          
+# -------------------------------------------                              
+# The contents of this file are subject to the Red Hat eCos Public License 
+# Version 1.1 (the "License"); you may not use this file except in         
+# compliance with the License.  You may obtain a copy of the License at    
+# http://www.redhat.com/                                                   
+#                                                                          
+# Software distributed under the License is distributed on an "AS IS"      
+# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.  See the 
+# License for the specific language governing rights and limitations under 
+# the License.                                                             
+#                                                                          
+# The Original Code is eCos - Embedded Configurable Operating System,      
+# released September 30, 1998.                                             
+#                                                                          
+# The Initial Developer of the Original Code is Red Hat.                   
+# Portions created by Red Hat are                                          
+# Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc.                  
+# All Rights Reserved.                                                     
+# -------------------------------------------                              
+#                                                                          
+#####COPYRIGHTEND####
+#===============================================================================
+######DESCRIPTIONBEGIN####
+#
+# Author(s):	jlarmour,bartv
+# Contact(s):	
+# Date:		2001-07-20
+# Purpose:      
+# Description:
+# Usage:        file2c.tcl <file to encode> <output C header file>
+#
+#####DESCRIPTIONEND####
+#===============================================================================
+
+
+
+if { $argc != 2 } {
+    puts "Usage: file2c.tcl <file to encode> <output C header file>"
+    exit 1
+}
+set infile [lindex $argv 0]
+set outfile [lindex $argv 1]
+
+set status [ catch {
+    set infilefd [open $infile "r"]
+    fconfigure $infilefd -translation binary
+    set data [read $infilefd]
+    close $infilefd
+} message]
+
+if { $status != 0 } {
+    error "Unable to read file $infile: $message"
+}
+
+set result ""
+
+set status [ catch {
+    set outfilefd [ open $outfile "w" ]
+} message ]
+
+if { $status != 0 } {
+    error "Unable to create file $outfile: $message"
+}
+
+append result "/* This is a generated file. Do not edit. */\n\n"
+append result "static const unsigned char filedata\[\] __attribute__((aligned(32))) = {\n"
+
+set datalength [ string length $data ]
+
+set aligned_datalength [expr $datalength - ($datalength % 8)]
+
+for { set i 0 } {$i < $aligned_datalength} {incr i 8} {
+    binary scan $data "@[set i]H16" var0
+    append result [format "    0x%2s, 0x%2s, 0x%2s, 0x%2s, 0x%2s, 0x%2s, 0x%2s, 0x%2s,\n" \
+            [string range $var0  0  1] \
+            [string range $var0  2  3] \
+            [string range $var0  4  5] \
+            [string range $var0  6  7] \
+            [string range $var0  8  9] \
+            [string range $var0 10 11] \
+            [string range $var0 12 13] \
+            [string range $var0 14 15]]
+}
+
+if { $aligned_datalength != $datalength } {
+    append result "    "
+    for { set i $aligned_datalength } {$i < $datalength} {incr i} {
+        binary scan $data "@[set i]H2" var0
+        append result [format "0x%2s, " $var0]
+    }
+}
+
+# Remove either comma+newline or comma+space from the end
+set result [string range $result 0 [expr [string length $result] - 3]]
+
+append result "\n};"
+
+puts $outfilefd $result
+close $outfilefd
--- a/packages/fs/rom/current/support/mk_romfs.c
+++ b/packages/fs/rom/current/support/mk_romfs.c
@@ -610,7 +610,7 @@ static void usage(void) {
     fprintf(stderr,"          Options include:\n");
     fprintf(stderr," -v / -q    increase / decrease verbosity\n");
     fprintf(stderr," -n         do everything EXCEPT creating the output file\n");
-    fprintf(stderr," -b         write a big-endian image (default is little endian\n");
+    fprintf(stderr," -b         write a big-endian image (default is little endian)\n");
     fprintf(stderr," -l         collapse hard links to a single node\n");
     fprintf(stderr,"\n");
     exit(EXIT_ARGS);
--- a/packages/fs/rom/current/tests/fileio1.c
+++ b/packages/fs/rom/current/tests/fileio1.c
@@ -32,7 +32,7 @@
 //#####DESCRIPTIONBEGIN####
 //
 // Author(s):           nickg
-// Contributors:        nickg, richard.panton@3glab.com
+// Contributors:        nickg, richard.panton@3glab.com, jlarmour
 // Date:                2000-05-25
 // Purpose:             Test fileio system
 // Description:         This test uses the testfs to check out the initialization
@@ -43,12 +43,9 @@
 //==========================================================================
 
 #include <pkgconf/hal.h>
-#include <pkgconf/kernel.h>
 #include <pkgconf/io_fileio.h>
-
-#include <cyg/kernel/ktypes.h>         // base kernel types
-#include <cyg/infra/cyg_trac.h>        // tracing macros
-#include <cyg/infra/cyg_ass.h>         // assertion macros
+#include <pkgconf/isoinfra.h>
+#include <pkgconf/system.h>
 
 #include <unistd.h>
 #include <fcntl.h>
@@ -56,13 +53,14 @@
 #include <errno.h>
 #include <string.h>
 #include <dirent.h>
+#include <stdio.h>
 
 #include <cyg/fileio/fileio.h>
 
 #include <cyg/infra/testcase.h>
 #include <cyg/infra/diag.h>            // HAL polled output
 
-#include <pkgconf/fs_rom.h>	// Address of ROMFS
+#include <cyg/romfs/testromfs.h>  // Test ROMFS data
 
 //==========================================================================
 
@@ -70,7 +68,7 @@ MTAB_ENTRY( romfs_mte1,
                    "/",
                    "romfs",
                    "",
-                   (CYG_ADDRWORD) CYGNUM_FS_ROM_BASE_ADDRESS );
+                   (CYG_ADDRWORD) &filedata[0] );
 
 
 //==========================================================================
@@ -95,7 +93,7 @@ else if ( errno != _type ) \
 
 //==========================================================================
 
-#ifndef CYGPKG_LIBC_STRING
+#ifndef CYGINT_ISO_STRING_STRFUNCS
 
 char *strcat( char *s1, const char *s2 )
 {
@@ -165,6 +163,7 @@ static void listdir( char *name, int sta
 
 //==========================================================================
 
+#ifdef CYGPKG_FS_RAM
 static void copyfile( char *name2, char *name1 )
 {
 
@@ -207,6 +206,7 @@ static void copyfile( char *name2, char 
     if( err < 0 ) SHOW_RESULT( close, err );
     
 }
+#endif
 
 //==========================================================================
 
@@ -275,7 +275,6 @@ int main( int argc, char **argv )
     // --------------------------------------------------------------
 
     diag_printf("<INFO>: ROMFS root follows\n");
-    diag_printf("<INFO>: Note that dev cannot be stat()ed\n");
     listdir( "/", true );
 
     diag_printf("<INFO>: cd /etc\n" );
@@ -291,19 +290,23 @@ int main( int argc, char **argv )
     diag_printf("<INFO>: ROMFS list of . follows\n");
     listdir( ".", true );
     
+#ifdef CYGPKG_FS_RAM
     err = mount( "", "/var", "ramfs" );
-    if( err < 0 ) SHOW_RESULT( mount, err );    
+    if( err < 0 ) SHOW_RESULT( mount, err );
 
     copyfile( "/etc/passwd", "/var/passwd_copy" );
 
     comparefiles( "/etc/passwd", "/var/passwd_copy" );
+#endif
     
     diag_printf("<INFO>: ROMFS list of / follows\n");
+#ifdef CYGPKG_FS_RAM
     diag_printf("<INFO>: Note that /var now gives stat() info for RAMFS\n");
+#endif
     listdir( "/", true );
 
     diag_printf("<INFO>: Mount ROMFS again onto /mnt\n");
-    sprintf( address, "%p", (void*)CYGNUM_FS_ROM_BASE_ADDRESS );
+    sprintf( address, "%p", (void*)&filedata[0] );
     err = mount( address, "/mnt", "romfs" );
     if( err < 0 ) SHOW_RESULT( mount, err );    
 
@@ -314,7 +317,11 @@ int main( int argc, char **argv )
     CHKFAIL_TYPE( mkdir, err, EROFS );
 
     err = rename( "/var", "/tmp" );	// RAMFS is mounted here
+#ifdef CYGPKG_FS_RAM
     CHKFAIL_TYPE( rename, err, EXDEV );
+#else
+    CHKFAIL_TYPE( rename, err, EROFS );
+#endif
 
     err = rename( "/var/passwd_copy", "/mnt/etc/passwd_copy" );
     CHKFAIL_TYPE( rename, err, EXDEV );
@@ -336,15 +343,19 @@ int main( int argc, char **argv )
     CHKFAIL_TYPE( unlink, err, EROFS );
 
     diag_printf("<INFO>: mount random area\n");
-    sprintf(address, "%p", (void*)(CYGNUM_FS_ROM_BASE_ADDRESS + 0x20000));
+    sprintf(address, "%p", (void*)(&filedata[0] + 0x100));
     err = mount( address, "/tmp", "romfs" );
-    SHOW_RESULT( mount, err );
+    CHKFAIL_TYPE( mount, err, ENOENT );
 
     err = umount( "/mnt" );
     if( err < 0 ) SHOW_RESULT( umount, err );    
 
     err = umount( "/var" );
+#ifdef CYGPKG_FS_RAM
     if( err < 0 ) SHOW_RESULT( umount, err );    
+#else
+    CHKFAIL_TYPE( umount, err, EINVAL );
+#endif
 
     err = umount( "/" );
     if( err < 0 ) SHOW_RESULT( umount, err );    
new file mode 100644
new file mode 100644
new file mode 100644
--- /dev/null
+++ b/packages/fs/rom/current/tests/testromfs/etc/passwd
@@ -0,0 +1,32 @@
+root:x:0:0:root:/root:/bin/bash
+daemon:x:1:1:daemon:/usr/sbin:/bin/sh
+bin:x:2:2:bin:/bin:/bin/sh
+sys:x:3:3:sys:/dev:/bin/sh
+sync:x:4:100:sync:/bin:/bin/sync
+games:x:5:100:games:/usr/games:/bin/sh
+man:x:6:100:man:/var/cache/man:/bin/sh
+lp:x:7:7:lp:/var/spool/lpd:/bin/sh
+mail:x:8:8:mail:/var/spool/mail:/bin/sh
+news:x:9:9:news:/var/spool/news:/bin/sh
+uucp:x:10:10:uucp:/var/spool/uucp:/bin/sh
+proxy:x:13:13:proxy:/bin:/bin/sh
+majordom:x:30:31:Majordomo:/usr/lib/majordomo:/bin/sh
+postgres:x:31:32:postgres:/var/lib/postgres:/bin/sh
+www-data:x:33:33:www-data:/var/www:/bin/sh
+backup:x:34:34:backup:/var/backups:/bin/sh
+msql:x:36:36:Mini SQL Database Manager:/var/lib/msql:/bin/sh
+operator:x:37:37:Operator:/var:/bin/sh
+list:x:38:38:SmartList:/var/list:/bin/sh
+irc:x:39:39:ircd:/var:/bin/sh
+gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats/gnats-db:/bin/sh
+alias:x:70:65534:qmail alias:/var/qmail/alias:/bin/sh
+qmaild:x:71:65534:qmail daemon:/var/qmail:/bin/sh
+qmails:x:72:70:qmail send:/var/qmail:/bin/sh
+qmailr:x:73:70:qmail remote:/var/qmail:/bin/sh
+qmailq:x:74:70:qmail queue:/var/qmail:/bin/sh
+qmaill:x:75:65534:qmail log:/var/qmail:/bin/sh
+qmailp:x:76:65534:qmail pw:/var/qmail:/bin/sh
+ftp:x:60000:65534::/lhome/ftp:/bin/false
+nobody:x:65534:65534:nobody:/home:/bin/sh
+identd:x:60001:65534::/var/run/identd:/bin/false
+telnetd:x:60002:60002::/usr/lib/telnetd:/bin/false
new file mode 100644
--- /dev/null
+++ b/packages/fs/rom/current/tests/testromfs/mnt/thing
@@ -0,0 +1,1 @@
+hi
new file mode 100644
--- /dev/null
+++ b/packages/fs/rom/current/tests/testromfs/var/foobar
@@ -0,0 +1,1 @@
+flibble
--- a/packages/hal/arm/arch/current/ChangeLog
+++ b/packages/hal/arm/arch/current/ChangeLog
@@ -1,3 +1,12 @@
+2001-07-19  Gary Thomas  <gthomas@redhat.com>
+
+	* src/vectors.S: Support ROMRAM startup mode.  Note: most of
+	the support for this mode will be in the platform setup code.
+
+2001-07-18  Gary Thomas  <gthomas@redhat.com>
+
+	* src/hal_mk_defs.c (main): FIQ no longer listed as an exception.
+
 2001-07-17  Jonathan Larmour  <jlarmour@redhat.com>
 
 	* include/hal_intr.h: Define range of exceptions more accurately.
--- a/packages/hal/arm/arch/current/src/hal_mk_defs.c
+++ b/packages/hal/arm/arch/current/src/hal_mk_defs.c
@@ -89,7 +89,6 @@ main(void)
     DEFINE(CYGNUM_HAL_EXCEPTION_DATA_ACCESS,
            CYGNUM_HAL_EXCEPTION_DATA_ACCESS);
     DEFINE(CYGNUM_HAL_VECTOR_IRQ, CYGNUM_HAL_VECTOR_IRQ);
-    DEFINE(CYGNUM_HAL_EXCEPTION_FIQ, CYGNUM_HAL_EXCEPTION_FIQ);
 #ifdef CYGPKG_KERNEL
     DEFINE(RAISE_INTR, CYG_INSTRUMENT_CLASS_INTR|CYG_INSTRUMENT_EVENT_INTR_RAISE);
 #endif
--- a/packages/hal/arm/arch/current/src/vectors.S
+++ b/packages/hal/arm/arch/current/src/vectors.S
@@ -333,7 +333,7 @@ 10:
 
         LED 4
 
-#if defined(CYG_HAL_STARTUP_ROM)
+#if defined(CYG_HAL_STARTUP_ROM) || defined(CYG_HAL_STARTUP_ROMRAM)
         // Set up reset vector
         mov     r0,#0
         ldr     r1,.__exception_handlers
--- a/packages/hal/arm/e7t/current/include/hal_platform_ints.h
+++ b/packages/hal/arm/e7t/current/include/hal_platform_ints.h
@@ -4,7 +4,7 @@
 //
 //      hal_platform_ints.h
 //
-//      HAL Interrupt and clock assignments for AEB-1
+//      HAL Interrupt and clock assignments for E7T (AEB-2)
 //
 //==========================================================================
 //####COPYRIGHTBEGIN####
--- a/packages/hal/arm/e7t/current/include/plf_stub.h
+++ b/packages/hal/arm/e7t/current/include/plf_stub.h
@@ -45,7 +45,7 @@
 //=============================================================================
 
 #include <pkgconf/hal.h>
-#include <pkgconf/hal_arm_e7t.h>
+#include CYGBLD_HAL_PLATFORM_H
 
 #ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS
 
--- a/packages/hal/arm/edb7xxx/current/ChangeLog
+++ b/packages/hal/arm/edb7xxx/current/ChangeLog
@@ -1,3 +1,9 @@
+2001-07-18  Franck Mamalet  <franck.mamalet@rd.francetelecom.com>
+2001-07-18  Jonathan Larmour  <jlarmour@redhat.com>
+
+	* src/edb7xxx_misc.c: Reorder hal_interrupt_status_regmap so that
+	all FIQs are first.
+
 2001-06-29  Jonathan Larmour  <jlarmour@redhat.com>
 
 	* src/io.c: Support building on cygwin.
--- a/packages/hal/arm/edb7xxx/current/src/edb7xxx_misc.c
+++ b/packages/hal/arm/edb7xxx/current/src/edb7xxx_misc.c
@@ -285,15 +285,16 @@ static struct regmap {
     int        first_int, last_int;
     cyg_uint32 stat_reg, mask_reg;
 } hal_interrupt_status_regmap[] = {
-    { CYGNUM_HAL_INTERRUPT_EXTFIQ, CYGNUM_HAL_INTERRUPT_SSEOTI,  INTSR1, INTMR1},
-    { CYGNUM_HAL_INTERRUPT_KBDINT, CYGNUM_HAL_INTERRUPT_URXINT2, INTSR2, INTMR2},
+    { CYGNUM_HAL_INTERRUPT_EXTFIQ, CYGNUM_HAL_INTERRUPT_MCINT,   INTSR1, INTMR1},
 #if defined(__EDB7211)
     { CYGNUM_HAL_INTERRUPT_MCPINT, CYGNUM_HAL_INTERRUPT_MCPINT,  INTSR3, INTMR3},
 #endif
 #if defined(__EDB7209)
     { CYGNUM_HAL_INTERRUPT_I2SINT, CYGNUM_HAL_INTERRUPT_I2SINT,  INTSR3, INTMR3},
 #endif
-    { 0, 0, 0}
+    { CYGNUM_HAL_INTERRUPT_CSINT,  CYGNUM_HAL_INTERRUPT_SSEOTI,  INTSR1, INTMR1},
+    { CYGNUM_HAL_INTERRUPT_KBDINT, CYGNUM_HAL_INTERRUPT_URXINT2, INTSR2, INTMR2},
+    { 0, 0, 0, 0 }
 };
 
 #ifdef CYGHWR_HAL_ARM_EDB7XXX_BATLOW
--- a/packages/hal/i386/pcmb/current/ChangeLog
+++ b/packages/hal/i386/pcmb/current/ChangeLog
@@ -1,3 +1,7 @@
+2001-07-18  Jonathan Larmour  <jlarmour@redhat.com>
+
+	* include/pcmb_intr.h: Fill in interrupt table descriptions.
+
 2001-07-05  Jonathan Larmour  <jlarmour@redhat.com>
 
 	* src/pcmb_misc.c (hal_pcmb_init): Silence warning
--- a/packages/hal/i386/pcmb/current/include/pcmb_intr.h
+++ b/packages/hal/i386/pcmb/current/include/pcmb_intr.h
@@ -65,11 +65,41 @@
 //--------------------------------------------------------------------------
 // Interrupt vectors.
 
+#define CYGNUM_HAL_INTERRUPT_IRQ0                32
+#define CYGNUM_HAL_INTERRUPT_IRQ1                33
+#define CYGNUM_HAL_INTERRUPT_IRQ2                34
+#define CYGNUM_HAL_INTERRUPT_IRQ3                35
+#define CYGNUM_HAL_INTERRUPT_IRQ4                36
+#define CYGNUM_HAL_INTERRUPT_IRQ5                37
+#define CYGNUM_HAL_INTERRUPT_IRQ6                38
+#define CYGNUM_HAL_INTERRUPT_IRQ7                39
+#define CYGNUM_HAL_INTERRUPT_IRQ8                40
+#define CYGNUM_HAL_INTERRUPT_IRQ9                41
+#define CYGNUM_HAL_INTERRUPT_IRQ10               42
+#define CYGNUM_HAL_INTERRUPT_IRQ11               43
+#define CYGNUM_HAL_INTERRUPT_IRQ12               44
+#define CYGNUM_HAL_INTERRUPT_IRQ13               45
+#define CYGNUM_HAL_INTERRUPT_IRQ14               46
+#define CYGNUM_HAL_INTERRUPT_IRQ15               47
+
+#define CYGNUM_HAL_INTERRUPT_TIMER               32
+#define CYGNUM_HAL_INTERRUPT_KEYBOARD            33
+#define CYGNUM_HAL_INTERRUPT_SLAVE8259           34
+#define CYGNUM_HAL_INTERRUPT_COM2                35
+#define CYGNUM_HAL_INTERRUPT_COM1                36
+#define CYGNUM_HAL_INTERRUPT_LPT2                37
+#define CYGNUM_HAL_INTERRUPT_FDD                 38
+#define CYGNUM_HAL_INTERRUPT_LPT1                39
+#define CYGNUM_HAL_INTERRUPT_WALLCLOCK           40
+#define CYGNUM_HAL_INTERRUPT_SLAVE8259REDIR      41
+#define CYGNUM_HAL_INTERRUPT_COPRO               45
+#define CYGNUM_HAL_INTERRUPT_HDD                 46
+
 #define CYGNUM_HAL_ISR_MIN                       32
 #define CYGNUM_HAL_ISR_MAX                       47
 #define CYGNUM_HAL_ISR_COUNT    (CYGNUM_HAL_ISR_MAX - CYGNUM_HAL_ISR_MIN + 1)
 
-#define CYGNUM_HAL_INTERRUPT_RTC                (CYGNUM_HAL_ISR_MIN + 0)
+#define CYGNUM_HAL_INTERRUPT_RTC                 CYGNUM_HAL_INTERRUPT_TIMER
 
 //--------------------------------------------------------------------------
 // Interrupt vector translation
--- a/packages/hal/mips/arch/current/ChangeLog
+++ b/packages/hal/mips/arch/current/ChangeLog
@@ -1,3 +1,9 @@
+2001-07-19  Gary Thomas  <gthomas@redhat.com>
+
+	* src/redboot_linux_exec.c: Define DEFAULT_BAUD.  The supporting
+	CDL differs from platform to platform, so this define is used to
+	ameliorate the differences.
+
 2001-07-17  David Woodhouse <dwmw2@redhat.com>
 
 	* src/redboot_linux_exec.c: Add environment stuff to the 'exec' 
--- a/packages/hal/mips/arch/current/src/redboot_linux_exec.c
+++ b/packages/hal/mips/arch/current/src/redboot_linux_exec.c
@@ -46,6 +46,15 @@
 #include <cyg/hal/hal_intr.h>
 #include <cyg/hal/hal_cache.h>
 
+// Not all platforms define this the same way
+#if defined(CYGNUM_HAL_VIRTUAL_VECTOR_CHANNELS_DEFAULT_BAUD)
+#define DEFAULT_BAUD CYGNUM_HAL_VIRTUAL_VECTOR_CHANNELS_DEFAULT_BAUD
+#elif defined(CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_BAUD)
+#define DEFAULT_BAUD CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_BAUD
+#else
+#define DEFAULT_BAUD 38400  // Probably wrong
+#endif
+
 #define xstr(s) str(s)
 #define str(s...) #s
 
@@ -127,7 +136,7 @@ do_exec(int argc, char *argv[])
     pb->modetty0.name = ++pcmd;
     pcmd += sprintf(pcmd, "modetty0");
     pb->modetty0.val = ++pcmd;
-    pcmd += sprintf(pcmd, "%d,n,8,1,hw", CYGNUM_HAL_VIRTUAL_VECTOR_CHANNELS_DEFAULT_BAUD);
+    pcmd += sprintf(pcmd, "%d,n,8,1,hw", DEFAULT_BAUD);
 
 #ifdef CYGPKG_REDBOOT_NETWORKING
     pb->ethaddr.name = ++pcmd;
--- a/packages/hal/sh/sh3/current/ChangeLog
+++ b/packages/hal/sh/sh3/current/ChangeLog
@@ -1,3 +1,12 @@
+2001-07-18  Jesper Skov  <jskov@redhat.com>
+
+	* src/var_misc.c (cyg_var_enable_caches): Small hack to prevent
+	ethernet connection to be lost in RAM applications when started
+	from a ROM monitor.
+
+	* include/mod_7729.h: Single stepping using UBC is broken -
+	disable it for now.
+
 2001-06-28  Jesper Skov  <jskov@redhat.com>
 
 	* include/var_intr.h: Allow platforms to extend vector table.
--- a/packages/hal/sh/sh3/current/include/mod_7729.h
+++ b/packages/hal/sh/sh3/current/include/mod_7729.h
@@ -55,7 +55,7 @@
 #define CYGARC_SH_MOD_PFC  1
 #define CYGARC_SH_MOD_SCI  1
 #define CYGARC_SH_MOD_SCIF 1
-#define CYGARC_SH_MOD_UBC  3
+//#define CYGARC_SH_MOD_UBC  3
 
 
 //-----------------------------------------------------------------------------
--- a/packages/hal/sh/sh3/current/src/var_misc.c
+++ b/packages/hal/sh/sh3/current/src/var_misc.c
@@ -71,12 +71,15 @@
 externC void
 cyg_var_enable_caches(void)
 {
+    // If relying on a ROM monitor do not invalidate the caches as the
+    // ROM monitor may have (non-synced) state in the caches.
+#if !defined(CYGSEM_HAL_USE_ROM_MONITOR)
     // Initialize cache.
     HAL_UCACHE_INVALIDATE_ALL();    
 
     // Set cache modes
     HAL_UCACHE_WRITE_MODE_SH(CACHE_MODE_P0|CACHE_MODE_P1);
-
+#endif
 #ifdef CYGHWR_HAL_SH_CACHE_ENABLE
     // Enable cache.
     HAL_UCACHE_ENABLE();
--- a/packages/hal/sh/sh4/current/ChangeLog
+++ b/packages/hal/sh/sh4/current/ChangeLog
@@ -1,3 +1,9 @@
+2001-07-18  Jesper Skov  <jskov@redhat.com>
+
+	* src/var_misc.c (cyg_var_enable_caches): Small hack to prevent
+	ethernet connection to be lost in RAM applications when started
+	from a ROM monitor.
+
 2001-07-17  Jesper Skov  <jskov@redhat.com>
 
 	* cdl/hal_sh_sh4.cdl: Allow caching.
--- a/packages/hal/sh/sh4/current/src/var_misc.c
+++ b/packages/hal/sh/sh4/current/src/var_misc.c
@@ -71,13 +71,16 @@
 externC void
 cyg_var_enable_caches(void)
 {
+    // If relying on a ROM monitor do not invalidate the caches as the
+    // ROM monitor may have (non-synced) state in the caches.
+#if !defined(CYGSEM_HAL_USE_ROM_MONITOR)
     // Initialize cache.
     HAL_DCACHE_INVALIDATE_ALL();    
     HAL_ICACHE_INVALIDATE_ALL();    
 
     // Set cache modes
     HAL_DCACHE_WRITE_MODE_SH(CACHE_MODE_P0|CACHE_MODE_P1);
-
+#endif
 #ifdef CYGHWR_HAL_SH_CACHE_ENABLE
     // Enable cache.
     HAL_ICACHE_ENABLE();
--- a/packages/infra/current/ChangeLog
+++ b/packages/infra/current/ChangeLog
@@ -1,3 +1,7 @@
+2001-07-18  Jonathan Larmour  <jlarmour@redhat.com>
+
+	* include/cyg_type.h (CYG_INIT_MEMALLOC): Add.
+
 2001-07-13  Jonathan Larmour  <jlarmour@redhat.com>
 
 	* src/diag.cxx (diag_vprintf): Fix long longs (patch from
--- a/packages/infra/current/include/cyg_type.h
+++ b/packages/infra/current/include/cyg_type.h
@@ -268,6 +268,7 @@ typedef cyg_haladdrword CYG_ADDRWORD;
 #define CYG_INIT_IDLE_THREAD            15000
 #define CYG_INIT_THREADS                16000
 #define CYG_INIT_KERNEL                 40000
+#define CYG_INIT_MEMALLOC               47000
 #define CYG_INIT_IO                     49000
 #define CYG_INIT_LIBC                   50000
 #define CYG_INIT_COMPAT                 55000
--- a/packages/io/fileio/current/ChangeLog
+++ b/packages/io/fileio/current/ChangeLog
@@ -1,3 +1,9 @@
+2001-07-19  Jonathan Larmour  <jlarmour@redhat.com>
+
+	* src/devfs.cxx (dev_fo_read): Treat non-blocking reads returning
+	EAGAIN correctly
+	(dev_fo_write): Ditto for writes.
+
 2001-06-14  Jonathan Larmour  <jlarmour@redhat.com>
 
 	* src/fio.h (FILEIO_ENTRY): Don't use CYG_MACRO_START/END around
--- a/packages/io/fileio/current/src/devfs.cxx
+++ b/packages/io/fileio/current/src/devfs.cxx
@@ -337,6 +337,11 @@ static int dev_fo_read      (struct CYG_
                            iov->iov_base,
                            &len);
 
+        if( EAGAIN == err ) // must be in non-blocking mode
+        {
+            uio->uio_resid -= len;
+            return ENOERR;
+        }
         if( err < 0 ) break;
 
         uio->uio_resid -= len;
@@ -363,6 +368,11 @@ static int dev_fo_write     (struct CYG_
                             iov->iov_base,
                             &len);
 
+        if( EAGAIN == err ) // must be in non-blocking mode
+        {
+            uio->uio_resid -= len;
+            return ENOERR;
+        }
         if( err < 0 ) break;
 
         uio->uio_resid -= len;
--- a/packages/io/flash/current/ChangeLog
+++ b/packages/io/flash/current/ChangeLog
@@ -1,3 +1,9 @@
+2001-07-19  Gary Thomas  <gthomas@redhat.com>
+
+	* include/flash.h: 
+	* cdl/io_flash.cdl: New option CYGINT_FLASH_WORKSPACE_SIZE used
+	to control how much memory is reserved for use by FLASH drivers.
+
 2001-06-19  Hugo Tyson  <hmt@redhat.com>
 
 	* src/flash.c (flash_program): Only verify program with memcmp if
--- a/packages/io/flash/current/cdl/io_flash.cdl
+++ b/packages/io/flash/current/cdl/io_flash.cdl
@@ -57,6 +57,19 @@ cdl_package CYGPKG_IO_FLASH {
 	puts $::cdl_header "#endif "
     }
 
+    cdl_option CYGINT_FLASH_WORKSPACE_SIZE {
+        display       "Extra memory required by FLASH device drivers"
+	flavor        data
+        default_value 0x1000
+        description   "
+            Use this option to control how much extra memory is used
+            by the FLASH drivers to perform certain operations. This
+            memory is used to hold driver functions in RAM (for platforms
+            which require it).  The value should thus be large enough
+            to hold any such driver.  Reducing this value will make
+            more RAM available to general programs."
+    }
+
     cdl_interface CYGHWR_IO_FLASH_DEVICE {
         display       "Hardware FLASH device drivers"
         description   "
@@ -80,6 +93,7 @@ cdl_package CYGPKG_IO_FLASH {
             This option will be enabled by devices which can support
             locking (write-protection) of individual blocks."
     }
+
     cdl_option CYGSEM_IO_FLASH_VERIFY_PROGRAM {
         display          "Verify data programmed to flash"
         flavor           bool
--- a/packages/io/flash/current/include/flash.h
+++ b/packages/io/flash/current/include/flash.h
@@ -49,7 +49,7 @@
 
 typedef int _printf(char* fmt, ...);
 
-#define FLASH_MIN_WORKSPACE 0x10000  // Space used by FLASH code
+#define FLASH_MIN_WORKSPACE CYGINT_FLASH_WORKSPACE_SIZE  // Space used by FLASH code
 
 externC int flash_init(void *work_space, int work_space_length, _printf *pf);
 externC int flash_erase(void *base, int len, void **err_address);
--- a/packages/isoinfra/current/ChangeLog
+++ b/packages/isoinfra/current/ChangeLog
@@ -1,3 +1,7 @@
+2001-07-20  Jonathan Larmour  <jlarmour@redhat.com>
+
+	* include/stdlib.h: Use correct macro names for abs and div.
+
 2001-06-08  Jonathan Larmour  <jlarmour@redhat.com>
 
 	* include/stdlib.h: Actually set MB_CUR_MAX in i18n package via header.
--- a/packages/isoinfra/current/include/stdlib.h
+++ b/packages/isoinfra/current/include/stdlib.h
@@ -380,8 +380,8 @@ qsort( void * /* first_object */, size_t
 /*======================================================================*/
 
 #if CYGINT_ISO_ABS
-# ifdef CYGBLD_ISO_ABS_HEADER
-#  include CYGBLD_ISO_ABS_HEADER
+# ifdef CYGBLD_ISO_STDLIB_ABS_HEADER
+#  include CYGBLD_ISO_STDLIB_ABS_HEADER
 # else
 
 /* TYPE DEFINITIONS */
@@ -408,8 +408,8 @@ labs( long /* val */ ) __attribute__((__
 /*======================================================================*/
 
 #if CYGINT_ISO_DIV
-# ifdef CYGBLD_ISO_DIV_HEADER
-#  include CYGBLD_ISO_DIV_HEADER
+# ifdef CYGBLD_ISO_STDLIB_DIV_HEADER
+#  include CYGBLD_ISO_STDLIB_DIV_HEADER
 # else
 
 /* ISO C 7.10 and 7.10.6 - Integer Arithmetic Functions */
--- a/packages/language/c/libc/stdio/current/ChangeLog
+++ b/packages/language/c/libc/stdio/current/ChangeLog
@@ -1,3 +1,9 @@
+2001-07-20  Jonathan Larmour  <jlarmour@redhat.com>
+
+	* include/stream.inl (set_position): Take read buffer into account
+	when seeking. Thanks to jjtsai <jjtsai@itri.org.tw> for the
+	help.
+
 2001-07-12  Jonathan Larmour  <jlarmour@redhat.com>
 
 	* src/common/fflush.cxx (cyg_libc_stdio_flush_all_but): Don't
--- a/packages/language/c/libc/stdio/current/include/stream.inl
+++ b/packages/language/c/libc/stdio/current/include/stream.inl
@@ -363,6 +363,8 @@ Cyg_StdioStream::get_position( fpos_t *p
 inline Cyg_ErrNo
 Cyg_StdioStream::set_position( fpos_t pos, int whence )
 {
+    CYG_ASSERTCLASS( this, "Stream object is not a valid stream!" );
+    
 #ifndef CYGPKG_LIBC_STDIO_FILEIO    
     // this is currently a workaround until we have real files
     // this will be corrected when we decide the true filesystem interface
@@ -370,8 +372,6 @@ Cyg_StdioStream::set_position( fpos_t po
     Cyg_ErrNo err;
     cyg_uint8 c;
 
-    CYG_ASSERTCLASS( this, "Stream object is not a valid stream!" );
-    
     if ((whence != SEEK_CUR) || pos < 0)
         return ENOSYS;
 
@@ -398,14 +398,47 @@ Cyg_StdioStream::set_position( fpos_t po
     
 #else
 
-    Cyg_ErrNo err;
-    off_t newpos = pos;
-
-    CYG_ASSERTCLASS( this, "Stream object is not a valid stream!" );
-    
     if (!lock_me())
         return EBADF; // assume file is now invalid
 
+    if ( whence != SEEK_END ) {
+        cyg_ucount32 bytesavail = bytes_available_to_read();
+        off_t abspos = (whence == SEEK_CUR) ? position + pos : pos;
+        off_t posdiff = abspos - position;
+
+        if ( bytesavail > posdiff ) {
+            // can just "seek" within the existing buffer
+#ifdef CYGFUN_LIBC_STDIO_ungetc
+            if (flags.unread_char_buf_in_use) {
+                flags.unread_char_buf_in_use = false;
+                posdiff--;
+            }
+#endif
+#ifdef CYGSEM_LIBC_STDIO_WANT_BUFFERED_IO
+            if (posdiff>0 && flags.buffering) {
+                io_buf.set_bytes_read(posdiff);
+                posdiff=0;
+            } else 
+#endif
+            if (posdiff>0 && flags.readbuf_char_in_use) {
+                flags.readbuf_char_in_use = false;
+                posdiff--;
+            }
+            CYG_ASSERT(posdiff==0, "Failed to seek within buffer correctly");
+
+            position = abspos;
+            unlock_me();
+            return ENOERR;
+        } // endif (bytesavail > posdiff)
+
+        if (whence == SEEK_CUR) {
+            position += bytesavail;
+        }
+    } //endif (whence != SEEK_END)
+
+    Cyg_ErrNo err;
+    off_t newpos=pos;
+
     err = cyg_stdio_lseek( my_device, &newpos, whence );
 
     if( err == ENOERR )
@@ -422,11 +455,11 @@ Cyg_StdioStream::set_position( fpos_t po
 
         // Clear EOF indicator.
         flags.at_eof = false;
+        
+        // update stream pos
+        position = newpos;
     }
     
-    if( err == ENOERR )
-        position = newpos;
-    
     unlock_me();
 
     return err;
--- a/packages/redboot/current/ChangeLog
+++ b/packages/redboot/current/ChangeLog
@@ -1,3 +1,39 @@
+2001-07-20  Jonathan Larmour  <jlarmour@redhat.com>
+
+	* src/net/net_io.c (net_init): Don't overwrite static IP
+	address when reading flash config if configured to not use BOOTP.
+	Set have_net if not using BOOTP and a default static IP addr is set.
+
+2001-07-19  Gary Thomas  <gthomas@redhat.com>
+
+	* src/flash.c: Be more generic with 'fconfig' layout.  In 
+	particular, handle case where FLASH block size is too small
+	to hold fconfig data.
+
+	* src/io.c (mon_set_read_char_timeout): Fix dangling else bug.
+
+	* src/flash.c (do_flash_init): Suppress printing info - this
+	will happen when 'version' is called.  Also allow flash subsystem
+	to be initialized when there is no 'fconfig' or 'fis' command
+	configured in (but flash support still is present).
+
+	* src/version.c: Display complete version information which 
+	reflects such information as the source release, etc.
+
+	* cdl/redboot.cdl: New option CYGDAT_REDBOOT_CUSTOM_VERSION used to 
+	allow site-specific version information.  Define this via the
+	CDL like this:
+	   cdl_option CYGDAT_REDBOOT_CUSTOM_VERSION {
+             user_value 1 "Special test version"
+           };
+
+2001-07-18  Gary Thomas  <gthomas@redhat.com>
+
+	* src/net/net_io.c (net_io_putc, net_io_isr):
+	Need CYGARC_HAL_SAVE_GP()/CYGARC_HAL_RESTORE_GP() to support
+	network debugging since different layers of eCos programs are
+	involved.
+
 2001-07-16  Gary Thomas  <gthomas@redhat.com>
 
 	* src/main.c (do_version): Use external function _flash_info() to 
--- a/packages/redboot/current/cdl/redboot.cdl
+++ b/packages/redboot/current/cdl/redboot.cdl
@@ -80,6 +80,17 @@ cdl_package CYGPKG_REDBOOT {
             requires  CYGDBG_HAL_DEBUG_GDB_THREAD_SUPPORT
         }
 
+        cdl_option CYGDAT_REDBOOT_CUSTOM_VERSION {
+            display        "Customized version string"
+            flavor         booldata
+            default_value  0
+            description    "
+              Use this option to define a customized version \"string\" for
+              RedBoot.  Note: this value is only cosmetic, displayed by the
+              \"version\" command, but is useful for providing site specific
+              information about the RedBoot configuration."
+        }
+
         no_define
         description "This option enables the building of the Redboot ELF image.
                      The image may require further relocation or symbol
--- a/packages/redboot/current/src/flash.c
+++ b/packages/redboot/current/src/flash.c
@@ -146,6 +146,11 @@ extern struct cmd __FIS_cmds_TAB__[], __
 static void *flash_start, *flash_end;
 static int block_size, blocks;
 static void *fis_work_block;
+static int fisdir_size;  // Size of FIS directory.  Note: zero if FIS not enabled
+#ifdef CYGSEM_REDBOOT_FLASH_CONFIG
+static void *cfg_base;   // Location in Flash of config data
+static int   cfg_size;   // Length of config data - rounded to Flash block size
+#endif
 
 static void
 fis_usage(char *why)
@@ -179,9 +184,6 @@ fis_init(int argc, char *argv[])
     int stat;
     struct fis_image_desc *img;
     void *fis_base, *err_addr;
-#ifdef CYGSEM_REDBOOT_FLASH_CONFIG
-    void *cfg_base;
-#endif
     bool full_init = false;
     struct option_info opts[1];
     unsigned long redboot_image_size, redboot_flash_start;
@@ -249,10 +251,9 @@ fis_init(int argc, char *argv[])
     // And a descriptor for the configuration data
     memset(img, 0, sizeof(*img));
     strcpy(img->name, "RedBoot config");
-    cfg_base = (void *)((unsigned long)flash_end - (2*block_size));
     img->flash_base = (unsigned long)cfg_base;
     img->mem_base = (unsigned long)cfg_base;
-    img->size = block_size;
+    img->size = cfg_size;
     img++;
 #endif
     // And a descriptor for the descriptor table itself
@@ -1030,11 +1031,15 @@ do_flash_init(void)
         flash_get_block_info(&block_size, &blocks);
         fis_work_block = (unsigned char *)(workspace_end-FLASH_MIN_WORKSPACE-block_size);
         workspace_end = fis_work_block;
-        _flash_info();
+        fisdir_size = block_size;
     }
     return true;
 }
 
+#ifndef CYGOPT_REDBOOT_FLASH_CONFIG
+RedBoot_init(do_flash_init, RedBoot_INIT_FIRST);
+#endif
+
 static void
 do_fis(int argc, char *argv[])
 {
@@ -1607,19 +1612,18 @@ void
 flash_write_config(void)
 {
     int stat;
-    void *cfg_base, *err_addr;
+    void *err_addr;
 
     config.len = sizeof(config);
     config.key1 = CONFIG_KEY1;  
     config.key2 = CONFIG_KEY2;
     config.cksum = crc32((unsigned char *)&config, sizeof(config)-sizeof(config.cksum));
-    cfg_base = (void *)((unsigned long)flash_end - (2*block_size));
     if (verify_action("Update RedBoot non-volatile configuration")) {
 #ifdef CYGSEM_REDBOOT_FLASH_LOCK_SPECIAL
         // Insure [quietly] that the config page is unlocked before trying to update
-        flash_unlock((void *)cfg_base, block_size, (void **)&err_addr);
+        flash_unlock((void *)cfg_base, cfg_size, (void **)&err_addr);
 #endif
-        if ((stat = flash_erase(cfg_base, block_size, (void **)&err_addr)) != 0) {
+        if ((stat = flash_erase(cfg_base, cfg_size, (void **)&err_addr)) != 0) {
             printf("   initialization failed %p: 0x%x(%s)\n", err_addr, stat, flash_errmsg(stat));
         } else {
             if ((stat = flash_program(cfg_base, (void *)&config, 
@@ -1630,7 +1634,7 @@ flash_write_config(void)
         }
 #ifdef CYGSEM_REDBOOT_FLASH_LOCK_SPECIAL
         // Insure [quietly] that the config data is locked after the update
-        flash_lock((void *)cfg_base, block_size, (void **)&err_addr);
+        flash_lock((void *)cfg_base, cfg_size, (void **)&err_addr);
 #endif
     }
 }
@@ -1824,13 +1828,15 @@ config_init(void)
 static void
 load_flash_config(void)
 {
-    void *cfg_base;
     bool use_boot_script;
 
     config_ok = false;
     script = (unsigned char *)0;
     if (!do_flash_init()) return;
-    cfg_base = (void *)((unsigned long)flash_end - (2*block_size));
+#define _roundup(n,s) ((((n)+(s-1))/s)*s)
+    cfg_size = (block_size > sizeof(config)) ? sizeof(config) : 
+                                               _roundup(sizeof(config), block_size);
+    cfg_base = (void *)((unsigned long)flash_end - (cfg_size+fisdir_size));
     memcpy(&config, cfg_base, sizeof(config));
     if ((crc32((unsigned char *)&config, sizeof(config)-sizeof(config.cksum)) != config.cksum) ||
         (config.key1 != CONFIG_KEY1)|| (config.key2 != CONFIG_KEY2)) {
--- a/packages/redboot/current/src/io.c
+++ b/packages/redboot/current/src/io.c
@@ -218,11 +218,13 @@ mon_set_read_char_timeout(int ms)
         CYGACC_CALL_IF_SET_CONSOLE_COMM(cur);        
     } else 
 #endif
-    if ((__chan = CYGACC_CALL_IF_CONSOLE_PROCS()) != 0) {
-        CYGACC_COMM_IF_CONTROL(*__chan, __COMMCTL_SET_TIMEOUT, ms);
-    }
-    if ((__chan = CYGACC_CALL_IF_DEBUG_PROCS()) != 0) {
-        CYGACC_COMM_IF_CONTROL(*__chan, __COMMCTL_SET_TIMEOUT, ms);
+    {
+        if ((__chan = CYGACC_CALL_IF_CONSOLE_PROCS()) != 0) {
+            CYGACC_COMM_IF_CONTROL(*__chan, __COMMCTL_SET_TIMEOUT, ms);
+        }
+        if ((__chan = CYGACC_CALL_IF_DEBUG_PROCS()) != 0) {
+            CYGACC_COMM_IF_CONTROL(*__chan, __COMMCTL_SET_TIMEOUT, ms);
+        }
     }
 }
 
--- a/packages/redboot/current/src/net/net_io.c
+++ b/packages/redboot/current/src/net/net_io.c
@@ -269,6 +269,7 @@ net_io_putc(void* __ch_data, cyg_uint8 c
     static bool have_dollar, have_hash;
     static int hash_count;
 
+    CYGARC_HAL_SAVE_GP();
     *out_bufp++ = c;
     if (c == '$') have_dollar = true;
     if (have_dollar && (c == '#')) {
@@ -280,6 +281,7 @@ net_io_putc(void* __ch_data, cyg_uint8 c
         net_io_flush();
         have_dollar = false;
     }
+    CYGARC_HAL_RESTORE_GP();
 }
 
 static void
@@ -323,8 +325,8 @@ net_io_getc_timeout(void* __ch_data, cyg
 {
     int delay_count;
     cyg_bool res;
+
     CYGARC_HAL_SAVE_GP();
-
     net_io_flush();  // Make sure any output has been sent
     delay_count = _timeout;
 
@@ -336,6 +338,7 @@ net_io_getc_timeout(void* __ch_data, cyg
     }
 
     CYGARC_HAL_RESTORE_GP();
+
     return res;
 }
 
@@ -395,12 +398,14 @@ net_io_isr(void *__ch_data, int* __ctrlc
 {
     char ch;
 
+    CYGARC_HAL_SAVE_GP();
     *__ctrlc = 0;
     if (net_io_getc_nonblock(__ch_data, &ch)) {
         if (ch == 0x03) {
             *__ctrlc = 1;
         }
     }
+    CYGARC_HAL_RESTORE_GP();
     return CYG_ISR_HANDLED;
 }
 
@@ -538,8 +543,11 @@ net_init(void)
     flash_get_config("net_debug", &net_debug, CONFIG_BOOL);
     flash_get_config("gdb_port", &gdb_port, CONFIG_INT);
     flash_get_config("bootp", &use_bootp, CONFIG_BOOL);
-    flash_get_config("bootp_my_ip", &__local_ip_addr, CONFIG_IP);
-    flash_get_config("bootp_server_ip", &my_bootp_info.bp_siaddr, CONFIG_IP);
+    if (use_bootp) {
+        flash_get_config("bootp_my_ip", &__local_ip_addr, CONFIG_IP);
+        flash_get_config("bootp_server_ip", &my_bootp_info.bp_siaddr, CONFIG_IP)
+;
+    }
 #endif
     have_net = false;
     // Make sure the recv buffers are set up
@@ -563,7 +571,14 @@ net_init(void)
         if (__bootp_find_local_ip(&my_bootp_info) == 0) {
             have_net = true;
         } else {
-            printf("Can't get BOOTP info - network disabled!\n");
+            // Is it an unset address, or has it been set to a static addr
+            if (__local_ip_addr[0] == 0 && __local_ip_addr[1] == 0 &&
+                __local_ip_addr[2] == 0 && __local_ip_addr[3] == 0) {
+                printf("Can't get BOOTP info - network disabled!\n");
+            } else {
+                printf("Can't get BOOTP info, using default IP address\n");
+                have_net = true;
+            }
         }
     } else {
         have_net = true;  // Assume values in FLASH were OK
--- a/packages/redboot/current/src/version.c
+++ b/packages/redboot/current/src/version.c
@@ -43,6 +43,7 @@
 //
 //==========================================================================
 
+#include <pkgconf/redboot.h>
 #include <cyg/hal/hal_arch.h>
 
 //
@@ -58,8 +59,19 @@
 // outlined above.
 //
 
-char RedBoot_version[] CYGBLD_ATTRIB_WEAK = 
-  "\nRedBoot(tm) bootstrap and debug environment - built " __TIME__ ", " __DATE__ "\n\n";
+#if defined(CYGDAT_REDBOOT_CUSTOM_VERSION)
+#define _REDBOOT_VERSION CYGDAT_REDBOOT_CUSTOM_VERSION
+#elif defined(CYGPKG_REDBOOT_current)
+#define _REDBOOT_VERSION UNKNOWN
+#else
+#define _REDBOOT_VERSION CYGPKG_REDBOOT
+#endif
+#define __s(x) #x
+#define _s(x) __s(x)
+
+char RedBoot_version[] CYGBLD_ATTRIB_WEAK =
+   "\nRedBoot(tm) bootstrap and debug environment, version " 
+   _s(_REDBOOT_VERSION) " - built " __TIME__ ", " __DATE__ "\n\n";
 
 // Override default GDB stubs 'info'
 // Note: this can still be a "weak" symbol since it will occur in the .o
--- a/packages/services/memalloc/common/current/ChangeLog
+++ b/packages/services/memalloc/common/current/ChangeLog
@@ -1,3 +1,8 @@
+2001-07-18  Jonathan Larmour  <jlarmour@redhat.com>
+
+	* src/heapgen.tcl: Use constructor priority of CYG_INIT_MEMALLOC
+	for heap objects in generated heaps.cxx.
+
 2001-07-12  Jonathan Larmour  <jlarmour@redhat.com>
 
 	* tests/malloc1.c (main): Accoutn for allocators that do allocate
--- a/packages/services/memalloc/common/current/src/heapgen.tcl
+++ b/packages/services/memalloc/common/current/src/heapgen.tcl
@@ -165,11 +165,11 @@ foreach heap $heaps {
             $malloc_impl_class $heap $heap ]
     puts $cfile [ format "    HAL_MEM_REAL_REGION_TOP( (cyg_uint8 *)CYGMEM_SECTION_%s + CYGMEM_SECTION_%s_SIZE ) - (cyg_uint8 *)CYGMEM_SECTION_%s ) " \
             $heap $heap $heap ]
-    puts $cfile "        CYGBLD_ATTRIB_INIT_BEFORE(CYG_INIT_LIBC);\n"
+    puts $cfile "        CYGBLD_ATTRIB_INIT_PRI(CYG_INIT_MEMALLOC);\n"
 
     puts $cfile "#else\n"
 
-    puts $cfile [ format "%s cygmem_pool_%s ( (cyg_uint8 *)CYGMEM_SECTION_%s , CYGMEM_SECTION_%s_SIZE ) CYGBLD_ATTRIB_INIT_BEFORE(CYG_INIT_LIBC);\n" \
+    puts $cfile [ format "%s cygmem_pool_%s ( (cyg_uint8 *)CYGMEM_SECTION_%s , CYGMEM_SECTION_%s_SIZE ) CYGBLD_ATTRIB_INIT_PRI(CYG_INIT_MEMALLOC);\n" \
             $malloc_impl_class $heap $heap $heap ]
 
     puts $cfile "#endif"