Index: c/src/lib/libbsp/m68k/gen68360/README
===================================================================
--- c/src/lib/libbsp/m68k/gen68360/README	(revision 11532ca43528633a18572469307f33e48d9568a9)
+++ c/src/lib/libbsp/m68k/gen68360/README	(revision 996a9cb4e2a7d2d9ae43b8e3eb531a81ccefe690)
@@ -5,7 +5,6 @@
 #
 # This package requires a version of GCC that has been modified
-# to support the `-m68360' argument.  I have submitted the required changes
-# to the GCC maintainers.  Should they choose to use a different argument
-# (-mcpu32 perhaps) this board support package will have to be changed.
+# to support the `-mcpu32' argument.  I have submitted the required
+# changes to the GCC maintainers.
 #
 
Index: c/src/lib/libbsp/m68k/gen68360/include/bsp.h
===================================================================
--- c/src/lib/libbsp/m68k/gen68360/include/bsp.h	(revision 11532ca43528633a18572469307f33e48d9568a9)
+++ c/src/lib/libbsp/m68k/gen68360/include/bsp.h	(revision 996a9cb4e2a7d2d9ae43b8e3eb531a81ccefe690)
@@ -119,4 +119,6 @@
 void bsp_cleanup( void );
 
+void M360ExecuteRISC( rtems_unsigned16 command );
+
 m68k_isr_entry set_vector(
   rtems_isr_entry     handler,
Index: c/src/lib/libbsp/m68k/gen68360/start/start360.s
===================================================================
--- c/src/lib/libbsp/m68k/gen68360/start/start360.s	(revision 11532ca43528633a18572469307f33e48d9568a9)
+++ c/src/lib/libbsp/m68k/gen68360/start/start360.s	(revision 996a9cb4e2a7d2d9ae43b8e3eb531a81ccefe690)
@@ -299,9 +299,9 @@
 
 /*
- * Place the low-order 3 octets of the board's
- * ethernet address at a `well-known' location.
+ * Place the low-order 3 octets of the board's ethernet address at
+ * a `well-known' fixed location relative to the beginning of ROM.
  */
 	.align 2
-|	.long	ETHERNET_ADDRESS	| 08: Low-order 3 octets
+	.long	ETHERNET_ADDRESS	| Low-order 3 octets of ethernet address
 
 /*
@@ -348,22 +348,34 @@
 	jmp	SYM(_Init68360)		| Start C code (which never returns)
 
-
 /*
- * Clear BSS, set up real stack, initialize heap, start C program
- * Assume that BSS size is a multiple of 4.
- * FIXME: The zero-loop should be changed to put the CPU into loop-mode.
- * FIXME: PROM-based systems will have to copy data segment to RAM here
+ * Copy DATA segment, clear BSS segment, set up real stack,
+ * initialize heap, start C program.
+ * Assume that DATA and BSS sizes are multiples of 4.
  */
-	PUBLIC (_ClearBSSAndStart)
-SYM(_ClearBSSAndStart):
-	movel	#clear_start,a0
-	movel	#clear_end,a1
-	clrl	d0
-	bras ZEROLOOPTEST
+	PUBLIC (_CopyDataClearBSSAndStart)
+SYM(_CopyDataClearBSSAndStart):
+	lea	copy_start,a0		| Get start of DATA in RAM
+	lea	SYM(etext),a2		| Get start of DATA in ROM
+	cmpl	a0,a2			| Are they the same?
+	beq.s	NOCOPY			| Yes, no copy necessary
+	lea	copy_end,a1		| Get end of DATA in RAM
+	bra.s	COPYLOOPTEST		| Branch into copy loop
+COPYLOOP:
+	movel	a2@+,a0@+		| Copy word from ROM to RAM
+COPYLOOPTEST:
+	cmpl	a1,a0			| Done?
+	bcs.s	COPYLOOP		| No, skip
+NOCOPY:
+
+	lea	clear_start,a0		| Get start of BSS
+	lea	clear_end,a1		| Get end of BSS
+	clrl	d0			| Value to set
+	bra.s	ZEROLOOPTEST		| Branch into clear loop
 ZEROLOOP:
-	movel	d0,a0@+
+	movel	d0,a0@+			| Clear a word
 ZEROLOOPTEST:
-	cmpl	a1,a0
-	bcs	ZEROLOOP
+	cmpl	a1,a0			| Done?
+	bcs.s	ZEROLOOP		| No, skip
+
 	movel	#stack_init,a7		| set master stack pointer
 	movel	d0,a7@-			| environp
Index: c/src/lib/libbsp/m68k/gen68360/start360/start360.s
===================================================================
--- c/src/lib/libbsp/m68k/gen68360/start360/start360.s	(revision 11532ca43528633a18572469307f33e48d9568a9)
+++ c/src/lib/libbsp/m68k/gen68360/start360/start360.s	(revision 996a9cb4e2a7d2d9ae43b8e3eb531a81ccefe690)
@@ -299,9 +299,9 @@
 
 /*
- * Place the low-order 3 octets of the board's
- * ethernet address at a `well-known' location.
+ * Place the low-order 3 octets of the board's ethernet address at
+ * a `well-known' fixed location relative to the beginning of ROM.
  */
 	.align 2
-|	.long	ETHERNET_ADDRESS	| 08: Low-order 3 octets
+	.long	ETHERNET_ADDRESS	| Low-order 3 octets of ethernet address
 
 /*
@@ -348,22 +348,34 @@
 	jmp	SYM(_Init68360)		| Start C code (which never returns)
 
-
 /*
- * Clear BSS, set up real stack, initialize heap, start C program
- * Assume that BSS size is a multiple of 4.
- * FIXME: The zero-loop should be changed to put the CPU into loop-mode.
- * FIXME: PROM-based systems will have to copy data segment to RAM here
+ * Copy DATA segment, clear BSS segment, set up real stack,
+ * initialize heap, start C program.
+ * Assume that DATA and BSS sizes are multiples of 4.
  */
-	PUBLIC (_ClearBSSAndStart)
-SYM(_ClearBSSAndStart):
-	movel	#clear_start,a0
-	movel	#clear_end,a1
-	clrl	d0
-	bras ZEROLOOPTEST
+	PUBLIC (_CopyDataClearBSSAndStart)
+SYM(_CopyDataClearBSSAndStart):
+	lea	copy_start,a0		| Get start of DATA in RAM
+	lea	SYM(etext),a2		| Get start of DATA in ROM
+	cmpl	a0,a2			| Are they the same?
+	beq.s	NOCOPY			| Yes, no copy necessary
+	lea	copy_end,a1		| Get end of DATA in RAM
+	bra.s	COPYLOOPTEST		| Branch into copy loop
+COPYLOOP:
+	movel	a2@+,a0@+		| Copy word from ROM to RAM
+COPYLOOPTEST:
+	cmpl	a1,a0			| Done?
+	bcs.s	COPYLOOP		| No, skip
+NOCOPY:
+
+	lea	clear_start,a0		| Get start of BSS
+	lea	clear_end,a1		| Get end of BSS
+	clrl	d0			| Value to set
+	bra.s	ZEROLOOPTEST		| Branch into clear loop
 ZEROLOOP:
-	movel	d0,a0@+
+	movel	d0,a0@+			| Clear a word
 ZEROLOOPTEST:
-	cmpl	a1,a0
-	bcs	ZEROLOOP
+	cmpl	a1,a0			| Done?
+	bcs.s	ZEROLOOP		| No, skip
+
 	movel	#stack_init,a7		| set master stack pointer
 	movel	d0,a7@-			| environp
Index: c/src/lib/libbsp/m68k/gen68360/startup/init68360.c
===================================================================
--- c/src/lib/libbsp/m68k/gen68360/startup/init68360.c	(revision 11532ca43528633a18572469307f33e48d9568a9)
+++ c/src/lib/libbsp/m68k/gen68360/startup/init68360.c	(revision 996a9cb4e2a7d2d9ae43b8e3eb531a81ccefe690)
@@ -1,4 +1,4 @@
 /*
- * Initialize 68360 hardware
+ * MC68360 support routines
  *
  * W. Eric Norum
@@ -13,13 +13,31 @@
 #include <rtems.h>
 #include <bsp.h>
-#include "m68360.h"
+#include <m68360.h>
 
-void
-_Init68360 (void)
+/*
+ * Send a command to the CPM RISC processer
+ */
+
+void M360ExecuteRISC(rtems_unsigned16 command)
+{
+	rtems_unsigned16 sr;
+
+	m68k_disable_interrupts (sr);
+	while (m360.cr & M360_CR_FLG)
+		continue;
+	m360.cr = command | M360_CR_FLG;
+	m68k_enable_interrupts (sr);
+}
+
+/*
+ * Initialize MC68360
+ */
+
+void _Init68360 (void)
 {
 	int i;
 	extern void *_RomBase, *_RamBase;
 	m68k_isr_entry *vbr;
-	extern void _ClearBSSAndStart (void);
+	extern void _CopyDataClearBSSAndStart (void);
 
 	/*
@@ -65,5 +83,5 @@
 		*((long *)((char *)&m360 + 0xF00 + i)) = 0;
 	}
-	m360.cr = M360_CR_RST | M360_CR_FLG;
+	M360ExecuteRISC (M360_CR_RST);
 
 	/*
@@ -130,9 +148,8 @@
 	 * Step 13: Copy  the exception vector table to system RAM
 	 */
-  
-  m68k_get_vbr( vbr );
+	m68k_get_vbr (vbr);
 	for (i = 0; i < 256; ++i)
 		M68Kvec[i] = vbr[i];
-  m68k_set_vbr( M68Kvec );
+	m68k_set_vbr (M68Kvec);
 	
 	/*
@@ -168,6 +185,6 @@
 
 	/*
-	 * Clear BSS, switch stacks and call main()
+	 * Copy data, clear BSS, switch stacks and call main()
 	 */
-	_ClearBSSAndStart ();
+	_CopyDataClearBSSAndStart ();
 }
Index: c/src/lib/libbsp/m68k/gen68360/startup/linkcmds
===================================================================
--- c/src/lib/libbsp/m68k/gen68360/startup/linkcmds	(revision 11532ca43528633a18572469307f33e48d9568a9)
+++ c/src/lib/libbsp/m68k/gen68360/startup/linkcmds	(revision 996a9cb4e2a7d2d9ae43b8e3eb531a81ccefe690)
@@ -14,21 +14,22 @@
  */
 MEMORY {
-	  ram : ORIGIN = 0x00000000, LENGTH = 4M
-	  rom : ORIGIN = 0xFF000000, LENGTH = 1M
-	dpram : ORIGIN = 0xFE000000, LENGTH = 8k
+          ram : ORIGIN = 0x00000000, LENGTH = 4M
+          rom : ORIGIN = 0xFF000000, LENGTH = 1M
+        dpram : ORIGIN = 0xFE000000, LENGTH = 8k
 }
 
 /*
  * Declare some sizes
+ * XXX: The assignment of ". += XyzSize;" fails in older gld's if the
+ *      number used there is not constant.  If this happens to you, edit
+ *      the lines marked below to use a constant value.
  */
+HeapSize = DEFINED(HeapSize) ? HeapSize : 0x10000;
+StackSize = DEFINED(StackSize) ? StackSize : 0x1000;
 
 /*
- *  XXX: The assignment of ". += XyzSize;" fails in older gld's if the
- *       number used there is not constant so the calculated sizes are 
- *       ignored below and the default number is used instead.
+ * Declare low-order three octets of Ethernet address
  */
-
-HeapSize = DEFINED(HeapSize) ? HeapSize : 0x10000;
-StackSize = DEFINED(StackSize) ? StackSize : 0x1000;
+ETHERNET_ADDRESS = DEFINED(ETHERNET_ADDRESS) ? ETHERNET_ADDRESS : 0xDEAD12;
 
 /*
@@ -36,61 +37,69 @@
  */
 SECTIONS {
+        /*
+         * Boot PROM
+         */
+        rom : {
+                _RomBase = .;
+                __RomBase = .;
+        } >rom
+
+        /*
+         * Dynamic RAM
+         */
+        ram : {
+                _RamBase = .;
+                __RamBase = .;
+        } >ram
+
+        /*
+         * Text, data and bss segments
+         */
         .text : {
-		_RamBase = .;
-		__RamBase = .;
-		CREATE_OBJECT_SYMBOLS
-		*(.text)
-		. = ALIGN (16);
-		_etext = .;
+                CREATE_OBJECT_SYMBOLS
+                *(.text)
+                . = ALIGN (16);
+                etext = .;
+                _etext = .;
         } >ram 
         .data : {
-		*(.data)
-		. = ALIGN (16);
-		_edata = .;
+                copy_start = .;
+                *(.data)
+                . = ALIGN (16);
+                _edata = .;
+                copy_end = .;
         } >ram
         .bss : {
-		M68Kvec = .;
-		_M68Kvec = .;
-		. += (256 * 4);
-		clear_start = .;
-		*(.bss)
-		*(COMMON)
-		. = ALIGN (16);
-		_end = .;
+                M68Kvec = .;
+                _M68Kvec = .;
+                . += (256 * 4);
+                clear_start = .;
+                *(.bss)
+                *(COMMON)
+                . = ALIGN (16);
+                _end = .;
 
-		_HeapStart = .;
-		__HeapStart = .;
-		/* XXX:  Temporary to get around a gld bug
-		 *
-		 *  . += HeapSize;
-		 *  . += StackSize;
-		 */
-		. += 0x10000;   /* XXX */
-		. += 0x1000;   /* XXX */
+                _HeapStart = .;
+                __HeapStart = .;
+                /* . += HeapSize;  */ /* XXX -- Old gld can't handle this */
+                /* . += StackSize; */ /* XXX -- Old gld can't handle this */
+                . += 0x10000; /* HeapSize for old gld */
+                . += 0x1000;  /* StackSize for old gld */
+                . = ALIGN (16);
+                stack_init = .;
+                clear_end = .;
 
-		. = ALIGN (16);
-		stack_init = .;
-		clear_end = .;
+                _WorkspaceBase = .;
+                __WorkspaceBase = .;
+        } >ram
 
-		_WorkspaceBase = .;
-		__WorkspaceBase = .;
-	} >ram
+        /*
+         * On-chip memory/peripherals
+         */
+        dpram : {
+                m360 = .;
+                _m360 = .;
+                . += (8 * 1024);
 
-	/*
-	 * On-chip memory/peripherals
-	 */
-	dpram : {
-		m360 = .;
-		_m360 = .;
-		. += (8 * 1024);
-
-	} >dpram
-
-	/*
-	 * Boot PROM
-	 */
-	rom : {
-		_RomBase = .;
-		__RomBase = .;
-	} >rom
+        } >dpram
 }
