4
0
mirror of git://sourceware.org/git/newlib-cygwin.git synced 2025-02-22 16:49:45 +08:00

libgloss/

* m68k/Makefile.in (CF_CRT0): Rename to CF_CRT0S, separate hosted
	& unhosted versions.
	(CF_OBJS): Add cf-isv.o.
	(CF_SOURCES): Add cf-isv.S.
	(cf-hosted-crt0.o, cf-unhosted-crt0.o): New targets.
	* m68k/cf-isv.S: New, broken out of ...
	* m68k/cf-crt0.S: ... here.  Add HOSTED & UNHOSTED differences.
	* m68k/cf-crt1.c (__start1): Add heap_limit argument.
	(__heap_limit): Define.
	* m68k/cf-sbrk.c (__heap_limit): Declare.
	(sbrk): Adjust for __heap_limit.
	* m68k/cf.sc: Use different crt0's for hosted & unhosted.
	Install a separate isv.o file.
	* m68k/io.h (HOSTED_PUTCHAR): Replace with ...
	(HOSTED_INIT_SIM): ... this.
This commit is contained in:
Nathan Sidwell 2006-10-23 19:28:29 +00:00
parent 9e82dd14c5
commit e9375a96b3
8 changed files with 144 additions and 79 deletions

View File

@ -1,3 +1,22 @@
2006-10-23 Nathan Sidwell <nathan@codesourcery.com>
libgloss/
* m68k/Makefile.in (CF_CRT0): Rename to CF_CRT0S, separate hosted
& unhosted versions.
(CF_OBJS): Add cf-isv.o.
(CF_SOURCES): Add cf-isv.S.
(cf-hosted-crt0.o, cf-unhosted-crt0.o): New targets.
* m68k/cf-isv.S: New, broken out of ...
* m68k/cf-crt0.S: ... here. Add HOSTED & UNHOSTED differences.
* m68k/cf-crt1.c (__start1): Add heap_limit argument.
(__heap_limit): Define.
* m68k/cf-sbrk.c (__heap_limit): Declare.
(sbrk): Adjust for __heap_limit.
* m68k/cf.sc: Use different crt0's for hosted & unhosted.
Install a separate isv.o file.
* m68k/io.h (HOSTED_PUTCHAR): Replace with ...
(HOSTED_INIT_SIM): ... this.
2006-10-20 Nathan Sidwell <nathan@codesourcery.com>
libgloss/

View File

@ -136,10 +136,10 @@ HOSTED_OBJS= hosted-gdb.o hosted-exit.o $(patsubst un%,%,$(UNHOSTED_OBJS))
#
# here's all the ColdFire boards
#
CF_CRT0= cf-crt0.o
CF_CRT0S= cf-hosted-crt0.o cf-unhosted-crt0.o
CF_BSP= libcf.a
CF_OBJS= cf-crt1.o cf-hosted.o getpid.o kill.o cf-sbrk.o cf-exit.o \
$(patsubst %,cf-%.o,${CF_ISRS})
CF_OBJS= cf-isv.o cf-crt1.o cf-hosted.o getpid.o kill.o cf-sbrk.o \
cf-exit.o $(patsubst %,cf-%.o,${CF_ISRS})
CF_ISRS= other_interrupt reset access_error address_error \
illegal_instruction divide_by_zero privilege_violation \
trace unimplemented_line_a_opcode unimplemented_line_f_opcode \
@ -156,7 +156,7 @@ CF_RAM_SCRIPTS := $(patsubst %,%-ram.ld,$(CF_BOARDS))
CF_ROM_SCRIPTS := $(patsubst %,%-rom.ld,$(CF_BOARDS))
CF_HOSTED_SCRIPTS := $(patsubst %.ld,%-hosted.ld,$(CF_RAM_SCRIPTS) $(CF_ROM_SCRIPTS))
CF_SCRIPTS = $(CF_RAM_SCRIPTS) $(CF_ROM_SCRIPTS) $(CF_HOSTED_SCRIPTS)
CF_SOURCES = cf-crt0.S cf-crt1.c asm.h
CF_SOURCES = cf-isv.S cf-crt0.S cf-crt1.c asm.h
# Host specific makefile fragment comes in here.
@host_makefile_frag@
@ -167,7 +167,7 @@ CF_SOURCES = cf-crt0.S cf-crt1.c asm.h
#
all: ${SIM_CRT0} ${SIM_BSP} ${CRT0} ${BCC_BSP} ${IDP_BSP} ${IDPGDB_BSP} \
${MVME135_BSP} ${MVME162_BSP} ${HOSTED_BSP} ${UNHOSTED_BSP} \
${CF_CRT0} ${CF_BSP} ${CF_SCRIPTS}
${CF_CRT0S} ${CF_BSP} ${CF_SCRIPTS}
#
# here's where we build the board support packages for each target
@ -202,6 +202,8 @@ $(HOSTED_OBJS): hosted%.o: io%.c io.h
$(HOSTED_BSP): $(HOSTED_OBJS)
${AR} ${ARFLAGS} $@ $^
${RANLIB} $@
cf-hosted-crt0.o: cf-crt0.S
$(CC) $(CFLAGS_FOR_TARGET) -DHOSTED=1 $(INCLUDES) -c $< -o $@
# build unhosted library
$(UNHOSTED_OBJS): unhosted%.o: io%.c io.h
@ -209,6 +211,8 @@ $(UNHOSTED_OBJS): unhosted%.o: io%.c io.h
$(UNHOSTED_BSP): $(UNHOSTED_OBJS)
${AR} ${ARFLAGS} $@ $^
${RANLIB} $@
cf-unhosted-crt0.o: cf-crt0.S
$(CC) $(CFLAGS_FOR_TARGET) -DHOSTED=0 $(INCLUDES) -c $< -o $@
# build coldfire library
$(patsubst %,cf-%.o,${CF_ISRS}) : cf-isrs.c
@ -364,7 +368,9 @@ install:
$(INSTALL_DATA) $(HOSTED_BSP) $(DESTDIR)$(tooldir)/lib${MULTISUBDIR}/$(HOSTED_BSP)
$(INSTALL_DATA) $(UNHOSTED_BSP) $(DESTDIR)$(tooldir)/lib${MULTISUBDIR}/$(UNHOSTED_BSP)
# install CF stuff
$(INSTALL_DATA) $(CF_CRT0) $(DESTDIR)$(tooldir)/lib${MULTISUBDIR}/$(CF_CRT0)
for crt in $(CF_CRT0S) ; \
do $(INSTALL_DATA) $$crt $(DESTDIR)$(tooldir)/lib${MULTISUBDIR}/$$crt ; \
done
$(INSTALL_DATA) $(CF_BSP) $(DESTDIR)$(tooldir)/lib${MULTISUBDIR}/$(CF_BSP)
for script in $(CF_SCRIPTS) ; \
do $(INSTALL_DATA) $$script $(DESTDIR)$(tooldir)/lib${MULTISUBDIR}/$$script ; \

