mirror of
git://sourceware.org/git/newlib-cygwin.git
synced 2025-02-23 09:09:35 +08:00
* libgloss/m68k/Makefile.in (BDM_BSP, BDM_OBJS, BDM_ISRS): New.
(CF_SCRIPTS): Rename dbug scripts. Add bdm scripts. Add m5485 scripts. (all): Add new targets. (BDM_BSP): New target. (bdm-isv.o, bdm-exit.o, bdm-outbyte.o, bdm-semihost.o): New targets. (BDM_ISRS): New targets. (m5208evb.ld, m5213evb.ld, m5235evb.ld, m5272c3.ld, m5282evb.ld): Rename and adjust. (m5485evb-dbug): New. (m5208evb-bdm.ld, m5213evb-bdm.ld, m5235evb-bdm.ld, m5272c3-bdm.ld, m5282evb-bdm.ld, m5485evb-bdm.ld): New. (install): Add BDM_BSP. * libgloss/m68k/bdm-exit.c: New * libgloss/m68k/bdm-inbyte.c: New * libgloss/m68k/bdm-outbyte.c: New * libgloss/m68k/bdm-semihost.c: New * libgloss/m68k/bdm-semihost.h: New * libgloss/m68k/bdm-isrs.c: New. * libgloss/m68k/bdm-isv.c: New. * cf-dbug.sc: Renamed to ... * cf.sc: ... here. Add bdm flexibility. Remove GROUP
This commit is contained in:
parent
5ca8637aa7
commit
017a82abc6
@ -1,3 +1,29 @@
|
||||
2006-03-29 Nathan Sidwell <nathan@codesourcery.com>
|
||||
|
||||
* libgloss/m68k/Makefile.in (BDM_BSP, BDM_OBJS, BDM_ISRS): New.
|
||||
(CF_SCRIPTS): Rename dbug scripts. Add bdm scripts. Add m5485
|
||||
scripts.
|
||||
(all): Add new targets.
|
||||
(BDM_BSP): New target.
|
||||
(bdm-isv.o, bdm-exit.o, bdm-outbyte.o, bdm-semihost.o): New
|
||||
targets.
|
||||
(BDM_ISRS): New targets.
|
||||
(m5208evb.ld, m5213evb.ld, m5235evb.ld, m5272c3.ld, m5282evb.ld):
|
||||
Rename and adjust.
|
||||
(m5485evb-dbug): New.
|
||||
(m5208evb-bdm.ld, m5213evb-bdm.ld, m5235evb-bdm.ld,
|
||||
m5272c3-bdm.ld, m5282evb-bdm.ld, m5485evb-bdm.ld): New.
|
||||
(install): Add BDM_BSP.
|
||||
* libgloss/m68k/bdm-exit.c: New
|
||||
* libgloss/m68k/bdm-inbyte.c: New
|
||||
* libgloss/m68k/bdm-outbyte.c: New
|
||||
* libgloss/m68k/bdm-semihost.c: New
|
||||
* libgloss/m68k/bdm-semihost.h: New
|
||||
* libgloss/m68k/bdm-isrs.c: New.
|
||||
* libgloss/m68k/bdm-isv.c: New.
|
||||
* cf-dbug.sc: Renamed to ...
|
||||
* cf.sc: ... here. Add bdm flexibility. Remove GROUP
|
||||
|
||||
2006-03-23 Mark Mitchell <mark@codesourcery.com>
|
||||
|
||||
* libc/sys/arm/Makefile.am (extra_objs): Add _exit.o _nmi_isr.o
|
||||
|
@ -123,7 +123,26 @@ IDPGDB_OBJS= leds.o idp-inbyte.o idp-gdb-outbyte.o mc68ec.o
|
||||
DBUG_BSP= libdbug.a
|
||||
DBUG_OBJS= dbug-exit.o dbug-inbyte.o dbug-outbyte.o
|
||||
|
||||
CF_SCRIPTS= m5208evb.ld m5213evb.ld m5235evb.ld m5272c3.ld m5282evb.ld
|
||||
#
|
||||
# here's all the BDM semihosting stuff
|
||||
#
|
||||
BDM_BSP= libbdm.a
|
||||
BDM_OBJS= bdm-exit.o bdm-inbyte.o bdm-outbyte.o bdm-isv.o \
|
||||
bdm-semihost.o $(patsubst %,bdm-%.o,${BDM_ISRS})
|
||||
BDM_ISRS= other_interrupt reset access_error address_error \
|
||||
illegal_instruction divide_by_zero privilege_violation \
|
||||
trace unimplemented_line_a_opcode unimplemented_line_f_opcode \
|
||||
non_pc_breakpoint_debug_interrupt pc_breakpoint_debug_interrupt \
|
||||
format_error spurious_interrupt trap0 trap1 trap2 trap3 trap4 \
|
||||
trap5 trap6 trap7 trap8 trap9 trap10 trap11 trap12 trap13 trap14 \
|
||||
trap15 fp_branch_unordered fp_inexact_result fp_divide_by_zero \
|
||||
fp_underflow fp_operand_error fp_overflow fp_input_not_a_number \
|
||||
fp_input_denormalized_number unsupported_instruction
|
||||
|
||||
CF_SCRIPTS= m5208evb-dbug.ld m5213evb-dbug.ld m5235evb-dbug.ld \
|
||||
m5272c3-dbug.ld m5282evb-dbug.ld m5485evb-dbug.ld \
|
||||
m5208evb-bdm.ld m5213evb-bdm.ld m5235evb-bdm.ld \
|
||||
m5272c3-bdm.ld m5282evb-bdm.ld m5485evb-bdm.ld
|
||||
|
||||
# Host specific makefile fragment comes in here.
|
||||
@host_makefile_frag@
|
||||
@ -132,7 +151,7 @@ CF_SCRIPTS= m5208evb.ld m5213evb.ld m5235evb.ld m5272c3.ld m5282evb.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} ${CF_SCRIPTS}
|
||||
all: ${SIM_CRT0} ${SIM_BSP} ${CRT0} ${BCC_BSP} ${IDP_BSP} ${IDPGDB_BSP} ${MVME135_BSP} ${MVME162_BSP} ${DBUG_BSP} ${BDM_BSP} ${CF_SCRIPTS}
|
||||
|
||||
#
|
||||
# here's where we build the board support packages for each target
|
||||
@ -157,6 +176,10 @@ ${DBUG_BSP}: $(OBJS) ${DBUG_OBJS}
|
||||
${AR} ${ARFLAGS} $@ $(OBJS) ${DBUG_OBJS}
|
||||
${RANLIB} $@
|
||||
|
||||
${BDM_BSP}: $(OBJS) ${BDM_OBJS}
|
||||
${AR} ${ARFLAGS} $@ $(OBJS) ${BDM_OBJS}
|
||||
${RANLIB} $@
|
||||
|
||||
${MVME135_BSP}: $(OBJS) ${MVME135_OBJS}
|
||||
${AR} ${ARFLAGS} $@ $(OBJS) ${MVME135_OBJS}
|
||||
${RANLIB} $@
|
||||
@ -165,21 +188,52 @@ ${MVME162_BSP}: $(OBJS) ${MVME162_OBJS}
|
||||
${AR} ${ARFLAGS} $@ $(OBJS) ${MVME162_OBJS}
|
||||
${RANLIB} $@
|
||||
|
||||
m5208evb.ld: dbug-cf.sc Makefile
|
||||
bdm-isv.o : bdm-isv.c bdm-semihost.h
|
||||
bdm-exit.o : bdm-exit.c bdm-semihost.h
|
||||
bdm-outbyte.o : bdm-outbyte.c bdm-semihost.h
|
||||
bdm-semihost.o : bdm-semihost.c
|
||||
$(CC) $(CFLAGS_FOR_TARGET) $(INCLUDES) -c $< -o $@ -fomit-frame-pointer
|
||||
|
||||
$(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
|
||||
RAMSTART=1024M RAMSIZE=16M RAMDBUG=128K ${SHELL} $< > $@
|
||||
|
||||
m5213evb.ld: dbug-cf.sc Makefile
|
||||
m5213evb-dbug.ld: cf.sc Makefile
|
||||
RAMSTART=512M RAMSIZE=32K RAMDBUG=8K ${SHELL} $< > $@
|
||||
|
||||
m5235evb.ld: dbug-cf.sc Makefile
|
||||
m5235evb-dbug.ld: cf.sc Makefile
|
||||
RAMSTART=0M RAMSIZE=16M RAMDBUG=64K ${SHELL} $< > $@
|
||||
|
||||
m5272c3.ld: dbug-cf.sc Makefile
|
||||
m5272c3-dbug.ld: cf.sc Makefile
|
||||
RAMSTART=0M RAMSIZE=4M RAMDBUG=128K ${SHELL} $< > $@
|
||||
|
||||
m5282evb.ld: dbug-cf.sc Makefile
|
||||
m5282evb-dbug.ld: cf.sc Makefile
|
||||
RAMSTART=0M RAMSIZE=16M RAMDBUG=64K ${SHELL} $< > $@
|
||||
|
||||
m5485evb-dbug.ld: cf.sc Makefile
|
||||
RAMSTART=0M RAMSIZE=64M RAMDBUG=128K ${SHELL} $< > $@
|
||||
|
||||
m5208evb-bdm.ld: cf.sc Makefile
|
||||
ISV=1 RAMSTART=1024M RAMSIZE=16M ${SHELL} $< > $@
|
||||
|
||||
m5213evb-bdm.ld: cf.sc Makefile
|
||||
ISV=1 RAMSTART=512M RAMSIZE=32K ${SHELL} $< > $@
|
||||
|
||||
m5235evb-bdm.ld: cf.sc Makefile
|
||||
ISV=1 RAMSTART=0M RAMSIZE=16M ${SHELL} $< > $@
|
||||
|
||||
m5272c3-bdm.ld: cf.sc Makefile
|
||||
ISV=1 RAMSTART=0M RAMSIZE=4M ${SHELL} $< > $@
|
||||
|
||||
m5282evb-bdm.ld: cf.sc Makefile
|
||||
RAMSTART=0M RAMSIZE=16M ${SHELL} $< > $@
|
||||
|
||||
m5485evb-bdm.ld: cf.sc Makefile
|
||||
ISV=1 RAMSTART=0M RAMSIZE=64M ${SHELL} $< > $@
|
||||
|
||||
leds.o: ${srcdir}/leds.c
|
||||
$(CC) $(CFLAGS_FOR_TARGET) $(INCLUDES) -c $<
|
||||
|
||||
@ -298,6 +352,9 @@ install:
|
||||
$(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_BSP) $(DESTDIR)$(tooldir)/lib${MULTISUBDIR}/$(BDM_BSP)
|
||||
|
||||
$(INSTALL_DATA) ${srcdir}/sbc5204.ld $(DESTDIR)$(tooldir)/lib${MULTISUBDIR}/sbc5204.ld
|
||||
$(INSTALL_DATA) ${srcdir}/sbc5206.ld $(DESTDIR)$(tooldir)/lib${MULTISUBDIR}/sbc5206.ld
|
||||
for script in $(CF_SCRIPTS) ; \
|
||||
|
31
libgloss/m68k/bdm-exit.c
Normal file
31
libgloss/m68k/bdm-exit.c
Normal file
@ -0,0 +1,31 @@
|
||||
/*
|
||||
* bdm-exit.c --
|
||||
*
|
||||
* Copyright (c) 2006 CodeSourcery CSI
|
||||
*
|
||||
* 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 "bdm-semihost.h"
|
||||
|
||||
/*
|
||||
* _exit -- Exit from the application.
|
||||
*/
|
||||
|
||||
void __attribute__ ((noreturn)) _exit (int code)
|
||||
{
|
||||
while (1)
|
||||
__asm__ __volatile__ ("move.l %0,%/" BDM_ARG_REG "\n"
|
||||
"moveq %1,%/" BDM_FUNC_REG "\n"
|
||||
"trap %2"
|
||||
:: "rmi" (code), "n" (BDM_EXIT), "n" (BDM_TRAP)
|
||||
: BDM_FUNC_REG,BDM_ARG_REG,BDM_RESULT_REG,"memory");
|
||||
}
|
24
libgloss/m68k/bdm-inbyte.c
Normal file
24
libgloss/m68k/bdm-inbyte.c
Normal file
@ -0,0 +1,24 @@
|
||||
/*
|
||||
* bdm-inbyte.c --
|
||||
*
|
||||
* Copyright (c) 2006 CodeSourcery CSI
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
|
||||
/* Read a character from the input. This is currently unsupported.
|
||||
*/
|
||||
|
||||
int inbyte (void)
|
||||
{
|
||||
return -1;
|
||||
}
|
192
libgloss/m68k/bdm-isrs.c
Normal file
192
libgloss/m68k/bdm-isrs.c
Normal file
@ -0,0 +1,192 @@
|
||||
/*
|
||||
* bdm-isv.c --
|
||||
*
|
||||
* Copyright (c) 2006 CodeSourcery CSI
|
||||
*
|
||||
* 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 code for the
|
||||
interrupt vector. All but one of the interrupts are user
|
||||
replaceable.
|
||||
|
||||
These interrupt handlers are entered whenever the associated
|
||||
interrupt occurs. All they do is stop the debugger to give the user
|
||||
the opportunity to determine where the problem was.
|
||||
|
||||
User trap BDM_TRAP (15) is used for semi hosting support.
|
||||
If you replace this one, semihosting will cease to function. */
|
||||
|
||||
|
||||
/* Each ISR is a loop containing a halt instruction */
|
||||
#define ISR_DEFINE(NAME) \
|
||||
void __attribute__((interrupt_handler)) NAME (void) \
|
||||
{ \
|
||||
while (1) \
|
||||
__asm__ __volatile__ ("halt" ::: "memory"); \
|
||||
} \
|
||||
struct eat_trailing_semicolon
|
||||
|
||||
#if defined (L_other_interrupt)
|
||||
ISR_DEFINE (__other_interrupt);
|
||||
#endif
|
||||
|
||||
#if defined (L_reset)
|
||||
ISR_DEFINE (__reset);
|
||||
#endif
|
||||
|
||||
#if defined (L_access_error)
|
||||
ISR_DEFINE (__access_error);
|
||||
#endif
|
||||
|
||||
#if defined (L_address_error)
|
||||
ISR_DEFINE (__address_error);
|
||||
#endif
|
||||
|
||||
#if defined (L_illegal_instruction)
|
||||
ISR_DEFINE (__illegal_instruction);
|
||||
#endif
|
||||
|
||||
#if defined (L_divide_by_zero)
|
||||
ISR_DEFINE (__divide_by_zero);
|
||||
#endif
|
||||
|
||||
#if defined (L_privilege_violation)
|
||||
ISR_DEFINE (__privilege_violation);
|
||||
#endif
|
||||
|
||||
#if defined (L_trace)
|
||||
ISR_DEFINE (__trace);
|
||||
#endif
|
||||
|
||||
#if defined (L_unimplemented_line_a_opcode)
|
||||
ISR_DEFINE (__unimplemented_line_a_opcode);
|
||||
#endif
|
||||
|
||||
#if defined (L_unimplemented_line_f_opcode)
|
||||
ISR_DEFINE (__unimplemented_line_f_opcode);
|
||||
#endif
|
||||
|
||||
#if defined (L_non_pc_breakpoint_debug_interrupt)
|
||||
ISR_DEFINE (__non_pc_breakpoint_debug_interrupt);
|
||||
#endif
|
||||
|
||||
#if defined (L_pc_breakpoint_debug_interrupt)
|
||||
ISR_DEFINE (__pc_breakpoint_debug_interrupt);
|
||||
#endif
|
||||
|
||||
#if defined (L_format_error)
|
||||
ISR_DEFINE (__format_error);
|
||||
#endif
|
||||
|
||||
#if defined (L_spurious_interrupt)
|
||||
ISR_DEFINE (__spurious_interrupt);
|
||||
#endif
|
||||
|
||||
#if defined (L_trap0)
|
||||
ISR_DEFINE (__trap0);
|
||||
#endif
|
||||
|
||||
#if defined (L_trap1)
|
||||
ISR_DEFINE (__trap1);
|
||||
#endif
|
||||
|
||||
#if defined (L_trap2)
|
||||
ISR_DEFINE (__trap2);
|
||||
#endif
|
||||
|
||||
#if defined (L_trap3)
|
||||
ISR_DEFINE (__trap3);
|
||||
#endif
|
||||
|
||||
#if defined (L_trap4)
|
||||
ISR_DEFINE (__trap4);
|
||||
#endif
|
||||
|
||||
#if defined (L_trap5)
|
||||
ISR_DEFINE (__trap5);
|
||||
#endif
|
||||
|
||||
#if defined (L_trap6)
|
||||
ISR_DEFINE (__trap6);
|
||||
#endif
|
||||
|
||||
#if defined (L_trap7)
|
||||
ISR_DEFINE (__trap7);
|
||||
#endif
|
||||
|
||||
#if defined (L_trap8)
|
||||
ISR_DEFINE (__trap8);
|
||||
#endif
|
||||
|
||||
#if defined (L_trap9)
|
||||
ISR_DEFINE (__trap9);
|
||||
#endif
|
||||
|
||||
#if defined (L_trap10)
|
||||
ISR_DEFINE (__trap10);
|
||||
#endif
|
||||
|
||||
#if defined (L_trap11)
|
||||
ISR_DEFINE (__trap11);
|
||||
#endif
|
||||
|
||||
#if defined (L_trap12)
|
||||
ISR_DEFINE (__trap12);
|
||||
#endif
|
||||
|
||||
#if defined (L_trap13)
|
||||
ISR_DEFINE (__trap13);
|
||||
#endif
|
||||
|
||||
#if defined (L_trap14)
|
||||
ISR_DEFINE (__trap14);
|
||||
#endif
|
||||
|
||||
#if defined (L_trap15)
|
||||
ISR_DEFINE (__trap15);
|
||||
#endif
|
||||
|
||||
#if defined (L_fp_branch_unordered)
|
||||
ISR_DEFINE (__fp_branch_unordered);
|
||||
#endif
|
||||
|
||||
#if defined (L_fp_inexact_result)
|
||||
ISR_DEFINE (__fp_inexact_result);
|
||||
#endif
|
||||
|
||||
#if defined (L_fp_divide_by_zero)
|
||||
ISR_DEFINE (__fp_divide_by_zero);
|
||||
#endif
|
||||
|
||||
#if defined (L_fp_underflow)
|
||||
ISR_DEFINE (__fp_underflow);
|
||||
#endif
|
||||
|
||||
#if defined (L_fp_operand_error)
|
||||
ISR_DEFINE (__fp_operand_error);
|
||||
#endif
|
||||
|
||||
#if defined (L_fp_overflow)
|
||||
ISR_DEFINE (__fp_overflow);
|
||||
#endif
|
||||
|
||||
#if defined (L_fp_input_not_a_number)
|
||||
ISR_DEFINE (__fp_input_not_a_number);
|
||||
#endif
|
||||
|
||||
#if defined (L_fp_input_denormalized_number)
|
||||
ISR_DEFINE (__fp_input_denormalized_number);
|
||||
#endif
|
||||
|
||||
#if defined (L_unsupported_instruction)
|
||||
ISR_DEFINE (__unsupported_instruction);
|
||||
#endif
|
148
libgloss/m68k/bdm-isv.c
Normal file
148
libgloss/m68k/bdm-isv.c
Normal file
@ -0,0 +1,148 @@
|
||||
/*
|
||||
* bdm-isv.c --
|
||||
*
|
||||
* Copyright (c) 2006 CodeSourcery CSI
|
||||
*
|
||||
* 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_TRAP (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[32] = &__trap1;
|
||||
__interrupt_vector[32] = &__trap2;
|
||||
__interrupt_vector[32] = &__trap3;
|
||||
__interrupt_vector[32] = &__trap4;
|
||||
__interrupt_vector[32] = &__trap5;
|
||||
__interrupt_vector[32] = &__trap6;
|
||||
__interrupt_vector[32] = &__trap7;
|
||||
__interrupt_vector[32] = &__trap8;
|
||||
__interrupt_vector[32] = &__trap9;
|
||||
__interrupt_vector[32] = &__trap10;
|
||||
__interrupt_vector[32] = &__trap11;
|
||||
__interrupt_vector[32] = &__trap12;
|
||||
__interrupt_vector[32] = &__trap13;
|
||||
__interrupt_vector[32] = &__trap14;
|
||||
__interrupt_vector[32] = &__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_TRAP] = &__bdm_semihosting;
|
||||
}
|
32
libgloss/m68k/bdm-outbyte.c
Normal file
32
libgloss/m68k/bdm-outbyte.c
Normal file
@ -0,0 +1,32 @@
|
||||
/*
|
||||
* bdm-outbyte.c --
|
||||
*
|
||||
* Copyright (c) 2006 CodeSourcery CSI
|
||||
*
|
||||
* 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 "bdm-semihost.h"
|
||||
|
||||
/*
|
||||
* outbyte -- output a byte to a console.
|
||||
*/
|
||||
|
||||
void outbyte (char c)
|
||||
{
|
||||
int code = c & 0xff;
|
||||
|
||||
__asm__ __volatile__ ("move.l %0,%/" BDM_ARG_REG "\n"
|
||||
"moveq %1,%/" BDM_FUNC_REG "\n"
|
||||
"trap %2"
|
||||
:: "rmi" (code), "n" (BDM_PUTCHAR), "n" (BDM_TRAP)
|
||||
: BDM_FUNC_REG,BDM_ARG_REG,BDM_RESULT_REG,"memory");
|
||||
}
|
25
libgloss/m68k/bdm-semihost.c
Normal file
25
libgloss/m68k/bdm-semihost.c
Normal file
@ -0,0 +1,25 @@
|
||||
/*
|
||||
* bdm-semihost.c --
|
||||
*
|
||||
* Copyright (c) 2006 CodeSourcery
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/* Semihosting trap. The debugger intercepts this and
|
||||
performs the semihosting action. Then the program resumes as
|
||||
usual. This function must be compiled without a frame pointer, so
|
||||
we know the halt instruction is the very first instuction. */
|
||||
|
||||
void __attribute__ ((interrupt_handler)) __bdm_semihosting (void)
|
||||
{
|
||||
__asm__ __volatile__ ("halt" ::: "memory");
|
||||
}
|
35
libgloss/m68k/bdm-semihost.h
Normal file
35
libgloss/m68k/bdm-semihost.h
Normal file
@ -0,0 +1,35 @@
|
||||
/*
|
||||
* bdm semihosting support.
|
||||
*
|
||||
* Copyright (c) 2006 CodeSourcery CSI
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/* Semihosting uses a user trap handler containing a HALT
|
||||
instruction. This wakes the debugger to perform some action. */
|
||||
|
||||
/* This is the semihosting trap hander */
|
||||
#define BDM_TRAP 15
|
||||
|
||||
/* This register holds the function enumeration for a semihosting
|
||||
command. */
|
||||
#define BDM_FUNC_REG "d0"
|
||||
/* This register holds the argument for the semihosting call. */
|
||||
#define BDM_ARG_REG "d1"
|
||||
/* This register holds the result of a semihosting call. */
|
||||
#define BDM_RESULT_REG "d0"
|
||||
|
||||
/* Program exit. Argument is exit code. */
|
||||
#define BDM_EXIT 0
|
||||
|
||||
/* Output char to console. Argument is char to print. */
|
||||
#define BDM_PUTCHAR 1
|
@ -2,15 +2,13 @@
|
||||
# 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.
|
||||
|
||||
cat <<EOF
|
||||
STARTUP(crt0.o)
|
||||
OUTPUT_ARCH(m68k)
|
||||
/* DBUG loads SREC files */
|
||||
/*OUTPUT_FORMAT(srec)*/
|
||||
ENTRY(start)
|
||||
SEARCH_DIR(.)
|
||||
GROUP(-ldbug -lc -lgcc -ldbug)
|
||||
__DYNAMIC = 0;
|
||||
|
||||
MEMORY
|
||||
@ -19,20 +17,19 @@ MEMORY
|
||||
LENGTH = ${RAMSIZE} - ${RAMDBUG:-0}
|
||||
}
|
||||
|
||||
/* 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.
|
||||
* This is so BSPs work better when using the crt0 installed gcc.
|
||||
* We have to initalize them twice, so we cover a.out (which prepends
|
||||
* an underscore) and coff object file formats.
|
||||
*/
|
||||
PROVIDE (hardware_init_hook = 0);
|
||||
PROVIDE (_hardware_init_hook = 0);
|
||||
PROVIDE (software_init_hook = 0);
|
||||
PROVIDE (_software_init_hook = 0);
|
||||
/*
|
||||
* stick everything in ram (of course)
|
||||
*/
|
||||
@ -41,6 +38,7 @@ SECTIONS
|
||||
.text :
|
||||
{
|
||||
CREATE_OBJECT_SYMBOLS
|
||||
${ISV+__interrupt_vector = .; . += 256 * 4;}
|
||||
*(.text .text.*)
|
||||
|
||||
. = ALIGN(0x4);
|
Loading…
x
Reference in New Issue
Block a user