aboutsummaryrefslogtreecommitdiff
path: root/libgloss
diff options
context:
space:
mode:
authorJeff Johnston <jjohnstn@redhat.com>2001-10-31 19:19:08 +0000
committerJeff Johnston <jjohnstn@redhat.com>2001-10-31 19:19:08 +0000
commit75241b15dbe979163b1cc95df6a5c16e30ddde7b (patch)
tree0b3d11e5730816f974785eb6ff133500620cac8f /libgloss
parent747e5773319f36839927dd67005ceab836ede48d (diff)
downloadnewlib-75241b15dbe979163b1cc95df6a5c16e30ddde7b.zip
newlib-75241b15dbe979163b1cc95df6a5c16e30ddde7b.tar.gz
newlib-75241b15dbe979163b1cc95df6a5c16e30ddde7b.tar.bz2
2001-10-31 David Howells <dhowells@redhat.com>
* syscall.h: Added SYS_times, SYS_gettimeofday, SYS_link values. * mn10300/times.c: Renamed "times" to "_times" so that it can be referenced by newlib. * mn10300/cygmon.c: New file. * mn10300/crt0_redboot.S: Ditto. * mn10300/crt0_cygmon.S: Ditto. * mn10300/Makefile.in: Added RedBoot and Cygmon support. * mn10300/configure.in: Changed to allow for future evaluation boards to be added. * mn10300/configure: Regenerated.
Diffstat (limited to 'libgloss')
-rw-r--r--libgloss/ChangeLog13
-rw-r--r--libgloss/mn10300/Makefile.in27
-rwxr-xr-xlibgloss/mn10300/configure88
-rw-r--r--libgloss/mn10300/configure.in6
-rw-r--r--libgloss/mn10300/crt0_cygmon.S95
-rw-r--r--libgloss/mn10300/crt0_redboot.S97
-rw-r--r--libgloss/mn10300/cygmon.c73
-rw-r--r--libgloss/mn10300/times.c2
-rw-r--r--libgloss/syscall.h14
9 files changed, 368 insertions, 47 deletions
diff --git a/libgloss/ChangeLog b/libgloss/ChangeLog
index c6e2f9c..e5db228 100644
--- a/libgloss/ChangeLog
+++ b/libgloss/ChangeLog
@@ -1,3 +1,16 @@
+2001-10-31 David Howells <dhowells@redhat.com>
+
+ * syscall.h: Added SYS_times, SYS_gettimeofday, SYS_link values.
+ * mn10300/times.c: Renamed "times" to "_times" so that it can be
+ referenced by newlib.
+ * mn10300/cygmon.c: New file.
+ * mn10300/crt0_redboot.S: Ditto.
+ * mn10300/crt0_cygmon.S: Ditto.
+ * mn10300/Makefile.in: Added RedBoot and Cygmon support.
+ * mn10300/configure.in: Changed to allow for future
+ evaluation boards to be added.
+ * mn10300/configure: Regenerated.
+
2001-10-17 Michael Meissner <meissner@redhat.com>
* regs.S (K0BASE_ADDR,K1BASE_ADDR): Define as addresses to
diff --git a/libgloss/mn10300/Makefile.in b/libgloss/mn10300/Makefile.in
index 9ed0055..11cd3db 100644
--- a/libgloss/mn10300/Makefile.in
+++ b/libgloss/mn10300/Makefile.in
@@ -1,4 +1,4 @@
-# Copyright (c) 1998 Cygnus Support
+# Copyright (c) 1998, 2000 Cygnus Support
#
# The authors hereby grant permission to use, copy, modify, distribute,
# and license this software and its documentation for any purpose, provided
@@ -63,24 +63,26 @@ OBJCOPY = `if [ -f ${objroot}/../binutils/objcopy ] ; \
then echo ${objroot}/../binutils/objcopy ; \
else t='$(program_transform_name)'; echo objcopy | sed -e $$t ; fi`
-CRT0 = crt0.o
+CRT0 = crt0.o crt0_cygmon.o crt0_redboot.o
# Generic object files common to all targets.
-GENOBJS = _exit.o access.o chmod.o close.o crt1.o \
+GENOBJS_NO_TRAP = _exit.o access.o chmod.o close.o crt1.o \
fstat.o getpid.o isatty.o \
kill.o lseek.o open.o read.o \
- sbrk.o stat.o time.o trap.o unlink.o utime.o write.o
+ sbrk.o stat.o time.o times.o unlink.o utime.o write.o
+GENOBJS = ${GENOBJS_NO_TRAP} trap.o
# Object files specific to particular targets.
EVALOBJS = ${GENOBJS}
+CYGMONOBJS = cygmon.o ${GENOBJS_NO_TRAP}
CFLAGS = -g
GCC_LDFLAGS = `if [ -d ${objroot}/../gcc ] ; \
then echo -L${objroot}/../gcc ; fi`
-SCRIPTS = eval sim
-BSP = libeval.a
+SCRIPTS = @script_list@
+BSP = @bsp_list@
# Host specific makefile fragment comes in here.
@host_makefile_frag@
@@ -100,13 +102,17 @@ libeval.a: $(EVALOBJS)
${AR} ${ARFLAGS} $@ $(EVALOBJS)
${RANLIB} $@
+libcygmon.a: $(CYGMONOBJS)
+ ${AR} ${ARFLAGS} $@ $(CYGMONOBJS)
+ ${RANLIB} $@
+
# compile a fully linked binary. The -Wl,-T*.ld is for the linker
# script. By using -Wl, the linker script is put on the proper place
# in the comand line for ld, and all the symbols will get fully
# resolved.
-test: $(CRT0) test.o
+test: ${CRT0} test.o
${CC} $(CFLAGS_FOR_TARGET) -L${srcdir} -L${objdir} \
test.o -o $@ $(NEWLIB_LDFLAGS) -Wl,-Teval.ld
@echo Done...
@@ -121,7 +127,9 @@ distclean maintainer-clean realclean: clean
.PHONY: install info install-info clean-info
install:
- $(INSTALL_PROGRAM) $(CRT0) $(tooldir)/lib${MULTISUBDIR}/$(CRT0)
+ @for crt in ${CRT0}; do\
+ $(INSTALL_PROGRAM) $${crt} $(tooldir)/lib${MULTISUBDIR}/$${crt}; \
+ done
@for bsp in ${BSP}; do\
$(INSTALL_PROGRAM) $${bsp} $(tooldir)/lib${MULTISUBDIR}; \
done
@@ -136,7 +144,8 @@ clean-info:
test.o: ${srcdir}/test.c
# these are for the BSPs
-${CRT0}: ${srcdir}/crt0.S
+crt0.o: ${srcdir}/crt0.S
+crt0_cygmon.o: ${srcdir}/crt0_cygmon.S
# target specific makefile fragment comes in here.
@target_makefile_frag@
diff --git a/libgloss/mn10300/configure b/libgloss/mn10300/configure
index 95680d2..6371dbf 100755
--- a/libgloss/mn10300/configure
+++ b/libgloss/mn10300/configure
@@ -1,7 +1,7 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated automatically using autoconf version 2.12.1
+# Generated automatically using autoconf version 2.13
# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
#
# This configure script is free software; the Free Software Foundation
@@ -28,6 +28,7 @@ program_suffix=NONE
program_transform_name=s,x,x,
silent=
site=
+sitefile=
srcdir=
target=NONE
verbose=
@@ -142,6 +143,7 @@ Configuration:
--help print this message
--no-create do not create output files
--quiet, --silent do not print \`checking...' messages
+ --site-file=FILE use FILE as the site file
--version print the version of autoconf that created configure
Directory and file names:
--prefix=PREFIX install architecture-independent files in PREFIX
@@ -312,6 +314,11 @@ EOF
-site=* | --site=* | --sit=*)
site="$ac_optarg" ;;
+ -site-file | --site-file | --site-fil | --site-fi | --site-f)
+ ac_prev=sitefile ;;
+ -site-file=* | --site-file=* | --site-fil=* | --site-fi=* | --site-f=*)
+ sitefile="$ac_optarg" ;;
+
-srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
ac_prev=srcdir ;;
-srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
@@ -333,7 +340,7 @@ EOF
verbose=yes ;;
-version | --version | --versio | --versi | --vers)
- echo "configure generated by autoconf version 2.12.1"
+ echo "configure generated by autoconf version 2.13"
exit 0 ;;
-with-* | --with-*)
@@ -477,12 +484,16 @@ fi
srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'`
# Prefer explicitly selected file to automatically selected ones.
-if test -z "$CONFIG_SITE"; then
- if test "x$prefix" != xNONE; then
- CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
- else
- CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
+if test -z "$sitefile"; then
+ if test -z "$CONFIG_SITE"; then
+ if test "x$prefix" != xNONE; then
+ CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
+ else
+ CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
+ fi
fi
+else
+ CONFIG_SITE="$sitefile"
fi
for ac_site_file in $CONFIG_SITE; do
if test -r "$ac_site_file"; then
@@ -503,9 +514,11 @@ ac_ext=c
# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
ac_cpp='$CPP $CPPFLAGS'
ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
-ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
cross_compiling=$ac_cv_prog_cc_cross
+ac_exeext=
+ac_objext=o
if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
# Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
@@ -581,7 +594,7 @@ else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
fi
echo $ac_n "checking host system type""... $ac_c" 1>&6
-echo "configure:585: checking host system type" >&5
+echo "configure:598: checking host system type" >&5
host_alias=$host
case "$host_alias" in
@@ -602,7 +615,7 @@ host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
echo "$ac_t""$host" 1>&6
echo $ac_n "checking target system type""... $ac_c" 1>&6
-echo "configure:606: checking target system type" >&5
+echo "configure:619: checking target system type" >&5
target_alias=$target
case "$target_alias" in
@@ -620,7 +633,7 @@ target_os=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
echo "$ac_t""$target" 1>&6
echo $ac_n "checking build system type""... $ac_c" 1>&6
-echo "configure:624: checking build system type" >&5
+echo "configure:637: checking build system type" >&5
build_alias=$build
case "$build_alias" in
@@ -669,28 +682,30 @@ test "$program_transform_name" = "" && program_transform_name="s,x,x,"
# SunOS /usr/etc/install
# IRIX /sbin/install
# AIX /bin/install
+# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
# AFS /usr/afsws/bin/install, which mishandles nonexistent args
# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
# ./install, which can be erroneously created by make from ./install.sh.
echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
-echo "configure:677: checking for a BSD compatible install" >&5
+echo "configure:691: checking for a BSD compatible install" >&5
if test -z "$INSTALL"; then
if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
- IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS="${IFS}:"
+ IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":"
for ac_dir in $PATH; do
# Account for people who put trailing slashes in PATH elements.
case "$ac_dir/" in
/|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;;
*)
# OSF1 and SCO ODT 3.0 have their own names for install.
- for ac_prog in ginstall installbsd scoinst install; do
+ # Don't use installbsd from OSF since it installs stuff as root
+ # by default.
+ for ac_prog in ginstall scoinst install; do
if test -f $ac_dir/$ac_prog; then
if test $ac_prog = install &&
grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
# AIX install. It has an incompatible calling convention.
- # OSF/1 installbsd also uses dspmsg, but is usable.
:
else
ac_cv_path_install="$ac_dir/$ac_prog -c"
@@ -720,6 +735,8 @@ echo "$ac_t""$INSTALL" 1>&6
# It thinks the first close brace ends the variable substitution.
test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
+test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
+
test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
@@ -734,15 +751,16 @@ test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
# Extract the first word of "gcc", so it can be a program name with args.
set dummy gcc; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:738: checking for $ac_word" >&5
+echo "configure:755: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
if test -n "$CC"; then
ac_cv_prog_CC="$CC" # Let the user override the test.
else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
- for ac_dir in $PATH; do
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
test -z "$ac_dir" && ac_dir=.
if test -f $ac_dir/$ac_word; then
ac_cv_prog_CC="gcc"
@@ -763,16 +781,17 @@ if test -z "$CC"; then
# Extract the first word of "cc", so it can be a program name with args.
set dummy cc; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:767: checking for $ac_word" >&5
+echo "configure:785: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
if test -n "$CC"; then
ac_cv_prog_CC="$CC" # Let the user override the test.
else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
ac_prog_rejected=no
- for ac_dir in $PATH; do
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
test -z "$ac_dir" && ac_dir=.
if test -f $ac_dir/$ac_word; then
if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then
@@ -811,7 +830,7 @@ fi
fi
echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
-echo "configure:815: checking whether we are using GNU C" >&5
+echo "configure:834: checking whether we are using GNU C" >&5
if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -820,7 +839,7 @@ else
yes;
#endif
EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:824: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:843: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
ac_cv_prog_gcc=yes
else
ac_cv_prog_gcc=no
@@ -835,7 +854,7 @@ if test $ac_cv_prog_gcc = yes; then
ac_save_CFLAGS="$CFLAGS"
CFLAGS=
echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:839: checking whether ${CC-cc} accepts -g" >&5
+echo "configure:858: checking whether ${CC-cc} accepts -g" >&5
if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -871,15 +890,16 @@ LD=${LD-ld}
# Extract the first word of "ranlib", so it can be a program name with args.
set dummy ranlib; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:875: checking for $ac_word" >&5
+echo "configure:894: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
if test -n "$RANLIB"; then
ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
- for ac_dir in $PATH; do
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
test -z "$ac_dir" && ac_dir=.
if test -f $ac_dir/$ac_word; then
ac_cv_prog_RANLIB="ranlib"
@@ -901,6 +921,8 @@ fi
case "${target}" in
*)
part_specific_obj=vr4300.o
+ script_list="eval sim"
+ bsp_list="libeval.a"
;;
esac
@@ -915,6 +937,8 @@ target_makefile_frag_path=$target_makefile_frag
+
+
trap '' 1 2 15
cat > confcache <<\EOF
# This file is a shell script that caches the results of configure
@@ -938,7 +962,7 @@ EOF
# Ultrix sh set writes to stderr and can't be redirected directly,
# and sets the high bit in the cache file unless we assign to the vars.
(set) 2>&1 |
- case `(ac_space=' '; set) 2>&1 | grep ac_space` in
+ case `(ac_space=' '; set | grep ac_space) 2>&1` in
*ac_space=\ *)
# `set' does not quote correctly, so add quotes (double-quote substitution
# turns \\\\ into \\, and sed turns \\ into \).
@@ -1017,7 +1041,7 @@ do
echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion"
exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;;
-version | --version | --versio | --versi | --vers | --ver | --ve | --v)
- echo "$CONFIG_STATUS generated by autoconf version 2.12.1"
+ echo "$CONFIG_STATUS generated by autoconf version 2.13"
exit 0 ;;
-help | --help | --hel | --he | --h)
echo "\$ac_cs_usage"; exit 0 ;;
@@ -1041,6 +1065,7 @@ s%@SHELL@%$SHELL%g
s%@CFLAGS@%$CFLAGS%g
s%@CPPFLAGS@%$CPPFLAGS%g
s%@CXXFLAGS@%$CXXFLAGS%g
+s%@FFLAGS@%$FFLAGS%g
s%@DEFS@%$DEFS%g
s%@LDFLAGS@%$LDFLAGS%g
s%@LIBS@%$LIBS%g
@@ -1075,6 +1100,7 @@ s%@build_cpu@%$build_cpu%g
s%@build_vendor@%$build_vendor%g
s%@build_os@%$build_os%g
s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
+s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g
s%@INSTALL_DATA@%$INSTALL_DATA%g
s%@CC@%$CC%g
s%@AS@%$AS%g
@@ -1088,6 +1114,8 @@ s%@target_makefile_frag_path@%$target_makefile_frag_path%g
/@target_makefile_frag@/r $target_makefile_frag
s%@target_makefile_frag@%%g
s%@part_specific_obj@%$part_specific_obj%g
+s%@script_list@%$script_list%g
+s%@bsp_list@%$bsp_list%g
CEOF
EOF
@@ -1096,7 +1124,7 @@ cat >> $CONFIG_STATUS <<\EOF
# Split the substitutions into bite-sized pieces for seds with
# small command number limits, like on Digital OSF/1 and HP-UX.
-ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script.
+ac_max_sed_cmds=60 # Maximum number of lines to put in a sed script.
ac_file=1 # Number of current file.
ac_beg=1 # First line for current file.
ac_end=$ac_max_sed_cmds # Line after last line for current file.
diff --git a/libgloss/mn10300/configure.in b/libgloss/mn10300/configure.in
index 2c7814b..fd566f8 100644
--- a/libgloss/mn10300/configure.in
+++ b/libgloss/mn10300/configure.in
@@ -1,4 +1,4 @@
-# Copyright (c) 1995, 1996 Cygnus Support
+# Copyright (c) 1995, 1996, 2000 Cygnus Support
#
# The authors hereby grant permission to use, copy, modify, distribute,
# and license this software and its documentation for any purpose, provided
@@ -85,6 +85,8 @@ AC_PROG_RANLIB
case "${target}" in
*)
part_specific_obj=vr4300.o
+ script_list="eval sim"
+ bsp_list="libeval.a"
;;
esac
@@ -102,6 +104,8 @@ target_makefile_frag_path=$target_makefile_frag
AC_SUBST(target_makefile_frag_path)
AC_SUBST_FILE(target_makefile_frag)
AC_SUBST(part_specific_obj)
+AC_SUBST(script_list)
+AC_SUBST(bsp_list)
AC_OUTPUT(Makefile,
. ${libgloss_topdir}/config-ml.in,
diff --git a/libgloss/mn10300/crt0_cygmon.S b/libgloss/mn10300/crt0_cygmon.S
new file mode 100644
index 0000000..3b2fffa
--- /dev/null
+++ b/libgloss/mn10300/crt0_cygmon.S
@@ -0,0 +1,95 @@
+/*
+ * crt0_cygmon.S -- Minimal startup file for MN10300 targets running Cygmon.
+ *
+ * Copyright (c) 1995, 1996, 1997, 2000 Red Hat, 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 the minimal startup code necessary.
+ * This will not do any hardware initialization. It is assumed that we are talking to Cygmon
+ * and therefore the hardware will be initialized properly.
+ */
+
+/*
+ * Set up some room for a stack. We just grab a chunk of memory.
+ */
+#define STACK_SIZE 0x4000
+#define GLOBAL_SIZE 0x2000
+
+#define STARTUP_STACK_SIZE 0x0100
+
+ .comm __memsize, 12
+ .comm __lstack, STARTUP_STACK_SIZE
+ .comm __stackbase,4
+
+ .section .text
+ .global _start
+_start:
+ /*
+ * Setup a small stack so we can run some C code,
+ * and get the usable memory size.
+ */
+ mov __lstack,a0
+ add STARTUP_STACK_SIZE-4,a0
+ mov a0,sp
+
+ /*
+ * zero out the bss section.
+ */
+ .global __memsize
+ .global _get_mem_info
+zerobss:
+ mov __bss_start, a0 # These variables are defined in the linker script
+ mov _end, a1
+
+ cmp a0, a1 # If no bss, then do nothing
+ beq 7f
+
+ clr d0
+3:
+ movbu d0,(a0) # Clear a byte and bump pointer
+ inc a0
+ cmp a0, a1
+ bne 3b
+
+7:
+ /*
+ * Setup the stack pointer --
+ * get_mem_info returns the top of memory, so just use that In
+ * addition, we must subtract 24 bytes for the 3 8 byte
+ * arguments to main, in case main wants to write them back to
+ * the stack. The caller is supposed to allocate stack space
+ * for parameters in registers in the old MIPS ABIs. We must
+ * do this even though we aren't passing arguments, because
+ * main might be declared to have them.
+ * Some ports need a larger alignment for the stack, so we
+ * subtract 32, which satisifes the stack for the arguments and
+ * keeps the stack pointer better aligned.
+ */
+ mov __memsize, d0
+ call _get_mem_info,[],0
+
+ sub 32, a0
+ mov a0, sp
+
+ mov __stackbase, a1
+ mov a0, (a1) # keep this for future ref
+
+ call ___main,[],0 # Call __main to run ctors/dtors
+ clr d0
+ clr d1
+ mov d0, (4,sp)
+ call _main,[],0 # Call main program
+ call _exit,[],0
+
+/* EOF crt0_cygmon.S */
diff --git a/libgloss/mn10300/crt0_redboot.S b/libgloss/mn10300/crt0_redboot.S
new file mode 100644
index 0000000..c3667c5
--- /dev/null
+++ b/libgloss/mn10300/crt0_redboot.S
@@ -0,0 +1,97 @@
+/*
+ * crt0_redboot.S -- Minimal startup file for MN10300 targets running Redboot.
+ *
+ * Copyright (c) 2001 Red Hat, Inc.
+ * Derived from crt0_cygmon.S - Copyright (c) 1995, 1996, 1997, 2000 Red Hat, 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 the minimal startup code necessary.
+ * This will not do any hardware initialization. It is assumed that we are talking to Redboot
+ * and therefore the hardware will be initialized properly.
+ */
+
+/*
+ * Set up some room for a stack. We just grab a chunk of memory.
+ */
+#define STACK_SIZE 0x4000
+#define GLOBAL_SIZE 0x2000
+
+#define STARTUP_STACK_SIZE 0x0100
+
+ .comm __memsize, 12
+ .comm __lstack, STARTUP_STACK_SIZE
+ .comm __stackbase,4
+
+ .section .text
+ .global _start
+_start:
+ /*
+ * Setup a small stack so we can run some C code,
+ * and get the usable memory size.
+ */
+ mov __lstack,a0
+ add STARTUP_STACK_SIZE-4,a0
+ mov a0,sp
+
+ /*
+ * zero out the bss section.
+ */
+ .global __memsize
+ .global _get_mem_info
+zerobss:
+ mov __bss_start, a0 # These variables are defined in the linker script
+ mov _end, a1
+
+ cmp a0, a1 # If no bss, then do nothing
+ beq 7f
+
+ clr d0
+3:
+ movbu d0,(a0) # Clear a byte and bump pointer
+ inc a0
+ cmp a0, a1
+ bne 3b
+
+7:
+ /*
+ * Setup the stack pointer --
+ * get_mem_info returns the top of memory, so just use that In
+ * addition, we must subtract 24 bytes for the 3 8 byte
+ * arguments to main, in case main wants to write them back to
+ * the stack. The caller is supposed to allocate stack space
+ * for parameters in registers in the old MIPS ABIs. We must
+ * do this even though we aren't passing arguments, because
+ * main might be declared to have them.
+ * Some ports need a larger alignment for the stack, so we
+ * subtract 32, which satisifes the stack for the arguments and
+ * keeps the stack pointer better aligned.
+ */
+ mov __memsize, d0
+ call _get_mem_info,[],0
+
+ sub 32, a0
+ mov a0, sp
+
+ mov __stackbase, a1
+ mov a0, (a1) # keep this for future ref
+
+ call ___main,[],0 # Call __main to run ctors/dtors
+ clr d0
+ clr d1
+ mov d0, (4,sp)
+ or 0x0800,psw # Enable interrupts
+ call _main,[],0 # Call main program
+ call _exit,[],0
+
+/* EOF crt0_redboot.S */
diff --git a/libgloss/mn10300/cygmon.c b/libgloss/mn10300/cygmon.c
new file mode 100644
index 0000000..513115c
--- /dev/null
+++ b/libgloss/mn10300/cygmon.c
@@ -0,0 +1,73 @@
+/* cygmon.c -- Glue code for linking apps to run on top of Cygmon.
+ *
+ * Copyright (c) 1998, 1999, 2000, 2001 Red Hat, 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 <errno.h>
+
+// These need to be kept in sync with the definitions in Cygmon.
+#define SYS_meminfo 1001
+#include "syscall.h"
+
+/* Structure filled in by get_mem_info. Only the size field is
+ actually used (by sbrk), so the others aren't even filled in. */
+struct s_mem
+{
+ unsigned int size;
+ unsigned int icsize;
+ unsigned int dcsize;
+};
+
+// Perform a system call.
+// Unused parameters should be set to 0.
+int __trap0(unsigned long func, unsigned long p1, unsigned long p2, unsigned long p3)
+{
+ int ret = 0;
+#ifdef __AM33__
+ {
+ register unsigned long d0 asm ("d0") = func;
+ register unsigned long d1 asm ("d1") = p1;
+ register unsigned long d2 asm ("d2") = p2;
+ register unsigned long d3 asm ("d3") = p3;
+ asm volatile (" syscall 0\n"
+ " nop"
+ : "+d" (d0) : "d" (d1), "d" (d2), "d" (d3) : "memory");
+ ret = d0;
+ }
+#endif
+
+ if (func == SYS_exit)
+ {
+ while (1)
+ {
+ asm volatile (" .byte 0xff "); // trigger a breakpoint to drop back into Cygmon
+ }
+ }
+
+ if (ret != 0)
+ errno = ret;
+
+ return ret;
+}
+
+void *
+get_mem_info (mem)
+ struct s_mem *mem;
+{
+ unsigned long totmem = 0, topmem = 0;
+ register int numbanks;
+
+ numbanks = __trap0(SYS_meminfo, (unsigned long)&totmem, (unsigned long)&topmem, 0);
+ mem->size = totmem;
+ return (void*)topmem;
+}
diff --git a/libgloss/mn10300/times.c b/libgloss/mn10300/times.c
index b804be4..8cdc55b 100644
--- a/libgloss/mn10300/times.c
+++ b/libgloss/mn10300/times.c
@@ -6,7 +6,7 @@
clock_t
-times (struct tms *buffer)
+_times (struct tms *buffer)
{
return TRAP0 (SYS_times, buffer, 0, 0);
}
diff --git a/libgloss/syscall.h b/libgloss/syscall.h
index da78562..665cfe8 100644
--- a/libgloss/syscall.h
+++ b/libgloss/syscall.h
@@ -38,10 +38,12 @@
#define SYS_argv 13
/* These are extras added for one reason or another. */
-#define SYS_chdir 14
-#define SYS_stat 15
-#define SYS_chmod 16
-#define SYS_utime 17
-#define SYS_time 18
-
+#define SYS_chdir 14
+#define SYS_stat 15
+#define SYS_chmod 16
+#define SYS_utime 17
+#define SYS_time 18
+#define SYS_gettimeofday 19
+#define SYS_times 20
+#define SYS_link 21
#endif