View File

@ -1,4 +1,4 @@
/* The interrupt table.
/* Initial boot
*
* Copyright (c) 2006 CodeSourcery Inc
*
@ -16,70 +16,32 @@
#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 __trap15 /* 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 __heap_end
.weak __heap_end
.extern __start1
.globl __start
__start:
/* Initialize stack */
movel IMM(__stack), sp
movel IMM(0), fp
move.l IMM(__stack), sp
move.l IMM(0), fp
move.l IMM(__heap_end), d1
#if HOSTED
/* INIT_SIM syscall. Allows changing sp & d1. */
move.l IMM(1),d0
.align 4
/* The halt sequence must be 'nop; halt' and aligned to a 4 byte
boundary. */
nop
halt
/* This sentinel instruction value must be immediately after
the halt instruction. The debugger will adjust the pc, so
that it is never executed. This instruction is
'movec %sp,0'. */
.long 0x4e7bf000
#endif
move.l d1,sp@-
move.l fp,sp@- /* Dummy return address */
jmp __start1

View File

@ -22,7 +22,7 @@ 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)));
void *__heap_limit;
extern void software_init_hook (void) __attribute__ ((weak));
extern void hardware_init_hook (void) __attribute__ ((weak));
extern void __INIT_SECTION__ (void);
@ -30,9 +30,8 @@ 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)
/* This is called from a tiny assembly stub. */
void __start1 (void *heap_limit)
{
unsigned ix;
@ -44,6 +43,8 @@ void __start1 (void)
memcpy (__data_start, __data_load, __bss_start - __data_start);
memset (__bss_start, 0, __end - __bss_start);
__heap_limit = heap_limit;
if (software_init_hook)
software_init_hook ();

75
libgloss/m68k/cf-isv.S Normal file
View File

@ -0,0 +1,75 @@
/* 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.
*/
.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 __trap15 /* 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

View File

@ -22,14 +22,15 @@
*/
extern char __end[] __attribute__ ((aligned (4)));
/* Optional explicit end of heap. */
extern char __heap_end[] __attribute__ ((aligned (4), weak));
/* End of heap, if non NULL. */
extern void *__heap_limit;
void *
sbrk (int nbytes)
{
static char *heap = __end;
char *end = __heap_end;
char *end = __heap_limit;
char *base = heap;
char *new_heap = heap + nbytes;

View File

@ -8,7 +8,7 @@
test -z "${ROM:+1}" && NOROM=1
cat <<EOF
STARTUP(cf-crt0.o)
STARTUP(cf-${IO}-crt0.o)
OUTPUT_ARCH(m68k)
ENTRY(__start)
SEARCH_DIR(.)
@ -29,7 +29,8 @@ SECTIONS
.text :
{
CREATE_OBJECT_SYMBOLS
cf-crt0.o(.text)
KEEP (*cf-isv.o(.text))
cf-${IO}-crt0.o(.text)
*(.text .text.*)
*(.gnu.linkonce.t.*)

View File

@ -21,7 +21,7 @@
#include <sys/stat.h>
#define HOSTED_EXIT 0
#define HOSTED_PUTCHAR 1 /* Obsolete */
#define HOSTED_INIT_SIM 1
#define HOSTED_OPEN 2
#define HOSTED_CLOSE 3
#define HOSTED_READ 4