summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@codesourcery.com>2006-08-25 11:55:48 +0000
committerNathan Sidwell <nathan@codesourcery.com>2006-08-25 11:55:48 +0000
commitffe60f8edaf49afb96f6e9182fea1fbb67b8f3f2 (patch)
treef41da68d8b0b327ea909bed24d5a9c84b83ed233
parentfe28d47d3bc662651cb01c06e5078caf59442e19 (diff)
downloadcygnal-ffe60f8edaf49afb96f6e9182fea1fbb67b8f3f2.tar.gz
cygnal-ffe60f8edaf49afb96f6e9182fea1fbb67b8f3f2.tar.bz2
cygnal-ffe60f8edaf49afb96f6e9182fea1fbb67b8f3f2.zip
libgloss/
* m68k/Makefile.in (DBUG_BSP, DBUG_OBJS): Remove. (BDM_CRT0): New. (BDM_OBJS): Add bdm-crt1.o. (BDM_OTHER_OBJS): Remove print.o putnum.o (CF_BOARDS): New. (CF_BDM_SCRIPTS): Generated name of ram scripts. (CF_ROM_SCRIPTS): Generated name of rom scripts. (CF_SCRIPTS): Adjust. (all): Add BDM_CRT0. (bdm-crt0.o, bdm-crt1.o): New targets. (bdm-isv.o): Remove. (m5208evb, m5213evb, m52235evb, m5235evb, m5273c3, m5282evb, m5329evb, m5485evb): New. (%-bdm.ld, %-rom.ld): New. Replace individual linker script rules. (install): Remove DBUG installs. * m68k/bdm-crt0.S: New. * m68k/bdm-crt1.c: New. * m68k/bdm-exit.c: Call __reset. * m68k/bdm-isv.c: Remove. * m68k/cf.sc: Adjust to produce either rom or ram images. * m68k/dbug-exit.S, m68k/dbug-inbyte.S, m68k/dbug-outbyte.S: Remove.
-rw-r--r--ChangeLog.csl25
-rw-r--r--libgloss/m68k/Makefile.in105
-rw-r--r--libgloss/m68k/bdm-crt0.S85
-rw-r--r--libgloss/m68k/bdm-crt1.c63
-rw-r--r--libgloss/m68k/bdm-exit.c3
-rw-r--r--libgloss/m68k/bdm-isv.c148
-rw-r--r--libgloss/m68k/cf.sc61
-rw-r--r--libgloss/m68k/dbug-exit.S29
-rw-r--r--libgloss/m68k/dbug-inbyte.S34
-rw-r--r--libgloss/m68k/dbug-outbyte.S34
10 files changed, 236 insertions, 351 deletions
diff --git a/ChangeLog.csl b/ChangeLog.csl
index 83d7bbb6d..1403d6f81 100644
--- a/ChangeLog.csl
+++ b/ChangeLog.csl
@@ -1,3 +1,28 @@
+2006-08-25 Nathan Sidwell <nathan@codesourcery.com>
+
+ libgloss/
+ * m68k/Makefile.in (DBUG_BSP, DBUG_OBJS): Remove.
+ (BDM_CRT0): New.
+ (BDM_OBJS): Add bdm-crt1.o.
+ (BDM_OTHER_OBJS): Remove print.o putnum.o
+ (CF_BOARDS): New.
+ (CF_BDM_SCRIPTS): Generated name of ram scripts.
+ (CF_ROM_SCRIPTS): Generated name of rom scripts.
+ (CF_SCRIPTS): Adjust.
+ (all): Add BDM_CRT0.
+ (bdm-crt0.o, bdm-crt1.o): New targets.
+ (bdm-isv.o): Remove.
+ (m5208evb, m5213evb, m52235evb, m5235evb, m5273c3, m5282evb,
+ m5329evb, m5485evb): New.
+ (%-bdm.ld, %-rom.ld): New. Replace individual linker script rules.
+ (install): Remove DBUG installs.
+ * m68k/bdm-crt0.S: New.
+ * m68k/bdm-crt1.c: New.
+ * m68k/bdm-exit.c: Call __reset.
+ * m68k/bdm-isv.c: Remove.
+ * m68k/cf.sc: Adjust to produce either rom or ram images.
+ * m68k/dbug-exit.S, m68k/dbug-inbyte.S, m68k/dbug-outbyte.S: Remove.
+
2006-08-22 Paul Brook <paul@codesourcery.com>
newlib/
diff --git a/libgloss/m68k/Makefile.in b/libgloss/m68k/Makefile.in
index a5e561164..6e3d9a955 100644
--- a/libgloss/m68k/Makefile.in
+++ b/libgloss/m68k/Makefile.in
@@ -118,18 +118,13 @@ IDPGDB_BSP= libidpgdb.a
IDPGDB_OBJS= leds.o idp-inbyte.o idp-gdb-outbyte.o mc68ec.o
#
-# here's all the DBUG target stuff
-#
-DBUG_BSP= libdbug.a
-DBUG_OBJS= dbug-exit.o dbug-inbyte.o dbug-outbyte.o
-
-#
# here's all the BDM semihosting stuff
#
+BDM_CRT0= bdm-crt0.o
BDM_BSP= libbdm.a
-BDM_OBJS= bdm-isv.o bdm-semihost.o $(BDM_SYSOBJS) \
+BDM_OBJS= bdm-crt1.o bdm-semihost.o $(BDM_SYSOBJS) \
$(patsubst %,bdm-%.o,${BDM_ISRS})
-BDM_OTHER_OBJS= getpid.o kill.o sbrk.o print.o putnum.o
+BDM_OTHER_OBJS= getpid.o kill.o sbrk.o
BDM_SYSOBJS= bdm-close.o bdm-exit.o bdm-fstat.o bdm-gdb.o \
bdm-gettimeofday.o bdm-isatty.o bdm-lseek.o \
bdm-open.o bdm-read.o bdm-rename.o \
@@ -144,14 +139,11 @@ BDM_ISRS= other_interrupt reset access_error address_error \
fp_underflow fp_operand_error fp_overflow fp_input_not_a_number \
fp_input_denormalized_number unsupported_instruction
-CF_SCRIPTS= m5208evb-dbug.ld m5208evb-bdm.ld \
- m5213evb-dbug.ld m5213evb-bdm.ld \
- m52235evb-dbug.ld m52235evb-bdm.ld \
- m5235evb-dbug.ld m5235evb-bdm.ld \
- m5272c3-dbug.ld m5272c3-bdm.ld \
- m5282evb-dbug.ld m5282evb-bdm.ld \
- m5329evb-dbug.ld m5329evb-bdm.ld \
- m5485evb-dbug.ld m5485evb-bdm.ld
+CF_BOARDS := m5208evb m5213evb m52235evb m5235evb m5272c3 m5282evb \
+ m5329evb m5485evb
+CF_BDM_SCRIPTS := $(patsubst %,%-bdm.ld,$(CF_BOARDS))
+CF_ROM_SCRIPTS := $(patsubst %,%-rom.ld,$(CF_BOARDS))
+CF_SCRIPTS= $(CF_BDM_SCRIPTS) $(CF_ROM_SCRIPTS)
# Host specific makefile fragment comes in here.
@host_makefile_frag@
@@ -160,7 +152,8 @@ CF_SCRIPTS= m5208evb-dbug.ld m5208evb-bdm.ld \
# build a test program for each target board. Just trying to get
# it to link is a good test, so we ignore all the errors for now.
#
-all: ${SIM_CRT0} ${SIM_BSP} ${CRT0} ${BCC_BSP} ${IDP_BSP} ${IDPGDB_BSP} ${MVME135_BSP} ${MVME162_BSP} ${DBUG_BSP} ${BDM_BSP} ${CF_SCRIPTS}
+all: ${SIM_CRT0} ${SIM_BSP} ${CRT0} ${BCC_BSP} ${IDP_BSP} ${IDPGDB_BSP} \
+ ${MVME135_BSP} ${MVME162_BSP} ${BDM_CRT0} ${BDM_BSP} ${CF_SCRIPTS}
#
# here's where we build the board support packages for each target
@@ -181,10 +174,6 @@ ${IDPGDB_BSP}: $(OBJS) ${IDPGDB_OBJS}
${AR} ${ARFLAGS} $@ $(OBJS) ${IDPGDB_OBJS}
${RANLIB} $@
-${DBUG_BSP}: $(OBJS) ${DBUG_OBJS}
- ${AR} ${ARFLAGS} $@ $(OBJS) ${DBUG_OBJS}
- ${RANLIB} $@
-
${BDM_BSP}: $(BDM_OTHER_OBJS) ${BDM_OBJS}
${AR} ${ARFLAGS} $@ $(BDM_OTHER_OBJS) ${BDM_OBJS}
${RANLIB} $@
@@ -197,64 +186,37 @@ ${MVME162_BSP}: $(OBJS) ${MVME162_OBJS}
${AR} ${ARFLAGS} $@ $(OBJS) ${MVME162_OBJS}
${RANLIB} $@
-
$(BDM_SYSOBJS): %.o: %.c bdm-semihost.h bdm-gdb.h
$(CC) $(CFLAGS_FOR_TARGET) $(INCLUDES) -c $< -o $@
-bdm-isv.o : bdm-isv.c bdm-semihost.h
+bdm-crt0.o : bdm-crt0.S
+ $(CC) $(CFLAGS_FOR_TARGET) $(INCLUDES) -c $< -o $@
+bdm-crt1.o : bdm-crt1.c
+ $(CC) $(CFLAGS_FOR_TARGET) $(INCLUDES) -c $< -o $@
+#We need to omit the frame pointer to ensure there is no prologue.
bdm-semihost.o : bdm-semihost.c
$(CC) $(CFLAGS_FOR_TARGET) $(INCLUDES) -c $< -o $@ -fomit-frame-pointer
+# We need to keep the frame pointer to make sure there's some
+# prologue. Otherwise we get confused with the semihosting reoutine.
$(patsubst %,bdm-%.o,${BDM_ISRS}) : bdm-isrs.c
$(CC) $(CFLAGS_FOR_TARGET) $(INCLUDES) -c $< -o $@ \
-DL_$(patsubst bdm-%.o,%,$@) -fno-omit-frame-pointer
-m5208evb-dbug.ld: cf.sc Makefile
- IO=dbug RAMSTART=1024M RAMSIZE=16M RAMDBUG=128K ${SHELL} $< > $@
-
-m5208evb-bdm.ld: cf.sc Makefile
- IO=bdm ISV=1 RAMSTART=1024M RAMSIZE=16M ${SHELL} $< > $@
-
-m5213evb-dbug.ld: cf.sc Makefile
- IO=dbug RAMSTART=512M RAMSIZE=32K RAMDBUG=8K ${SHELL} $< > $@
-
-m5213evb-bdm.ld: cf.sc Makefile
- IO=bdm ISV=1 RAMSTART=512M RAMSIZE=32K ${SHELL} $< > $@
-
-m52235evb-dbug.ld: cf.sc Makefile
- IO=dbug RAMSTART=512M RAMSIZE=32K RAMDBUG=8K ${SHELL} $< > $@
-
-m52235evb-bdm.ld: cf.sc Makefile
- IO=bdm ISV=1 RAMSTART=512M RAMSIZE=32K ${SHELL} $< > $@
-
-m5235evb-dbug.ld: cf.sc Makefile
- IO=dbug RAMSTART=0M RAMSIZE=16M RAMDBUG=64K ${SHELL} $< > $@
-
-m5235evb-bdm.ld: cf.sc Makefile
- IO=bdm ISV=1 RAMSTART=0M RAMSIZE=16M ${SHELL} $< > $@
-
-m5272c3-dbug.ld: cf.sc Makefile
- IO=dbug RAMSTART=0M RAMSIZE=4M RAMDBUG=128K ${SHELL} $< > $@
-
-m5272c3-bdm.ld: cf.sc Makefile
- IO=bdm ISV=1 RAMSTART=0M RAMSIZE=4M ${SHELL} $< > $@
-
-m5282evb-dbug.ld: cf.sc Makefile
- IO=dbug RAMSTART=0M RAMSIZE=16M RAMDBUG=64K ${SHELL} $< > $@
-
-m5282evb-bdm.ld: cf.sc Makefile
- IO=bdm ISV=1 RAMSTART=0M RAMSIZE=16M ${SHELL} $< > $@
-
-m5329evb-dbug.ld: cf.sc Makefile
- IO=dbug RAMSTART=1024M RAMSIZE=32M RAMDBUG=128K ${SHELL} $< > $@
-
-m5329evb-bdm.ld: cf.sc Makefile
- IO=bdm ISV=1 RAMSTART=1024M RAMSIZE=32M RAMDBUG=128K ${SHELL} $< > $@
-
-m5485evb-dbug.ld: cf.sc Makefile
- IO=dbug RAMSTART=0M RAMSIZE=64M RAMDBUG=128K ${SHELL} $< > $@
-
-m5485evb-bdm.ld: cf.sc Makefile
- IO=bdm ISV=1 RAMSTART=0M RAMSIZE=64M ${SHELL} $< > $@
+# RAM ROM
+m5208evb := 1024M 16M 0M 2M
+m5213evb := 512M 32K 0M 256K
+m52235evb := 512M 32K 0M 256K
+m5235evb := 0M 16M 0xFFE00000 2M
+m5273c3 := 0M 4M 0xFFE00000 2M
+m5282evb := 0M 16M 0xFFE00000 2M
+m5329evb := 1024M 32M 0M 2M
+m5485evb := 0M 64M 1024M 16M
+
+%-bdm.ld : cf.sc Makefile
+ RAM=$(word 1,$($*)) RAM_SIZE=$(word 2,$($*)) ${SHELL} $< >$@
+%-rom.ld : cf.sc Makefile
+ RAM=$(word 1,$($*)) RAM_SIZE=$(word 2,$($*)) \
+ ROM=$(word 3,$($*)) ROM_SIZE=$(word 4,$($*)) ${SHELL} $< >$@
leds.o: ${srcdir}/leds.c
$(CC) $(CFLAGS_FOR_TARGET) $(INCLUDES) -c $<
@@ -372,9 +334,8 @@ install:
# install MVME162lx stuff
$(INSTALL_PROGRAM) $(MVME162_BSP) $(DESTDIR)$(tooldir)/lib${MULTISUBDIR}/$(MVME162_BSP)
$(INSTALL_DATA) ${srcdir}/mvme162.ld $(DESTDIR)$(tooldir)/lib${MULTISUBDIR}/mvme162.ld
- # install DBUG stuff
- $(INSTALL_PROGRAM) $(DBUG_BSP) $(DESTDIR)$(tooldir)/lib${MULTISUBDIR}/$(DBUG_BSP)
# install BDM stuff
+ $(INSTALL_PROGRAM) $(BDM_CRT0) $(DESTDIR)$(tooldir)/lib${MULTISUBDIR}/$(BDM_CRT0)
$(INSTALL_PROGRAM) $(BDM_BSP) $(DESTDIR)$(tooldir)/lib${MULTISUBDIR}/$(BDM_BSP)
$(INSTALL_DATA) ${srcdir}/sbc5204.ld $(DESTDIR)$(tooldir)/lib${MULTISUBDIR}/sbc5204.ld
diff --git a/libgloss/m68k/bdm-crt0.S b/libgloss/m68k/bdm-crt0.S
new file mode 100644
index 000000000..dac6ac421
--- /dev/null
+++ b/libgloss/m68k/bdm-crt0.S
@@ -0,0 +1,85 @@
+/* The interrupt table.
+ *
+ * Copyright (c) 2006 CodeSourcery Inc
+ *
+ * The authors hereby grant permission to use, copy, modify, distribute,
+ * and license this software and its documentation for any purpose, provided
+ * that existing copyright notices are retained in all copies and that this
+ * notice is included verbatim in any distributions. No written agreement,
+ * license, or royalty fee is required for any of the authorized uses.
+ * Modifications to this software may be copyrighted by their authors
+ * and need not follow the licensing terms described here, provided that
+ * the new terms are clearly indicated on the first page of each file where
+ * they apply.
+ */
+
+ #include "asm.h"
+ .text
+
+ .globl __interrupt_vector
+__interrupt_vector:
+ .long __stack /* 0 */
+ .long __reset /* 1 */
+ .long __access_error /* 2 */
+ .long __address_error /* 3 */
+ .long __illegal_instruction /* 4 */
+ .long __divide_by_zero /* 5 */
+ .long __other_interrupt /* 6 */
+ .long __other_interrupt /* 7 */
+ .long __privilege_violation /* 8 */
+ .long __trace /* 9 */
+ .long __unimplemented_line_a_opcode /* 10 */
+ .long __unimplemented_line_f_opcode /* 11 */
+ .long __non_pc_breakpoint_debug_interrupt /* 12 */
+ .long __pc_breakpoint_debug_interrupt /* 13 */
+ .long __format_error /* 14 */
+ .rept 24 - 15
+ .long __other_interrupt /* [15,24) */
+ .endr
+ .long __spurious_interrupt /* 24 */
+ .rept 32 - 25
+ .long __other_interrupt /* [25,32) */
+ .endr
+ .long __trap0 /* 32 */
+ .long __trap1 /* 33 */
+ .long __trap2 /* 34 */
+ .long __trap3 /* 35 */
+ .long __trap4 /* 36 */
+ .long __trap5 /* 37 */
+ .long __trap6 /* 38 */
+ .long __trap7 /* 39 */
+ .long __trap8 /* 40 */
+ .long __trap9 /* 41 */
+ .long __trap10 /* 42 */
+ .long __trap11 /* 43 */
+ .long __trap12 /* 44 */
+ .long __trap13 /* 45 */
+ .long __trap14 /* 46 */
+ .long __bdm_semihosting /* 47 */
+ .long __fp_branch_unordered /* 48 */
+ .long __fp_inexact_result /* 49 */
+ .long __fp_divide_by_zero /* 50 */
+ .long __fp_underflow /* 51 */
+ .long __fp_operand_error /* 52 */
+ .long __fp_overflow /* 53 */
+ .long __fp_input_not_a_number /* 54 */
+ .long __fp_input_denormalized_number /* 55 */
+ .rept 61 - 56
+ .long __other_interrupt /* [56,61) */
+ .endr
+ .long __unsupported_instruction /* 61 */
+ .rept 64 - 62
+ .long __other_interrupt /* [62,64) */
+ .endr
+ .rept 256-64
+ .long __other_interrupt /* [64,256) */
+ .endr
+
+ .extern __stack
+ .extern __start1
+ .globl __start
+__start:
+ /* Initialize stack */
+ movel IMM(__stack), sp
+ movel IMM(0), fp
+ jmp __start1
diff --git a/libgloss/m68k/bdm-crt1.c b/libgloss/m68k/bdm-crt1.c
new file mode 100644
index 000000000..c9cfe649f
--- /dev/null
+++ b/libgloss/m68k/bdm-crt1.c
@@ -0,0 +1,63 @@
+/* Initialization code for coldfire boards.
+ *
+ * Copyright (c) 2006 CodeSourcery Inc
+ *
+ * The authors hereby grant permission to use, copy, modify, distribute,
+ * and license this software and its documentation for any purpose, provided
+ * that existing copyright notices are retained in all copies and that this
+ * notice is included verbatim in any distributions. No written agreement,
+ * license, or royalty fee is required for any of the authorized uses.
+ * Modifications to this software may be copyrighted by their authors
+ * and need not follow the licensing terms described here, provided that
+ * the new terms are clearly indicated on the first page of each file where
+ * they apply.
+ */
+
+#include <stdlib.h>
+
+extern const int __interrupt_vector[];
+extern void __reset (void);
+
+extern const char __data_load[] __attribute__ ((aligned (4)));
+extern char __data_start[] __attribute__ ((aligned (4)));
+extern char __bss_start[] __attribute__ ((aligned (4)));
+extern char __end[] __attribute__ ((aligned (4)));
+
+extern void software_init_hook (void) __attribute__ ((weak));
+extern void hardware_init_hook (void) __attribute__ ((weak));
+extern void __INIT_SECTION__ (void);
+extern void __FINI_SECTION__ (void);
+
+extern int main (int, char **, char **);
+
+/* This is called from a tiny assembly stub that just initializes the
+ stack pointer. */
+void __start1 (void)
+{
+ unsigned ix;
+
+ /* Set the VBR. */
+ __asm__ __volatile__ ("movec.l %0,%/vbr" :: "r" (__interrupt_vector));
+
+ /* Initialize memory */
+ if (__data_load != __data_start)
+ memcpy (__data_start, __data_load, __bss_start - __data_start);
+ memset (__bss_start, 0, __end - __bss_start);
+
+ if (hardware_init_hook)
+ hardware_init_hook ();
+ if (software_init_hook)
+ software_init_hook ();
+
+ __INIT_SECTION__ ();
+
+ /* I'm not sure how useful it is to have a fini_section in an
+ embedded system. */
+ atexit (__FINI_SECTION__);
+
+ ix = main (0, NULL, NULL);
+ exit (ix);
+
+ while (1)
+ __reset ();
+}
diff --git a/libgloss/m68k/bdm-exit.c b/libgloss/m68k/bdm-exit.c
index 71fa3af26..5223bcd37 100644
--- a/libgloss/m68k/bdm-exit.c
+++ b/libgloss/m68k/bdm-exit.c
@@ -17,6 +17,8 @@
#include "bdm-semihost.h"
#include "bdm-gdb.h"
+extern void __reset (void);
+
/*
* _exit -- Exit from the application.
*/
@@ -26,5 +28,6 @@ void __attribute__ ((noreturn)) _exit (int code)
while (1)
{
BDM_TRAP (BDM_EXIT, code);
+ __reset ();
}
}
diff --git a/libgloss/m68k/bdm-isv.c b/libgloss/m68k/bdm-isv.c
deleted file mode 100644
index b6a7e02b6..000000000
--- a/libgloss/m68k/bdm-isv.c
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * bdm-isv.c --
- *
- * Copyright (c) 2006 CodeSourcery Inc
- *
- * The authors hereby grant permission to use, copy, modify, distribute,
- * and license this software and its documentation for any purpose, provided
- * that existing copyright notices are retained in all copies and that this
- * notice is included verbatim in any distributions. No written agreement,
- * license, or royalty fee is required for any of the authorized uses.
- * Modifications to this software may be copyrighted by their authors
- * and need not follow the licensing terms described here, provided that
- * the new terms are clearly indicated on the first page of each file where
- * they apply.
- */
-
-/* This file contains default interrupt handlers and initialization
- code for the interrupt vector. All but one of the interrupts are
- user replaceable.
-
- User trap BDM_TRAPNUM (15) is used for semi hosting support.
- If you replace this one, semihosting will cease to function. */
-
-#include "bdm-semihost.h"
-
-#define NUM_VECTORS 256
-
-#define ISR_DECLARE(NAME) void __attribute__((interrupt_handler)) NAME (void)
-
-ISR_DECLARE (__other_interrupt);
-ISR_DECLARE (__reset);
-ISR_DECLARE (__access_error);
-ISR_DECLARE (__address_error);
-ISR_DECLARE (__illegal_instruction);
-ISR_DECLARE (__divide_by_zero);
-ISR_DECLARE (__privilege_violation);
-ISR_DECLARE (__trace);
-ISR_DECLARE (__unimplemented_line_a_opcode);
-ISR_DECLARE (__unimplemented_line_f_opcode);
-ISR_DECLARE (__non_pc_breakpoint_debug_interrupt);
-ISR_DECLARE (__pc_breakpoint_debug_interrupt);
-ISR_DECLARE (__format_error);
-ISR_DECLARE (__spurious_interrupt);
-ISR_DECLARE (__trap0);
-ISR_DECLARE (__trap1);
-ISR_DECLARE (__trap2);
-ISR_DECLARE (__trap3);
-ISR_DECLARE (__trap4);
-ISR_DECLARE (__trap5);
-ISR_DECLARE (__trap6);
-ISR_DECLARE (__trap7);
-ISR_DECLARE (__trap8);
-ISR_DECLARE (__trap9);
-ISR_DECLARE (__trap10);
-ISR_DECLARE (__trap11);
-ISR_DECLARE (__trap12);
-ISR_DECLARE (__trap13);
-ISR_DECLARE (__trap14);
-ISR_DECLARE (__trap15);
-ISR_DECLARE (__fp_branch_unordered);
-ISR_DECLARE (__fp_inexact_result);
-ISR_DECLARE (__fp_divide_by_zero);
-ISR_DECLARE (__fp_underflow);
-ISR_DECLARE (__fp_operand_error);
-ISR_DECLARE (__fp_overflow);
-ISR_DECLARE (__fp_input_not_a_number);
-ISR_DECLARE (__fp_input_denormalized_number);
-ISR_DECLARE (__unsupported_instruction);
-
-/* The trap used for semihosting by the debugger. This must have a
- particular assembly signature, so we don't generate it with the
- compiler. */
-ISR_DECLARE (__bdm_semihosting);
-
-/* The interrupt vector itself must be provided by the linker script
- as it requires 1MB alignment. */
-extern void (*__interrupt_vector[NUM_VECTORS])(void);
-
-/* The linker script sets the stack pointer too. */
-extern int __attribute__ ((weak)) __stack;
-
-/* This hook is called during crt startup and installs and initializes
- the vector table. It is overridable by a user provided routine.
- If the user routine fails to install the __bdm_semihosting routine,
- semihosting will cease to function. */
-
-void software_init_hook (void)
-{
- unsigned ix;
-
- /* Don't set it if it's -1 (zero is a valid value) */
- if ((long)&__interrupt_vector == -1)
- return;
-
- for (ix = 0; ix != NUM_VECTORS; ix++)
- __interrupt_vector[ix] = &__other_interrupt;
-
- /* Set the VBR. */
- __asm__ __volatile__ ("movec.l %0,%/vbr" :: "r" (&__interrupt_vector));
-
- /* Set an initial stack and reset vector, in case we unexpectedly get
- reset. */
- __interrupt_vector[0] = (&__stack ? (void (*)(void))&__stack
- : (void (*)(void))&__interrupt_vector[NUM_VECTORS]);
- __interrupt_vector[1] = &__reset;
-
- /* Store the known interrupt vectors */
- __interrupt_vector[2] = &__access_error;
- __interrupt_vector[3] = &__address_error;
- __interrupt_vector[4] = &__illegal_instruction;
- __interrupt_vector[5] = &__divide_by_zero;
- __interrupt_vector[8] = &__privilege_violation;
- __interrupt_vector[9] = &__trace;
- __interrupt_vector[10] = &__unimplemented_line_a_opcode;
- __interrupt_vector[11] = &__unimplemented_line_f_opcode;
- __interrupt_vector[12] = &__non_pc_breakpoint_debug_interrupt;
- __interrupt_vector[13] = &__pc_breakpoint_debug_interrupt;
- __interrupt_vector[14] = &__format_error;
- __interrupt_vector[24] = &__spurious_interrupt;
- __interrupt_vector[32] = &__trap0;
- __interrupt_vector[33] = &__trap1;
- __interrupt_vector[34] = &__trap2;
- __interrupt_vector[35] = &__trap3;
- __interrupt_vector[36] = &__trap4;
- __interrupt_vector[37] = &__trap5;
- __interrupt_vector[38] = &__trap6;
- __interrupt_vector[39] = &__trap7;
- __interrupt_vector[40] = &__trap8;
- __interrupt_vector[41] = &__trap9;
- __interrupt_vector[42] = &__trap10;
- __interrupt_vector[43] = &__trap11;
- __interrupt_vector[44] = &__trap12;
- __interrupt_vector[45] = &__trap13;
- __interrupt_vector[46] = &__trap14;
- __interrupt_vector[47] = &__trap15;
- __interrupt_vector[48] = &__fp_branch_unordered;
- __interrupt_vector[49] = &__fp_inexact_result;
- __interrupt_vector[50] = &__fp_divide_by_zero;
- __interrupt_vector[51] = &__fp_underflow;
- __interrupt_vector[52] = &__fp_operand_error;
- __interrupt_vector[53] = &__fp_overflow;
- __interrupt_vector[54] = &__fp_input_not_a_number;
- __interrupt_vector[55] = &__fp_input_denormalized_number;
- __interrupt_vector[61] = &__unsupported_instruction;
-
- /* Install the special handler. */
- __interrupt_vector[0x20 + BDM_TRAPNUM] = &__bdm_semihosting;
-}
diff --git a/libgloss/m68k/cf.sc b/libgloss/m68k/cf.sc
index 01b07b9dc..b19dce4ce 100644
--- a/libgloss/m68k/cf.sc
+++ b/libgloss/m68k/cf.sc
@@ -1,46 +1,34 @@
# a linker script template.
-# RAMSTART - start of board's ram
-# RAMSIZE - size of board's ram
-# RAMDBUG - bytes at start of RAM for DBUG use
-# ISV - nonnull if interrupt service vector should be provided.
-# IO - io library
+# RAM - start of board's ram
+# RAM_SIZE - size of board's ram
+# ROM - start of board's rom
+# ROM_SIZE - size of board's rom
+
+test -z "${ROM:+1}" && NOROM=1
cat <<EOF
-STARTUP(crt0.o)
+STARTUP(bdm-crt0.o)
OUTPUT_ARCH(m68k)
-ENTRY(_start)
+ENTRY(__start)
SEARCH_DIR(.)
-GROUP(-lc -l${IO})
+GROUP(-lc -lbdm)
__DYNAMIC = 0;
MEMORY
{
- ram (rwx) : ORIGIN = ${RAMSTART} + ${RAMDBUG:-0},
- LENGTH = ${RAMSIZE} - ${RAMDBUG:-0}
+ ${ROM:+rom (rx) : ORIGIN = ${ROM}, LENGTH = ${ROM_SIZE}}
+ ram (rwx) : ORIGIN = ${RAM}, LENGTH = ${RAM_SIZE}
}
/* Place the stack at the end of memory, unless specified otherwise. */
-PROVIDE (__stack = ${RAMSTART} + ${RAMSIZE});
-
-/* Inhibit an interrupt vector, if one is not specified. */
-PROVIDE (__interrupt_vector = -1);
-
-/*
- * Initalize some symbols to be zero so we can reference them in the
- * crt0 without core dumping. These functions are all optional, but
- * we do this so we can have our crt0 always use them if they exist.
- */
-PROVIDE (hardware_init_hook = 0);
-PROVIDE (software_init_hook = 0);
-/*
- * stick everything in ram (of course)
- */
+PROVIDE (__stack = ${RAM} + ${RAM_SIZE});
+
SECTIONS
{
.text :
{
CREATE_OBJECT_SYMBOLS
- ${ISV+__interrupt_vector = .; . += 256 * 4;}
+ bdm-crt0.o(.text)
*(.text .text.*)
. = ALIGN(0x4);
@@ -48,11 +36,11 @@ SECTIONS
KEEP (*crtbegin.o(.ctors))
KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))
KEEP (*(SORT(.ctors.*)))
- KEEP (*(.ctors))
+ KEEP (*crtend.o(.ctors))
KEEP (*crtbegin.o(.dtors))
KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))
KEEP (*(SORT(.dtors.*)))
- KEEP (*(.dtors))
+ KEEP (*crtend.o(.dtors))
*(.rodata .rodata.*)
@@ -76,28 +64,33 @@ SECTIONS
SHORT (0x4e5e) /* unlk %fp */
SHORT (0x4e75) /* rts */
- _etext = .;
*(.lit)
- } > ram
+
+ . = ALIGN(4);
+ _etext = .;
+ } >${ROM:+rom}${NOROM:+ram}
.data :
{
+ __data_load = LOADADDR (.data);
+ __data_start = .;
*(.got.plt) *(.got)
*(.shdata)
*(.data .data.*)
+ . = ALIGN (4);
_edata = .;
- } > ram
+ } >ram ${ROM:+AT>rom}
.bss :
{
- . = ALIGN(0x4);
__bss_start = . ;
*(.shbss)
*(.bss .bss.*)
*(COMMON)
- _end = ALIGN (0x8);
+ . = ALIGN (8);
+ _end = .;
__end = _end;
- } > ram
+ } >ram ${ROM:+AT>rom}
.stab 0 (NOLOAD) :
{
diff --git a/libgloss/m68k/dbug-exit.S b/libgloss/m68k/dbug-exit.S
deleted file mode 100644
index 6baae8b19..000000000
--- a/libgloss/m68k/dbug-exit.S
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * dbug-exit.S --
- *
- * Copyright (c) 1996 Cygnus Support
- *
- * The authors hereby grant permission to use, copy, modify, distribute,
- * and license this software and its documentation for any purpose, provided
- * that existing copyright notices are retained in all copies and that this
- * notice is included verbatim in any distributions. No written agreement,
- * license, or royalty fee is required for any of the authorized uses.
- * Modifications to this software may be copyrighted by their authors
- * and need not follow the licensing terms described here, provided that
- * the new terms are clearly indicated on the first page of each file where
- * they apply.
- */
-
-#include "asm.h"
-
- .text
- .global SYM (_exit)
-/*
- * _exit -- Exit from the application. Normally we cause a user trap
- * to return to the ROM monitor for another run.
- */
- .text
- .align 2
-SYM (_exit):
- moveql IMM(0),d0
- trap IMM(15)
diff --git a/libgloss/m68k/dbug-inbyte.S b/libgloss/m68k/dbug-inbyte.S
deleted file mode 100644
index 128c260b5..000000000
--- a/libgloss/m68k/dbug-inbyte.S
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * dbug-inbyte.S --
- *
- * Copyright (c) 1996 Cygnus Support
- *
- * The authors hereby grant permission to use, copy, modify, distribute,
- * and license this software and its documentation for any purpose, provided
- * that existing copyright notices are retained in all copies and that this
- * notice is included verbatim in any distributions. No written agreement,
- * license, or royalty fee is required for any of the authorized uses.
- * Modifications to this software may be copyrighted by their authors
- * and need not follow the licensing terms described here, provided that
- * the new terms are clearly indicated on the first page of each file where
- * they apply.
- */
-
-#include "asm.h"
-
- .text
- .global SYM (inbyte)
- .global SYM (getDebugChar)
-
-/*
- * inbyte -- get a byte from the serial port
- * d0 - contains the byte read in
- */
- .text
- .align 2
-SYM (getDebugChar): /* symbol name used by m68k-stub */
-SYM (inbyte):
- movel IMM(0x10),d0
- trap IMM(15)
- movel d1,d0
- rts
diff --git a/libgloss/m68k/dbug-outbyte.S b/libgloss/m68k/dbug-outbyte.S
deleted file mode 100644
index 9d0c86443..000000000
--- a/libgloss/m68k/dbug-outbyte.S
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * dbug-outbyte.S --
- *
- * Copyright (c) 1996 Cygnus Support
- *
- * The authors hereby grant permission to use, copy, modify, distribute,
- * and license this software and its documentation for any purpose, provided
- * that existing copyright notices are retained in all copies and that this
- * notice is included verbatim in any distributions. No written agreement,
- * license, or royalty fee is required for any of the authorized uses.
- * Modifications to this software may be copyrighted by their authors
- * and need not follow the licensing terms described here, provided that
- * the new terms are clearly indicated on the first page of each file where
- * they apply.
- */
-
-#include "asm.h"
-
- .text
- .global SYM (outbyte)
- .global SYM (putDebugChar)
-
-/*
- * outbyte -- sends a byte out the serial port
- * d0 - contains the byte to be sent
- */
- .text
- .align 2
-SYM (putDebugChar): /* symbol name used by m68k-stub */
-SYM (outbyte):
- movel sp@(4),d1
- movl IMM(0x13),d0
- trap IMM(15)
- rts