Index: c/src/lib/libbsp/m68k/gen68360/startup/linkcmds.prom
===================================================================
--- c/src/lib/libbsp/m68k/gen68360/startup/linkcmds.prom	(revision 996a9cb4e2a7d2d9ae43b8e3eb531a81ccefe690)
+++ c/src/lib/libbsp/m68k/gen68360/startup/linkcmds.prom	(revision 996a9cb4e2a7d2d9ae43b8e3eb531a81ccefe690)
@@ -0,0 +1,111 @@
+/*
+ * This file contains GNU linker directives for a generic MC68360 board.
+ * These linker directives are for producing a PROM version..
+ * To create the PROM image from the linkter output you must use objcopy
+ * (--adjust-section-vma) to place the data segment at the end of the text
+ * segment in the PROM.  The start-up code takes care of copying this region
+ * to RAM.
+ *
+ * Saskatchewan Accelerator Laboratory
+ * University of Saskatchewan
+ * Saskatoon, Saskatchewan, CANADA
+ * eric@skatter.usask.ca
+ * 
+ *  $Id$
+ */
+
+/*
+ * a.out format doesn't handle prom images very well
+ */
+OUTPUT_FORMAT(coff-m68k)
+
+/*
+ * Declare on-board memory
+ */
+MEMORY {
+          ram : ORIGIN = 0x00000000, LENGTH = 4M
+          rom : ORIGIN = 0xFF000000, LENGTH = 1M
+        dpram : ORIGIN = 0xFE000000, LENGTH = 8k
+}
+
+/*
+ * Declare some sizes
+ */
+HeapSize = DEFINED(HeapSize) ? HeapSize : 0x10000;
+StackSize = DEFINED(StackSize) ? StackSize : 0x1000;
+
+/*
+ * Declare low-order three octets of Ethernet address
+ */
+ETHERNET_ADDRESS = DEFINED(ETHERNET_ADDRESS) ? ETHERNET_ADDRESS : 0xDEAD12;
+
+/*
+ * Load objects
+ */
+SECTIONS {
+        /*
+         * Boot PROM
+         */
+        rom : {
+                _RomBase = .;
+                __RomBase = .;
+        } >rom
+
+        /*
+         * Dynamic RAM
+         */
+        ram : {
+                _RamBase = .;
+                __RamBase = .;
+        } >ram
+
+        /*
+         * Text, data and bss segments
+         */
+        .text : {
+                CREATE_OBJECT_SYMBOLS
+                *(.text)
+                . = ALIGN (16);
+                etext = .;
+                _etext = .;
+        } >rom 
+        .data : {
+                copy_start = .;
+                *(.data)
+                . = ALIGN (16);
+                _edata = .;
+                copy_end = .;
+        } >ram
+        .bss : {
+                M68Kvec = .;
+                _M68Kvec = .;
+                . += (256 * 4);
+                clear_start = .;
+                *(.bss)
+                *(COMMON)
+                . = ALIGN (16);
+                _end = .;
+
+                _HeapStart = .;
+                __HeapStart = .;
+                . += HeapSize;
+                . += StackSize;
+                . = ALIGN (16);
+                stack_init = .;
+                clear_end = .;
+
+                _WorkspaceBase = .;
+                __WorkspaceBase = .;
+        } >ram
+
+        /*
+         * On-chip memory/peripherals
+         */
+        dpram : {
+                m360 = .;
+                _m360 = .;
+                . += (8 * 1024);
+
+        } >dpram
+
+}
