In newlib/:

2001-12-22  Geoffrey Keating  <geoffk@redhat.com>
	    Catherine Moore  <clm@redhat.com>
	    Richard Henderson  <rth@redhat.com>
	    Corinna Vinschen  <vinschen@redhat.com>

	* configure.host: Add support for xstormy16.
	* libc/include/machine/ieeefp.h: Add support for xstormy16.
	* libc/include/machine/setjmp.h: Add support for xstormy16.
	* libc/include/sys/config.h: Add support for xstormy16.
	* libc/machine/xstormy16/Makefile.am: New file.
	* libc/machine/xstormy16/Makefile.in: New file.
	* libc/machine/xstormy16/aclocal.m4: New file.
	* libc/machine/xstormy16/configure: New file.
	* libc/machine/xstormy16/configure.in: New file.
	* libc/machine/xstormy16/setjmp.S: New file.

In libgloss/:
2001-12-22  Geoffrey Keating  <geoffk@redhat.com>
	    Mark Salter  <msalter@redhat.com>
	    Catherine Moore  <clm@redhat.com>
	    Richard Henderson  <rth@redhat.com>

	* configure.in: Add xstormy16.
	* libnosys/configure.in: Add xstormy16.
	* configure: Regenerated.
	* libnosys/configure: Regenerated.
	* xstormy16/Makefile.in: New file.
	* xstormy16/close.c: New file.
	* xstormy16/configure: New file.
	* xstormy16/configure.in: New file.
	* xstormy16/crt0.s: New file.
	* xstormy16/crt0_stub.s: New file.
	* xstormy16/crti.s: New file.
	* xstormy16/crtn.s: New file.
	* xstormy16/eva_app.c: New file.
	* xstormy16/eva_app.ld: New file.
	* xstormy16/eva_stub.ld: New file.
	* xstormy16/fstat.c: New file.
	* xstormy16/getpid.c: New file.
	* xstormy16/kill.c: New file.
	* xstormy16/lseek.c: New file.
	* xstormy16/open.c: New file.
	* xstormy16/sbrk.c: New file.
	* xstormy16/sim_high.ld: New file.
	* xstormy16/stat.c: New file.
	* xstormy16/syscalls.S: New file.
	* xstormy16/syscalls.m4: New file.
	* xstormy16/unlink.c: New file.
	* xstormy16/xstormy16_stub.c: New file.
This commit is contained in:
Geoffrey Keating 2001-12-22 22:47:58 +00:00
parent a3e320f3c9
commit f6eff1c046
39 changed files with 6022 additions and 28 deletions

View File

@ -1,3 +1,36 @@
2001-12-22 Geoffrey Keating <geoffk@redhat.com>
Mark Salter <msalter@redhat.com>
Catherine Moore <clm@redhat.com>
Richard Henderson <rth@redhat.com>
* configure.in: Add xstormy16.
* libnosys/configure.in: Add xstormy16.
* configure: Regenerated.
* libnosys/configure: Regenerated.
* xstormy16/Makefile.in: New file.
* xstormy16/close.c: New file.
* xstormy16/configure: New file.
* xstormy16/configure.in: New file.
* xstormy16/crt0.s: New file.
* xstormy16/crt0_stub.s: New file.
* xstormy16/crti.s: New file.
* xstormy16/crtn.s: New file.
* xstormy16/eva_app.c: New file.
* xstormy16/eva_app.ld: New file.
* xstormy16/eva_stub.ld: New file.
* xstormy16/fstat.c: New file.
* xstormy16/getpid.c: New file.
* xstormy16/kill.c: New file.
* xstormy16/lseek.c: New file.
* xstormy16/open.c: New file.
* xstormy16/sbrk.c: New file.
* xstormy16/sim_high.ld: New file.
* xstormy16/stat.c: New file.
* xstormy16/syscalls.S: New file.
* xstormy16/syscalls.m4: New file.
* xstormy16/unlink.c: New file.
* xstormy16/xstormy16_stub.c: New file.
2001-10-31 Jeff Johnston <jjohnstn@redhat.com>
* m32r/Makefile.in: Use gdb stub set by configure.

17
libgloss/configure vendored
View File

@ -788,6 +788,9 @@ case "${target}" in
mcore-*-*)
configdirs="${configdirs} mcore testsuite"
;;
xstormy16-*-*)
configdirs="${configdirs} xstormy16 testsuite"
;;
esac
# temporarily strip out testsuite
@ -807,7 +810,7 @@ subdirs="$configdirs"
# 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:826: checking for $ac_word" >&5
echo "configure:814: 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
@ -837,7 +840,7 @@ 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:856: checking for $ac_word" >&5
echo "configure:844: 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
@ -886,7 +889,7 @@ fi
fi
echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
echo "configure:905: checking whether we are using GNU C" >&5
echo "configure:893: 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
@ -895,7 +898,7 @@ else
yes;
#endif
EOF
if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:914: \"$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:902: \"$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
@ -910,7 +913,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:929: checking whether ${CC-cc} accepts -g" >&5
echo "configure:917: 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
@ -942,7 +945,7 @@ AS=${AS-as}
# Extract the first word of "ar", so it can be a program name with args.
set dummy ar; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:961: checking for $ac_word" >&5
echo "configure:949: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -976,7 +979,7 @@ 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:995: checking for $ac_word" >&5
echo "configure:983: 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

View File

@ -88,6 +88,9 @@ case "${target}" in
mcore-*-*)
configdirs="${configdirs} mcore testsuite"
;;
xstormy16-*-*)
configdirs="${configdirs} xstormy16 testsuite"
;;
esac
# temporarily strip out testsuite

View File

@ -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=*)
@ -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
@ -584,7 +595,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:588: checking host system type" >&5
echo "configure:599: checking host system type" >&5
host_alias=$host
case "$host_alias" in
@ -605,7 +616,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:609: checking target system type" >&5
echo "configure:620: checking target system type" >&5
target_alias=$target
case "$target_alias" in
@ -623,7 +634,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:627: checking build system type" >&5
echo "configure:638: checking build system type" >&5
build_alias=$build
case "$build_alias" in
@ -677,7 +688,7 @@ test "$program_transform_name" = "" && program_transform_name="s,x,x,"
# 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:681: checking for a BSD compatible install" >&5
echo "configure:692: 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
@ -787,6 +798,8 @@ case "${target}" in
;;
w65-*-*)
;;
xstormy16-*-*)
;;
z8k-*-*)
;;
*)
@ -805,7 +818,7 @@ EOF
echo $ac_n "checking for .previous assembler directive""... $ac_c" 1>&6
echo "configure:813: checking for .previous assembler directive" >&5
echo "configure:822: checking for .previous assembler directive" >&5
if eval "test \"`echo '$''{'libc_cv_asm_previous_directive'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -813,7 +826,7 @@ else
.section foo_section
.previous
EOF
if { ac_try='${CC-cc} -c $CFLAGS conftest.s 1>&5'; { (eval echo configure:821: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
if { ac_try='${CC-cc} -c $CFLAGS conftest.s 1>&5'; { (eval echo configure:830: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
cat >> confdefs.h <<\EOF
#define HAVE_ASM_PREVIOUS_DIRECTIVE 1
EOF
@ -824,7 +837,7 @@ fi
echo "$ac_t""$libc_cv_asm_previous_directive" 1>&6
echo $ac_n "checking for .popsection assembler directive""... $ac_c" 1>&6
echo "configure:832: checking for .popsection assembler directive" >&5
echo "configure:841: checking for .popsection assembler directive" >&5
if eval "test \"`echo '$''{'libc_cv_asm_popsection_directive'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -832,7 +845,7 @@ else
.pushsection foo_section
.popsection
EOF
if { ac_try='${CC-cc} -c $CFLAGS conftest.s 1>&5'; { (eval echo configure:840: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
if { ac_try='${CC-cc} -c $CFLAGS conftest.s 1>&5'; { (eval echo configure:849: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
cat >> confdefs.h <<\EOF
#define HAVE_ASM_POPSECTION_DIRECTIVE 1
EOF
@ -847,14 +860,14 @@ echo "$ac_t""$libc_cv_asm_popsection_directive" 1>&6
esac
echo $ac_n "checking for function prefix""... $ac_c" 1>&6
echo "configure:855: checking for function prefix" >&5
echo "configure:864: checking for function prefix" >&5
if eval "test \"`echo '$''{'libc_dollar_prefix'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.c <<\EOF
foo () { }
EOF
if { ac_try='${CC-cc} -S conftest.c -o - | fgrep "\$foo" > /dev/null'; { (eval echo configure:862: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; };
if { ac_try='${CC-cc} -S conftest.c -o - | fgrep "\$foo" > /dev/null'; { (eval echo configure:871: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; };
then
libc_dollar_prefix=yes
else
@ -879,7 +892,7 @@ fi
# 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:887: checking for $ac_word" >&5
echo "configure:896: 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
@ -909,7 +922,7 @@ 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:917: checking for $ac_word" >&5
echo "configure:926: 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
@ -958,7 +971,7 @@ fi
fi
echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
echo "configure:966: checking whether we are using GNU C" >&5
echo "configure:975: 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
@ -967,7 +980,7 @@ else
yes;
#endif
EOF
if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:975: \"$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:984: \"$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
@ -982,7 +995,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:990: checking whether ${CC-cc} accepts -g" >&5
echo "configure:999: 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
@ -1018,7 +1031,7 @@ 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:1026: checking for $ac_word" >&5
echo "configure:1035: 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

View File

@ -121,6 +121,8 @@ case "${target}" in
;;
w65-*-*)
;;
xstormy16-*-*)
;;
z8k-*-*)
;;
*)

View File

@ -0,0 +1,130 @@
#
#
VPATH = @srcdir@ @srcdir@/..
srcdir = @srcdir@
objdir = .
srcroot = $(srcdir)/../..
objroot = $(objdir)/../..
prefix = @prefix@
exec_prefix = @exec_prefix@
host_alias = @host_alias@
target_alias = @target_alias@
bindir = @bindir@
libdir = @libdir@
tooldir = $(exec_prefix)/$(target_alias)
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
# Multilib support variables.
# TOP is used instead of MULTI{BUILD,SRC}TOP.
MULTIDIRS =
MULTISUBDIR =
SHELL = /bin/sh
CC = @CC@
AS = @AS@
AR = @AR@
LD = @LD@
RANLIB = @RANLIB@
# Yuk.
OBJCOPY = $(subst ranlib,objcopy,$(RANLIB))
OBJS = isatty.o
CFLAGS = -g -O2
ASFLAGS = --gdwarf2
SCRIPTS =
CRT = crt0.o crti.o crtn.o
# Here is all of the simulator stuff
SIM_SCRIPTS = sim_high.ld
SIM_LDFLAGS =
SIM_BSP = libsim.a
SIM_OBJS = syscalls.o sbrk.o
# Here is stuff for building apps for GDB on the EVA board
EVA_APP_BSP = libeva_app.a
EVA_APP_OBJS = close.o fstat.o getpid.o kill.o lseek.o open.o \
stat.o unlink.o eva_app.o
EVA_APP_SCRIPTS = eva_app.ld
# Stub stuff
EVA_STUB_HEX = eva_stub.hex
EVA_STUB = eva_stub
EVA_STUB_OBJS = xstormy16_stub.o crt0_stub.o
# Host specific makefile fragment comes in here.
@host_makefile_frag@
#
# 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: ${MON_CRT0} ${MON_BSP}
all: ${CRT} ${SIM_BSP} ${EVA_APP_BSP} ${EVA_STUB_HEX}
#
# here's where we build the board support packages for each target
#
${SIM_BSP}: ${OBJS} ${SIM_OBJS}
${AR} ${ARFLAGS} ${SIM_BSP} ${SIM_OBJS} ${OBJS}
${RANLIB} ${SIM_BSP}
${EVA_APP_BSP}: ${OBJS} ${EVA_APP_OBJS}
${AR} ${ARFLAGS} ${EVA_APP_BSP} ${EVA_APP_OBJS} ${OBJS}
${RANLIB} ${EVA_APP_BSP}
${EVA_STUB_HEX}: ${EVA_STUB}
${OBJCOPY} -O ihex $< $@
${EVA_STUB}: ${EVA_STUB_OBJS} ${srcdir}/eva_stub.ld
${CC} -g -Os -nostartfiles -T${srcdir}/eva_stub.ld ${EVA_STUB_OBJS} -o $@
#
# here's where we build the test programs for each target
#
.PHONY: test
test:
true
#
#
#
.c.S:
${CC} ${CFLAGS_FOR_TARGET} -c $<
clean mostlyclean:
rm -f a.out core *.i *.o *-test *.srec *.dis *.x *.hex $(SIM_BSP) $(EVA_APP_BSP) $(EVA_STUB}
distclean maintainer-clean realclean: clean
rm -f Makefile config.status *~
.PHONY: install info install-info clean-info
install:
set -e; for x in ${SIM_BSP} ${CRT} ${EVA_APP_BSP} ${EVA_STUB_HEX}; do\
${INSTALL_DATA} $$x ${tooldir}/lib${MULTISUBDIR}/$$x; \
done
@for script in ${SCRIPTS} ${SIM_SCRIPTS} ${EVA_APP_SCRIPTS}; do\
${INSTALL_DATA} ${srcdir}/$${script} ${tooldir}/lib${MULTISUBDIR}/$${script}; \
done
doc:
info:
install-info:
clean-info:
Makefile: Makefile.in config.status @host_makefile_frag_path@
$(SHELL) config.status
config.status: configure
$(SHELL) config.status --recheck

View File

@ -0,0 +1,25 @@
/* close.c -- close a file descriptor.
*
* Copyright (c) 1995 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 "glue.h"
/*
* close -- We don't need to do anything, but pretend we did.
*/
int
_DEFUN (_close ,(fd),
int fd)
{
return (0);
}

1219
libgloss/xstormy16/configure vendored Executable file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,75 @@
dnl Process this file with autoconf to produce a configure script.
AC_PREREQ(2.5)dnl
AC_INIT(crt0.s)
AC_CANONICAL_SYSTEM
AC_ARG_PROGRAM
if test "$srcdir" = "." ; then
mdir=`echo "${with_multisubdir}/" \
| sed -e 's,\([[^/]][[^/]]*\),..,g' -e 's,^/$,,'`
AC_CONFIG_AUX_DIR(${mdir}../../..)
else
AC_CONFIG_AUX_DIR(${srcdir}/../..)
fi
AC_PROG_INSTALL
# FIXME: We temporarily define our own version of AC_PROG_CC. This is
# copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We
# are probably using a cross compiler, which will not be able to fully
# link an executable. This should really be fixed in autoconf
# itself.
AC_DEFUN(LIB_AC_PROG_CC,
[AC_BEFORE([$0], [AC_PROG_CPP])dnl
AC_CHECK_PROG(CC, gcc, gcc)
if test -z "$CC"; then
AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc)
test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH])
fi
AC_PROG_CC_GNU
if test $ac_cv_prog_gcc = yes; then
GCC=yes
dnl Check whether -g works, even if CFLAGS is set, in case the package
dnl plays around with CFLAGS (such as to build both debugging and
dnl normal versions of a library), tasteless as that idea is.
ac_test_CFLAGS="${CFLAGS+set}"
ac_save_CFLAGS="$CFLAGS"
CFLAGS=
AC_PROG_CC_G
if test "$ac_test_CFLAGS" = set; then
CFLAGS="$ac_save_CFLAGS"
elif test $ac_cv_prog_cc_g = yes; then
CFLAGS="-g -O2"
else
CFLAGS="-O2"
fi
else
GCC=
test "${CFLAGS+set}" = set || CFLAGS="-g"
fi
])
LIB_AC_PROG_CC
AS=${AS-as}
AC_SUBST(AS)
AR=${AR-ar}
AC_SUBST(AR)
LD=${LD-ld}
AC_SUBST(LD)
AC_PROG_RANLIB
host_makefile_frag=${srcdir}/../config/default.mh
dnl We have to assign the same value to other variables because autoconf
dnl doesn't provide a mechanism to substitute a replacement keyword with
dnl arbitrary data or pathnames.
dnl
host_makefile_frag_path=$host_makefile_frag
AC_SUBST(host_makefile_frag_path)
AC_SUBST_FILE(host_makefile_frag)
AC_OUTPUT(Makefile)

94
libgloss/xstormy16/crt0.s Normal file
View File

@ -0,0 +1,94 @@
# XSTORMY16 startup code
# Interrupt vectors at 0x8000.
.section .int_vec,"ax"
.global _start
.align 1
_start:
;; Reset, watchdog timer interrupt
jmpf _int_reset
;; base timer interrupt
jmpf _int_basetimer
;; timer 0
jmpf _int_timer0
;; timer 1
jmpf _int_timer1
;; SIO0 interrupt
jmpf _int_sio0
;; SIO1 interrupt
jmpf _int_sio1
;; port0 interrupt
jmpf _int_port0
;; port1 interrupt
jmpf _int_port1
.text
# Reset code, set up memory and call main.
_int_reset:
;; Set up the stack pointer.
mov r0,#__stack
bz r0,#0,0f
mov sp,r0
0:
;; Zero the data space
mov r0,#_edata
mov r1,#_end
mov r2,#0
0: mov.w (r0++),r2
blt r0,r1,0b
;; Call hardware init routine
callf _hwinit
;; Call initialization routines
callf _init
;; Set up fini routines to be called from exit
mov r2,#@fptr(_fini)
callf atexit
;; Call main() with empty argc/argv/envp
mov r2,#0
mov r3,#0
mov r4,#0
callf main
;; Exit.
callf exit
;; Should never reach this code.
halt
1: .size _int_reset,1b-_int_reset
# Stub interrupt routines.
.globl _int_timer0
.weak _int_timer0
.globl _int_timer1
.weak _int_timer1
.globl _int_sio0
.weak _int_sio0
.globl _int_sio1
.weak _int_sio1
.globl _int_port0
.weak _int_port0
.globl _int_port1
.weak _int_port1
.globl _int_basetimer
.weak _int_basetimer
_int_timer0:
_int_timer1:
_int_sio0:
_int_sio1:
_int_port0:
_int_port1:
_int_basetimer:
iret
1: .size _int_timer0,1b-_int_timer0
# Stub hardware init
.globl _hwinit
.weak _hwinit
_hwinit:
ret
1: .size _int_hwinit,1b-_int_hwinit
# The first word in .data has address 0, so it's not a good
# idea to use it as its address conflicts with NULL.
# Place a HALT instruction there to try to catch NULL pointer
# dereferences.
.data
halt

View File

@ -0,0 +1,178 @@
# XSTORMY16 startup code for GDB stub.
# CPU Data for Sanyo EVA debugger at 0x7F00
.section .cpudata,"ax"
.byte 0x00,0x02,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
.byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
.byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
.byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
.byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
.byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
.byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
.byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
.byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
.byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
.byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
.byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
.byte 0x44,0x35,0x39,0x52,0x30,0x30,0x30,0x30,0x2E,0x4F,0x50,0x54,0x00,0x00,0x00,0x00
.byte 0x4c,0x43,0x35,0x39,0x52,0x30,0x30,0x30,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00
.byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x80,0x00,0x20,0x48,0x00,0x00,0x00
.byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x20,0x01,0x12,0x31,0x23,0x59
# Interrupt vectors at 0x8000.
.section .int_vec,"ax"
.global _start
.align 1
_start:
;; Reset, watchdog timer interrupt
jmpf _int_reset
;; base timer interrupt
jmpf _int_basetimer
;; timer 0
jmpf _int_timer0
;; timer 1
jmpf _int_timer1
;; SIO0 interrupt
jmpf _int_sio0
;; SIO1 interrupt
jmpf _int_sio1
;; port0 interrupt
jmpf _int_port0
;; port1 interrupt
jmpf _int_port1
.org 0x80
;; sys interrupt (0x8080)
jmpf _int_sys
;; Application void write(char *buf, int nbytes)
;; This jmps to a stub function to packetize the buf for GDB
jmpf gdb_write
;; Application int read(char *buf, int nbytes)
jmpf gdb_read
.text
# Reset code, set up memory and call main.
_int_reset:
;; Set up the application stack pointer.
mov sp,#0x002
;; Zero the data space
mov r0,#_edata
mov r1,#_end
mov r2,#0
0: mov.w (r0++),r2
blt r0,r1,0b
;; Init the UART
callf uart_init
;; Turn on illegal insn trap
mov r0,r14
set1 r0,#11
mov r14,r0
mov.b 0x7f08,#0x11
mov.b 0x7f09,#0x10
;; "breakpoint" sends us into stub.
0:
.hword 0x0006
br 0b
1: .size _int_reset,1b-_int_reset
# Stub interrupt routines.
.globl _int_timer0
.weak _int_timer0
.globl _int_timer1
.weak _int_timer1
.globl _int_sio0
.weak _int_sio0
.globl _int_sio1
.weak _int_sio1
.globl _int_port0
.weak _int_port0
.globl _int_port1
.weak _int_port1
.globl _int_basetimer
.weak _int_basetimer
_int_timer0:
_int_timer1:
_int_sio0:
_int_sio1:
_int_port0:
_int_port1:
_int_basetimer:
iret
1: .size _int_timer0,1b-_int_timer0
_int_sys:
push r13
mov r13,#registers
mov.w (r13++),r0
mov.w (r13++),r1
mov.w (r13++),r2
mov.w (r13++),r3
mov.w (r13++),r4
mov.w (r13++),r5
mov.w (r13++),r6
mov.w (r13++),r7
mov r0,r8
mov.w (r13++),r0
mov r0,r9
mov.w (r13++),r0
mov r0,r10
mov.w (r13++),r0
mov r0,r11
mov.w (r13++),r0
mov r0,r12
mov.w (r13++),r0
pop r0
mov.w (r13++),r0 ; R13
pop r0
mov.w (r13++),r0 ; PSW
mov r0,r15
sub r0,#4
mov.w (r13++),r0 ; SP
pop r0
pop r1
mov.w (r13++),r1 ; PCL
mov.w (r13++),r0 ; PCH
;; switch to stub stack and invoke stub
mov sp,#0x700
callf handle_exception
mov r0,#registers+34
mov.w r1,(r0) ; PCH
mov.w r2,(--r0) ; PCL
mov.w r3,(--r0) ; SP
mov r15,r3
push r2
push r1
mov.w r1,(--r0) ; PSW
push r1
mov.w r1,(--r0)
mov r13,r1
mov.w r1,(--r0)
mov r12,r1
mov.w r1,(--r0)
mov r11,r1
mov.w r1,(--r0)
mov r10,r1
mov.w r1,(--r0)
mov r9,r1
mov.w r1,(--r0)
mov r8,r1
mov.w r7,(--r0)
mov.w r6,(--r0)
mov.w r5,(--r0)
mov.w r4,(--r0)
mov.w r3,(--r0)
mov.w r2,(--r0)
mov.w r1,(--r0)
mov.w r0,(--r0)
iret
1: .size _int_sys,1b-_int_sys

View File

@ -0,0 +1,9 @@
.section .init,"ax"
.align 1
.globl _init
_init:
.section .fini,"ax"
.align 1
.globl _fini
_fini:

View File

@ -0,0 +1,5 @@
.section .init,"ax"
ret
.section .fini,"ax"
ret

View File

@ -0,0 +1,78 @@
/* eva_app.c -- Glue code for linking apps to run under GDB debugger control.
*
* Copyright (c) 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 "glue.h"
typedef void (*write_proc_t)(char *buf, int nbytes);
typedef int (*read_proc_t)(char *buf, int nbytes);
/* There is no "syscall", so we just call directly into the stub code
at fixed addresses. */
#define STUB_WRITE(p,n) ((write_proc_t)0x8084)((p),(n))
#define STUB_READ(p,n) ((read_proc_t)0x8088)((p),(n))
/*
* print -- do a raw print of a string
*/
void
print(char *ptr)
{
STUB_WRITE(ptr, strlen(ptr));
}
/*
* write -- write bytes to the serial port. Ignore fd, since
* stdout and stderr are the same. Since we have no filesystem,
* open will only return an error.
*/
int
_write (int fd, char *buf, int nbytes)
{
STUB_WRITE(buf, nbytes);
return (nbytes);
}
int
_read (int fd, char *buf, int nbytes)
{
return STUB_READ(buf, nbytes);
}
extern char _end[];
#define HEAP_LIMIT ((char *)0xffff)
void *
_sbrk(int inc)
{
static char *heap_ptr = _end;
void *base;
if (inc > (HEAP_LIMIT - heap_ptr))
return (void *)-1;
base = heap_ptr;
heap_ptr += inc;
return base;
}
void
_exit(int n)
{
while (1)
{
asm volatile ("nop");
asm volatile (".hword 0x0006"); /* breakpoint (special illegal insn) */
}
}

View File

@ -0,0 +1,128 @@
OUTPUT_FORMAT("elf32-xstormy16", "elf32-xstormy16",
"elf32-xstormy16")
OUTPUT_ARCH(xstormy16)
ENTRY(_start)
GROUP(-lc -leva_app -lgcc)
MEMORY
{
RAM (w) : ORIGIN = 0x9000, LENGTH = 0x7000
ROM (!w) : ORIGIN = 0x10000, LENGTH = 0x70000
}
SECTIONS
{
__stack = 2 ;
.data :
{
*(.data)
*(.data.*)
*(.gnu.linkonce.d.*)
SORT(CONSTRUCTORS)
} > RAM
/* Read-only sections */
.rodata : { *(.rodata) *(.rodata.*) *(.gnu.linkonce.r.*) } > RAM
.ctors :
{
/* gcc uses crtbegin.o to find the start of
the constructors, so we make sure it is
first. Because this is a wildcard, it
doesn't matter if the user does not
actually link against crtbegin.o; the
linker won't look for a file to match a
wildcard. The wildcard also means that it
doesn't matter which directory crtbegin.o
is in. */
KEEP (*crtbegin.o(.ctors))
/* We don't want to include the .ctor section from
from the crtend.o file until after the sorted ctors.
The .ctor section from the crtend file contains the
end of ctors marker and it must be last */
KEEP (*(EXCLUDE_FILE (*crtend.o ) .ctors))
KEEP (*(SORT(.ctors.*)))
KEEP (*(.ctors))
} > RAM
.dtors :
{
KEEP (*crtbegin.o(.dtors))
KEEP (*(EXCLUDE_FILE (*crtend.o ) .dtors))
KEEP (*(SORT(.dtors.*)))
KEEP (*(.dtors))
} > RAM
.eh_frame : { KEEP (*(.eh_frame)) } > RAM
.gcc_except_table : { *(.gcc_except_table) } > RAM
.plt : { *(.plt) } > RAM
_edata = .;
PROVIDE (edata = .);
__bss_start = .;
.bss :
{
*(.dynbss)
*(.bss)
*(.bss.*)
*(.gnu.linkonce.b.*)
*(COMMON)
/* Align here to ensure that the .bss section occupies space up to
_end. Align after .bss to ensure correct alignment even if the
.bss section disappears because there are no input sections. */
. = ALIGN(2);
} > RAM
. = ALIGN(2);
_end = .;
PROVIDE (end = .);
.text :
{
*(.int_vec)
*(.text)
*(.text.*)
*(.stub)
/* .gnu.warning sections are handled specially by elf32.em. */
*(.gnu.warning)
*(.gnu.linkonce.t.*)
} > ROM =0
.init :
{
KEEP (*(.init))
} > ROM =0
.fini :
{
KEEP (*(.fini))
} > ROM =0
PROVIDE (__etext = .);
PROVIDE (_etext = .);
PROVIDE (etext = .);
/* Stabs debugging sections. */
.stab 0 : { *(.stab) }
.stabstr 0 : { *(.stabstr) }
.stab.excl 0 : { *(.stab.excl) }
.stab.exclstr 0 : { *(.stab.exclstr) }
.stab.index 0 : { *(.stab.index) }
.stab.indexstr 0 : { *(.stab.indexstr) }
.comment 0 : { *(.comment) }
/* DWARF debug sections.
Symbols in the DWARF debugging sections are relative to the beginning
of the section so we begin them at 0. */
/* DWARF 1 */
.debug 0 : { *(.debug) }
.line 0 : { *(.line) }
/* GNU DWARF 1 extensions */
.debug_srcinfo 0 : { *(.debug_srcinfo) }
.debug_sfnames 0 : { *(.debug_sfnames) }
/* DWARF 1.1 and DWARF 2 */
.debug_aranges 0 : { *(.debug_aranges) }
.debug_pubnames 0 : { *(.debug_pubnames) }
/* DWARF 2 */
.debug_info 0 : { *(.debug_info) *(.gnu.linkonce.wi.*) }
.debug_abbrev 0 : { *(.debug_abbrev) }
.debug_line 0 : { *(.debug_line) }
.debug_frame 0 : { *(.debug_frame) }
.debug_str 0 : { *(.debug_str) }
.debug_loc 0 : { *(.debug_loc) }
.debug_macinfo 0 : { *(.debug_macinfo) }
/* SGI/MIPS DWARF 2 extensions */
.debug_weaknames 0 : { *(.debug_weaknames) }
.debug_funcnames 0 : { *(.debug_funcnames) }
.debug_typenames 0 : { *(.debug_typenames) }
.debug_varnames 0 : { *(.debug_varnames) }
/* These must appear regardless of . */
}

View File

@ -0,0 +1,129 @@
OUTPUT_FORMAT("elf32-xstormy16", "elf32-xstormy16",
"elf32-xstormy16")
OUTPUT_ARCH(xstormy16)
ENTRY(_start)
MEMORY
{
CPUDATA (!w) : ORIGIN = 0x7F00, LENGTH = 0x100
ROM (w) : ORIGIN = 0x8000, LENGTH = 0x1000
}
SECTIONS
{
/* CPU data for Sanyo debugger */
.cpudata : { KEEP (*(.cpudata)) } > CPUDATA
/* Read-only sections in ROM. */
.int_vec : { *(.int_vec) } > ROM
.rodata : { *(.rodata) *(.rodata.*) *(.gnu.linkonce.r.*) } > ROM
.ctors :
{
/* gcc uses crtbegin.o to find the start of
the constructors, so we make sure it is
first. Because this is a wildcard, it
doesn't matter if the user does not
actually link against crtbegin.o; the
linker won't look for a file to match a
wildcard. The wildcard also means that it
doesn't matter which directory crtbegin.o
is in. */
KEEP (*crtbegin.o(.ctors))
/* We don't want to include the .ctor section from
from the crtend.o file until after the sorted ctors.
The .ctor section from the crtend file contains the
end of ctors marker and it must be last */
KEEP (*(EXCLUDE_FILE (*crtend.o ) .ctors))
KEEP (*(SORT(.ctors.*)))
KEEP (*(.ctors))
} > ROM
.dtors :
{
KEEP (*crtbegin.o(.dtors))
KEEP (*(EXCLUDE_FILE (*crtend.o ) .dtors))
KEEP (*(SORT(.dtors.*)))
KEEP (*(.dtors))
} > ROM
.eh_frame : { KEEP (*(.eh_frame)) } > ROM
.gcc_except_table : { *(.gcc_except_table) } > ROM
.plt : { *(.plt) } > ROM
.text :
{
*(.text)
*(.text.*)
*(.stub)
/* .gnu.warning sections are handled specially by elf32.em. */
*(.gnu.warning)
*(.gnu.linkonce.t.*)
} > ROM =0
.init :
{
KEEP (*(.init))
} > ROM =0
.fini :
{
KEEP (*(.fini))
} > ROM =0
PROVIDE (__etext = .);
PROVIDE (_etext = .);
PROVIDE (etext = .);
.data :
{
*(.data)
*(.data.*)
*(.gnu.linkonce.d.*)
SORT(CONSTRUCTORS)
} > ROM
_edata = .;
PROVIDE (edata = .);
__bss_start = .;
.bss :
{
*(.dynbss)
*(.bss)
*(.bss.*)
*(.gnu.linkonce.b.*)
*(COMMON)
/* Align here to ensure that the .bss section occupies space up to
_end. Align after .bss to ensure correct alignment even if the
.bss section disappears because there are no input sections. */
. = ALIGN(2);
} > ROM
. = ALIGN(2);
_end = .;
PROVIDE (end = .);
/* Stabs debugging sections. */
.stab 0 : { *(.stab) }
.stabstr 0 : { *(.stabstr) }
.stab.excl 0 : { *(.stab.excl) }
.stab.exclstr 0 : { *(.stab.exclstr) }
.stab.index 0 : { *(.stab.index) }
.stab.indexstr 0 : { *(.stab.indexstr) }
.comment 0 : { *(.comment) }
/* DWARF debug sections.
Symbols in the DWARF debugging sections are relative to the beginning
of the section so we begin them at 0. */
/* DWARF 1 */
.debug 0 : { *(.debug) }
.line 0 : { *(.line) }
/* GNU DWARF 1 extensions */
.debug_srcinfo 0 : { *(.debug_srcinfo) }
.debug_sfnames 0 : { *(.debug_sfnames) }
/* DWARF 1.1 and DWARF 2 */
.debug_aranges 0 : { *(.debug_aranges) }
.debug_pubnames 0 : { *(.debug_pubnames) }
/* DWARF 2 */
.debug_info 0 : { *(.debug_info) *(.gnu.linkonce.wi.*) }
.debug_abbrev 0 : { *(.debug_abbrev) }
.debug_line 0 : { *(.debug_line) }
.debug_frame 0 : { *(.debug_frame) }
.debug_str 0 : { *(.debug_str) }
.debug_loc 0 : { *(.debug_loc) }
.debug_macinfo 0 : { *(.debug_macinfo) }
/* SGI/MIPS DWARF 2 extensions */
.debug_weaknames 0 : { *(.debug_weaknames) }
.debug_funcnames 0 : { *(.debug_funcnames) }
.debug_typenames 0 : { *(.debug_typenames) }
.debug_varnames 0 : { *(.debug_varnames) }
/* These must appear regardless of . */
}

View File

@ -0,0 +1,30 @@
/* fstat.c -- get status of a file.
*
* Copyright (c) 1995 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 <sys/stat.h>
#include "glue.h"
/*
* fstat -- Since we have no file system, we just return an error.
*/
int
_DEFUN (_fstat, (fd, buf),
int fd _AND
struct stat *buf)
{
buf->st_mode = S_IFCHR; /* Always pretend to be a tty */
buf->st_blksize = 0;
return (0);
}

View File

@ -0,0 +1,25 @@
/* getpid.c -- get the current process id.
*
* Copyright (c) 1995 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 "glue.h"
/*
* getpid -- only one process, so just return 1.
*/
int
_DEFUN (_getpid, (),
)
{
return __MYPID;
}

28
libgloss/xstormy16/kill.c Normal file
View File

@ -0,0 +1,28 @@
/* kill.c -- remove a process.
*
* Copyright (c) 1995 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 "glue.h"
/*
* kill -- go out via exit...
*/
int
_DEFUN (_kill, (pid, sig),
int pid _AND
int sig)
{
if(pid == __MYPID)
_exit(sig);
return 0;
}

View File

@ -0,0 +1,31 @@
/* lseek.c -- move read/write pointer.
*
* Copyright (c) 1995 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 <sys/types.h>
#include <errno.h>
#include "glue.h"
/*
* lseek -- Since a serial port is non-seekable, we return an error.
*/
off_t
_DEFUN (_lseek, (fd, offset, whence),
int fd _AND
off_t offset _AND
int whence)
{
errno = ESPIPE;
return ((off_t)-1);
}

31
libgloss/xstormy16/open.c Normal file
View File

@ -0,0 +1,31 @@
/* open.c -- open a file.
*
* Copyright (c) 1995 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 <errno.h>
#include "glue.h"
/*
* open -- open a file descriptor. We don't have a filesystem, so
* we return an error.
*/
int
_DEFUN (_open, (buf, flags, mode),
const char *buf _AND
int flags _AND
int mode)
{
errno = EIO;
return (-1);
}

55
libgloss/xstormy16/sbrk.c Normal file
View File

@ -0,0 +1,55 @@
/* sbrk.c -- allocate memory dynamically.
*
* Copyright (c) 1995,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 <errno.h>
#include "glue.h"
/* just in case, most boards have at least some memory */
#ifndef RAMSIZE
# define RAMSIZE (caddr_t)0x100000
#endif
char *heap_ptr;
/*
* sbrk -- changes heap size size. Get nbytes more
* RAM. We just increment a pointer in what's
* left of memory on the board.
*/
char *
_sbrk (nbytes)
int nbytes;
{
char *base;
if (!heap_ptr)
heap_ptr = (char *)&_end;
base = heap_ptr;
heap_ptr += nbytes;
return base;
/* FIXME: We really want to make sure we don't run out of RAM, but this
* isn't very portable.
*/
#if 0
if ((RAMSIZE - heap_ptr - nbytes) >= 0) {
base = heap_ptr;
heap_ptr += nbytes;
return (base);
} else {
errno = ENOMEM;
return ((char *)-1);
}
#endif
}

View File

@ -0,0 +1,132 @@
/* A modified version of the basic linker script, for testing purposes,
which puts all code above 0x10000. */
OUTPUT_FORMAT("elf32-xstormy16", "elf32-xstormy16",
"elf32-xstormy16")
OUTPUT_ARCH(xstormy16)
ENTRY(_start)
SEARCH_DIR(/es/scratch/geoffk/objs/mainline-sX/H-i686-pc-linux-gnulibc2.2/xstormy16-elf/lib);
/* There are two memory regions we care about, one from 0 through 0x7F00
that is RAM and one from 0x8000 up which is ROM. */
MEMORY
{
RAM (w) : ORIGIN = 0, LENGTH = 0x7F00
LOROM (!w) : ORIGIN = 0x8000, LENGTH = 0x8000
HIROM (!w) : ORIGIN = 0x10000, LENGTH = 0xFF0000
}
SECTIONS
{
.data :
{
*(.data)
*(.data.*)
*(.gnu.linkonce.d.*)
SORT(CONSTRUCTORS)
} > RAM
_edata = .;
PROVIDE (edata = .);
__bss_start = .;
.bss :
{
*(.dynbss)
*(.bss)
*(.bss.*)
*(.gnu.linkonce.b.*)
*(COMMON)
/* Align here to ensure that the .bss section occupies space up to
_end. Align after .bss to ensure correct alignment even if the
.bss section disappears because there are no input sections. */
. = ALIGN(2);
} > RAM
. = ALIGN(2);
__stack = .;
. = . + 4096;
_end = .;
PROVIDE (end = .);
/* Read-only sections in ROM. */
.int_vec : { *(.int_vec) } > LOROM
.rodata : { *(.rodata) *(.rodata.*) *(.gnu.linkonce.r.*) } > LOROM
.ctors :
{
/* gcc uses crtbegin.o to find the start of
the constructors, so we make sure it is
first. Because this is a wildcard, it
doesn't matter if the user does not
actually link against crtbegin.o; the
linker won't look for a file to match a
wildcard. The wildcard also means that it
doesn't matter which directory crtbegin.o
is in. */
KEEP (*crtbegin.o(.ctors))
/* We don't want to include the .ctor section from
from the crtend.o file until after the sorted ctors.
The .ctor section from the crtend file contains the
end of ctors marker and it must be last */
KEEP (*(EXCLUDE_FILE (*crtend.o ) .ctors))
KEEP (*(SORT(.ctors.*)))
KEEP (*(.ctors))
} > LOROM
.dtors :
{
KEEP (*crtbegin.o(.dtors))
KEEP (*(EXCLUDE_FILE (*crtend.o ) .dtors))
KEEP (*(SORT(.dtors.*)))
KEEP (*(.dtors))
} > LOROM
.eh_frame : { KEEP (*(.eh_frame)) } > LOROM
.gcc_except_table : { *(.gcc_except_table) } > LOROM
.plt : { *(.plt) } > LOROM
.text :
{
*(.text)
*(.text.*)
*(.stub)
/* .gnu.warning sections are handled specially by elf32.em. */
*(.gnu.warning)
*(.gnu.linkonce.t.*)
} > HIROM =0
.init :
{
KEEP (*(.init))
} > HIROM =0
.fini :
{
KEEP (*(.fini))
} > HIROM =0
PROVIDE (__etext = .);
PROVIDE (_etext = .);
PROVIDE (etext = .);
/* Stabs debugging sections. */
.stab 0 : { *(.stab) }
.stabstr 0 : { *(.stabstr) }
.stab.excl 0 : { *(.stab.excl) }
.stab.exclstr 0 : { *(.stab.exclstr) }
.stab.index 0 : { *(.stab.index) }
.stab.indexstr 0 : { *(.stab.indexstr) }
.comment 0 : { *(.comment) }
/* DWARF debug sections.
Symbols in the DWARF debugging sections are relative to the beginning
of the section so we begin them at 0. */
/* DWARF 1 */
.debug 0 : { *(.debug) }
.line 0 : { *(.line) }
/* GNU DWARF 1 extensions */
.debug_srcinfo 0 : { *(.debug_srcinfo) }
.debug_sfnames 0 : { *(.debug_sfnames) }
/* DWARF 1.1 and DWARF 2 */
.debug_aranges 0 : { *(.debug_aranges) }
.debug_pubnames 0 : { *(.debug_pubnames) }
/* DWARF 2 */
.debug_info 0 : { *(.debug_info) *(.gnu.linkonce.wi.*) }
.debug_abbrev 0 : { *(.debug_abbrev) }
.debug_line 0 : { *(.debug_line) }
.debug_frame 0 : { *(.debug_frame) }
.debug_str 0 : { *(.debug_str) }
.debug_loc 0 : { *(.debug_loc) }
.debug_macinfo 0 : { *(.debug_macinfo) }
/* SGI/MIPS DWARF 2 extensions */
.debug_weaknames 0 : { *(.debug_weaknames) }
.debug_funcnames 0 : { *(.debug_funcnames) }
.debug_typenames 0 : { *(.debug_typenames) }
.debug_varnames 0 : { *(.debug_varnames) }
/* These must appear regardless of . */
}

30
libgloss/xstormy16/stat.c Normal file
View File

@ -0,0 +1,30 @@
/* stat.c -- Get the status of a file.
*
* Copyright (c) 1995 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 <sys/stat.h>
#include <errno.h>
#include "glue.h"
/*
* stat -- Since we have no file system, we just return an error.
*/
int
_DEFUN (_stat, (path, buf),
const char *path _AND
struct stat *buf)
{
errno = EIO;
return (-1);
}

View File

@ -0,0 +1,162 @@
# xstormy16 system calls for the simulator
#include <syscall.h>
.text
.globl _exit
_exit:
mov r1,#SYS_exit
.hword 0x0001
bnz r1,#0,syscall_error
ret
0: .size exit,0b-_exit
.globl _open
_open:
mov r1,#SYS_open
.hword 0x0001
bnz r1,#0,syscall_error
ret
0: .size open,0b-_open
.globl _close
_close:
mov r1,#SYS_close
.hword 0x0001
bnz r1,#0,syscall_error
ret
0: .size close,0b-_close
.globl _read
_read:
mov r1,#SYS_read
.hword 0x0001
bnz r1,#0,syscall_error
ret
0: .size read,0b-_read
.globl _write
_write:
mov r1,#SYS_write
.hword 0x0001
bnz r1,#0,syscall_error
ret
0: .size write,0b-_write
.globl _lseek
_lseek:
mov r1,#SYS_lseek
.hword 0x0001
bnz r1,#0,syscall_error
ret
0: .size lseek,0b-_lseek
.globl _unlink
_unlink:
mov r1,#SYS_unlink
.hword 0x0001
bnz r1,#0,syscall_error
ret
0: .size unlink,0b-_unlink
.globl _getpid
_getpid:
mov r1,#SYS_getpid
.hword 0x0001
bnz r1,#0,syscall_error
ret
0: .size getpid,0b-_getpid
.globl _kill
_kill:
mov r1,#SYS_kill
.hword 0x0001
bnz r1,#0,syscall_error
ret
0: .size kill,0b-_kill
.globl _fstat
_fstat:
mov r1,#SYS_fstat
.hword 0x0001
bnz r1,#0,syscall_error
ret
0: .size fstat,0b-_fstat
.globl _chdir
_chdir:
mov r1,#SYS_chdir
.hword 0x0001
bnz r1,#0,syscall_error
ret
0: .size chdir,0b-_chdir
.globl _stat
_stat:
mov r1,#SYS_stat
.hword 0x0001
bnz r1,#0,syscall_error
ret
0: .size stat,0b-_stat
.globl _chmod
_chmod:
mov r1,#SYS_chmod
.hword 0x0001
bnz r1,#0,syscall_error
ret
0: .size chmod,0b-_chmod
.globl _utime
_utime:
mov r1,#SYS_utime
.hword 0x0001
bnz r1,#0,syscall_error
ret
0: .size utime,0b-_utime
.globl _time
_time:
mov r1,#SYS_time
.hword 0x0001
bnz r1,#0,syscall_error
ret
0: .size time,0b-_time
.globl _gettimeofday
_gettimeofday:
mov r1,#SYS_gettimeofday
.hword 0x0001
bnz r1,#0,syscall_error
ret
0: .size gettimeofday,0b-_gettimeofday
.globl _times
_times:
mov r1,#SYS_times
.hword 0x0001
bnz r1,#0,syscall_error
ret
0: .size times,0b-_times
.globl _link
_link:
mov r1,#SYS_link
.hword 0x0001
bnz r1,#0,syscall_error
ret
0: .size link,0b-_link
syscall_error:
# Return value for the syscall is in r2. Save it here, as
# _errno will overwrite it with the address of the errno
# variable. r0 is the errno.
push r2
push r0
callf __errno
pop r0
mov.w (r2),r0
pop r2
ret
0: .size syscall_error,0b-syscall_error

View File

@ -0,0 +1,40 @@
# xstormy16 system calls for the simulator
#include <syscall.h>
.text
define(`syscall',`.globl _`'$1
_`'$1`':
mov r1,#SYS_$1
.hword 0x0001
bnz r1,#0,syscall_error
ret
0: .size $1,0b-_$1
')dnl
syscall(exit)
syscall(open)
syscall(close)
syscall(read)
syscall(write)
syscall(lseek)
syscall(unlink)
syscall(getpid)
syscall(kill)
syscall(fstat)
syscall(chdir)
syscall(stat)
syscall(chmod)
syscall(utime)
syscall(time)
syscall(gettimeofday)
syscall(times)
syscall(link)
dnl
syscall_error:
push r0
callf __errno
pop r0
mov.w (r2),r0
ret
0: .size syscall_error,0b-syscall_error

View File

@ -0,0 +1,28 @@
/* unlink.c -- remove a file.
*
* Copyright (c) 1995 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 <errno.h>
#include "glue.h"
/*
* unlink -- since we have no file system,
* we just return an error.
*/
int
_DEFUN (_unlink, (path),
char * path)
{
errno = EIO;
return (-1);
}

View File

@ -0,0 +1,837 @@
/****************************************************************************
THIS SOFTWARE IS NOT COPYRIGHTED
HP offers the following for use in the public domain. HP makes no
warranty with regard to the software or it's performance and the
user accepts the software "AS IS" with all faults.
HP DISCLAIMS ANY WARRANTIES, EXPRESS OR IMPLIED, WITH REGARD
TO THIS SOFTWARE INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
****************************************************************************/
/****************************************************************************
* Header: remcom.c,v 1.34 91/03/09 12:29:49 glenne Exp $
*
* Module name: remcom.c $
* Revision: 1.34 $
* Date: 91/03/09 12:29:49 $
* Contributor: Lake Stevens Instrument Division$
*
* Description: low level support for gdb debugger. $
*
* Considerations: only works on target hardware $
*
* Written by: Glenn Engel $
* ModuleState: Experimental $
*
* NOTES: See Below $
*
* Heavily modified for XStormy16 by Mark Salter, Red Hat.
* Optimisations and 'X' support by Geoff Keating, Red Hat.
*
* To enable debugger support, two things need to happen. One, a
* call to set_debug_traps() is necessary in order to allow any breakpoints
* or error conditions to be properly intercepted and reported to gdb.
* Two, a breakpoint needs to be generated to begin communication. This
* is most easily accomplished by a call to breakpoint(). Breakpoint()
* simulates a breakpoint by executing a trap #1.
*
* Because gdb will sometimes write to the stack area to execute function
* calls, this program cannot rely on using the inferior stack so it uses
* it's own stack area.
*
*************
*
* The following gdb commands are supported:
*
* command function Return value
*
* g return the value of the CPU registers hex data or ENN
* G set the value of the CPU registers OK or ENN
*
* mAA..AA,LLLL Read LLLL bytes at address AA..AA hex data or ENN
* MAA..AA,LLLL: Write LLLL bytes at address AA.AA OK or ENN
* XAA..AA,LLLL: Write LLLL binary bytes at address OK or ENN
* AA..AA
*
* c Resume at current address SNN ( signal NN)
* cAA..AA Continue at address AA..AA SNN
*
* s Step one instruction SNN
* sAA..AA Step one instruction from AA..AA SNN
*
* k kill
*
* ? What was the last sigval ? SNN (signal NN)
*
* All commands and responses are sent with a packet which includes a
* checksum. A packet consists of
*
* $<packet info>#<checksum>.
*
* where
* <packet info> :: <characters representing the command or response>
* <checksum> :: <two hex digits computed as modulo 256 sum of <packetinfo>>
*
* When a packet is received, it is first acknowledged with either '+' or '-'.
* '+' indicates a successful transfer. '-' indicates a failed transfer.
*
* Example:
*
* Host: Reply:
* $m0,10#2a +$00010203040506070809101112131415#42
*
****************************************************************************/
/* Local functions:
*/
static void putDebugChar(unsigned ch);
static unsigned char getDebugChar(void);
static void putPacket(unsigned char *);
static void putHex (char c, unsigned long mem_arg, int count);
static unsigned char *getpacket(void);
static void hex2mem(unsigned char *, unsigned long, int);
static int valid_addr_range (unsigned long mem, int count);
static int hexToInt(unsigned char **, long *);
static void prepare_to_step(void);
static void finish_from_step(void);
/* breakpoint opcode */
#define BREAKPOINT_OPCODE 0x0006
/* Error Detection Register */
#define ERR_DETECT_REG (*(volatile unsigned *)0x7f08)
#define UNDEF_INSN_ENA 0x01
#define UNDEF_INSN_FLAG 0x02
#define ODD_ADDR_ENA 0x04
#define ODD_ADDR_FLAG 0x08
#define BAD_ADDR_ENA 0x10
#define BAD_ADDR_FLAG 0x20
#define SER0_IRQ_ENA 0x1000
#define SER0_IRQ_FLAG 0x2000
/*****************************************************************************
* BUFMAX defines the maximum number of characters in inbound/outbound buffers
* at least NUMREGBYTES*2 are needed for register packets
*/
#define BUFMAX 80
static const unsigned char hexchars[]="0123456789abcdef";
#define NUMREGS 17
/* Number of bytes of registers (extra 2 bytes is for 4 byte PC). */
#define NUMREGBYTES ((NUMREGS * 2) + 2)
enum regnames { R0, R1, R2, R3, R4, R5, R6, R7,
R8, R9, R10, R11, R12, R13, R14, R15,
PC };
#define FP R13
#define PSW R14
#define SP R15
struct regs {
int r[16];
long pc;
} registers;
static struct regs orig_registers;
static unsigned char remcomBuffer[BUFMAX];
/* Indicate whether inferior is running. Used to decide whether or not to
send T packet when stub is entered. */
static char is_running;
static inline unsigned char
get_char(unsigned long addr)
{
unsigned int msw, lsw;
unsigned char ret;
msw = addr >> 16;
lsw = addr & 0xffff;
asm("movf.b %0,(%2)\n"
: "=e"(ret) : "d"(msw), "r"(lsw) : "memory");
return ret;
}
static inline void
set_char(unsigned long addr, unsigned int val)
{
unsigned int msw, lsw;
msw = addr >> 16;
lsw = addr & 0xffff;
asm("movf.b (%1),%2\n"
: /* none */ : "d"(msw), "r"(lsw), "e"(val) : "memory" );
}
static inline unsigned int
get_word(unsigned long addr)
{
unsigned int ret, msw, lsw;
msw = addr >> 16;
lsw = addr & 0xffff;
asm("movf.w %0,(%2)\n"
: "=e"(ret) : "d"(msw), "r"(lsw) : "memory" );
return ret;
}
static inline void
set_word(unsigned long addr, unsigned int val)
{
unsigned int msw, lsw;
msw = addr >> 16;
lsw = addr & 0xffff;
asm("movf.w (%1),%2\n"
: /* none */ : "d"(msw), "r"(lsw), "e"(val) : "memory" );
}
static void
assign_regs (struct regs *dest, const struct regs *src)
{
int i;
char *d = (char *)dest, *s = (char *)src;
for (i = 0; i < sizeof (struct regs); i++)
*d++ = *s++;
}
/* Write out a register for a 'T' packet. */
static unsigned char *
putreg (unsigned char *buf, int regnum, void *mem_p, int count)
{
int i;
unsigned char ch;
char *mem = (char *)mem_p;
*buf++ = hexchars[regnum >> 4];
*buf++ = hexchars[regnum % 16];
*buf++ = ':';
for (i=0;i<count;i++)
{
ch = *mem++;
*buf++ = hexchars[ch >> 4];
*buf++ = hexchars[ch % 16];
}
*buf++ = ';';
return(buf);
}
/*
* This function does all command procesing for interfacing to gdb.
*/
void
handle_exception(void)
{
char sigval;
unsigned char *ptr;
long addr, length;
/* reply to host that an exception has occurred */
sigval = 5; /* SIGTRAP is default */
if (ERR_DETECT_REG & UNDEF_INSN_FLAG)
{
ERR_DETECT_REG &= ~UNDEF_INSN_FLAG;
registers.pc -= 2;
if (get_word(registers.pc) != BREAKPOINT_OPCODE)
sigval = 4; /* SIGILL */
}
if (ERR_DETECT_REG & BAD_ADDR_FLAG)
{
ERR_DETECT_REG &= ~BAD_ADDR_FLAG;
sigval = 11; /* SIGSEGV */
}
if (ERR_DETECT_REG & SER0_IRQ_FLAG)
{
unsigned char ch;
ch = getDebugChar();
ERR_DETECT_REG &= ~SER0_IRQ_FLAG;
if (ch != 0x03)
return;
sigval = 2; /* SIGINT */
}
finish_from_step();
/* save original context so it can be restored as a result of
a kill packet. */
if (orig_registers.pc == 0L)
assign_regs (&orig_registers, &registers);
if (is_running)
{
ptr = remcomBuffer;
*ptr++ = 'T'; /* notify gdb with signo, PC, FP and SP */
*ptr++ = hexchars[sigval >> 4];
*ptr++ = hexchars[sigval & 0xf];
ptr = putreg (ptr, PC, &registers.pc, 4);
ptr = putreg (ptr, FP, &registers.r[FP], 2);
ptr = putreg (ptr, SP, &registers.r[SP], 2);
*ptr++ = 0;
putPacket(remcomBuffer);
}
while (1) {
char kind;
ptr = getpacket();
kind = *ptr++;
if (kind == 'M' || kind == 'X')
{
/* MAA..AA,LLLL: Write LLLL bytes at address AA.AA return OK */
/* TRY TO READ '%x,%x:'. IF SUCCEED, SET PTR = 0 */
if (hexToInt(&ptr,&addr)
&& *(ptr++) == ','
&& hexToInt(&ptr,&length)
&& *(ptr++) == ':')
{
if (valid_addr_range (addr, length))
{
if (kind == 'M')
hex2mem(ptr, addr, length);
else
{
int i;
for (i = 0; i < length; i++)
if (*ptr++ == 0x7d)
set_char (addr++, *ptr++ ^ 0x20);
else
set_char (addr++, ptr[-1]);
}
putPacket ("OK");
}
else
putPacket ("E03");
}
else
putPacket ("E02");
}
else if (kind == 'm')
{
/* mAA..AA,LLLL Read LLLL bytes at address AA..AA */
/* TRY TO READ %x,%x. IF SUCCEED, SET PTR = 0 */
if (hexToInt(&ptr,&addr)
&& *(ptr++) == ','
&& hexToInt (&ptr,&length))
{
if (valid_addr_range (addr, length))
putHex (0, addr, length);
else
putPacket ("E03");
}
else
putPacket ("E02");
}
else if (kind == 'R')
{
if (hexToInt (&ptr, &addr))
registers.pc = addr;
putPacket ("OK");
}
else if (kind == '!')
putPacket ("OK");
else if (kind == '?')
putHex ('S', (unsigned long)(unsigned int)&sigval, 1);
else if (kind == 'g')
putHex (0, (unsigned long)(unsigned int)&registers, NUMREGBYTES);
else if (kind == 'P')
{
/* set the value of a single CPU register - return OK */
unsigned long regno;
if (hexToInt (&ptr, &regno)
&& *ptr++ == '='
&& regno < NUMREGS)
{
hex2mem (ptr, (unsigned long)(unsigned int)(registers.r + regno),
regno == PC ? 4 : 2);
putPacket ("OK");
}
else
putPacket ("E01");
}
else if (kind == 'G')
{
/* set the value of the CPU registers - return OK */
hex2mem(ptr, (unsigned long)(unsigned int)&registers, NUMREGBYTES);
putPacket ("OK");
}
else if (kind == 's' || kind == 'c')
{
/* sAA..AA Step one instruction from AA..AA(optional) */
/* cAA..AA Continue from address AA..AA(optional) */
/* try to read optional parameter, pc unchanged if no parm */
is_running = 1;
if (hexToInt(&ptr,&addr))
registers.pc = addr;
if (kind == 's') /* single-stepping */
prepare_to_step();
return;
}
else if (kind == 'k')
{
/* kill the program */
assign_regs (&registers, &orig_registers);
is_running = 0;
putPacket ("");
}
else
/* Unknown code. Return an empty reply message. */
putPacket ("");
}
}
static int
hex (int ch)
{
if ((ch >= '0') && (ch <= '9')) return (ch-'0');
if ((ch >= 'a') && (ch <= 'f')) return (ch-'a'+10);
if ((ch >= 'A') && (ch <= 'F')) return (ch-'A'+10);
return (-1);
}
/* scan for the sequence $<data>#<checksum> */
static unsigned char *
getpacket (void)
{
unsigned char *buffer = &remcomBuffer[0];
unsigned checksum;
int count;
char ch;
while (1)
{
/* wait around for the start character, ignore all other characters */
while (getDebugChar () != '$')
;
checksum = 0;
count = 0;
while ((ch = getDebugChar ()) == '$')
;
/* now, read until a # or end of buffer is found */
while (ch != '#' && count < BUFMAX - 1)
{
checksum = checksum + ch;
buffer[count] = ch;
count = count + 1;
ch = getDebugChar ();
}
buffer[count] = 0;
if (ch == '#')
{
unsigned xmitcsum;
ch = getDebugChar ();
xmitcsum = hex (ch) << 4;
ch = getDebugChar ();
xmitcsum += hex (ch);
/* If one of the above 'hex' calls returns -1, xmitcsum will
have high bits set, and so the test below will fail. */
if ((checksum & 0xFF) != xmitcsum)
putDebugChar ('-'); /* failed checksum */
else
{
putDebugChar ('+'); /* successful transfer */
return &buffer[0];
}
}
}
}
/* send the packet in buffer. */
static void
putPacket (unsigned char *buffer_p)
{
/* $<packet info>#<checksum>. */
do {
unsigned checksum;
unsigned char *buffer = buffer_p;
putDebugChar('$');
checksum = 0;
while (*buffer) {
putDebugChar(*buffer);
checksum += *buffer;
buffer++;
}
putDebugChar('#');
putDebugChar(hexchars[(checksum >> 4) % 16]);
putDebugChar(hexchars[checksum % 16]);
} while (getDebugChar() != '+');
}
/* Convert the memory pointed to by mem into hex, and return it as a packet. */
static void
putHex (char c, unsigned long mem_arg, int count)
{
do {
unsigned long mem = mem_arg;
int i;
unsigned checksum;
putDebugChar('$');
checksum = 0;
if (c)
{
checksum = c;
putDebugChar(c);
}
for (i = 0; i < count; i++)
{
unsigned char c = get_char (mem);
char ch = hexchars[c >> 4];
putDebugChar(ch);
checksum += ch;
ch = hexchars[c % 16];
putDebugChar(ch);
checksum += ch;
mem++;
}
putDebugChar('#');
putDebugChar(hexchars[(checksum >> 4) % 16]);
putDebugChar(hexchars[checksum % 16]);
} while (getDebugChar() != '+');
}
/* Function: gdb_write(char *, int)
Make gdb write n bytes to stdout (not assumed to be null-terminated). */
void
gdb_write (char *data, int len)
{
ERR_DETECT_REG &= ~SER0_IRQ_ENA;
putHex ('O', (unsigned long)(unsigned int)data, len);
ERR_DETECT_REG |= SER0_IRQ_ENA;
}
int
gdb_read (char *buf, int nbytes)
{
int i = 0;
ERR_DETECT_REG &= ~SER0_IRQ_ENA;
for (i = 0; i < nbytes; i++)
{
*(buf + i) = getDebugChar();
if ((*(buf + i) == '\n') || (*(buf + i) == '\r'))
{
(*(buf + i + 1)) = 0;
break;
}
}
ERR_DETECT_REG |= SER0_IRQ_ENA;
return (i);
}
static int
valid_addr_range (unsigned long mem, int count)
{
unsigned long last = mem + count - 1;
if (last < 0x800L)
return 1;
if (mem < 0x7f00L)
return 0;
if (last > 0x7ffffL)
return 0;
return 1;
}
/* Convert the hex array pointed to by buf into binary to be placed in mem.
Return a pointer to the character AFTER the last byte written. */
static void
hex2mem (unsigned char *buf, unsigned long mem, int count)
{
int i;
unsigned char ch;
for (i=0;i<count;i++)
{
ch = hex(*buf++) << 4;
ch = ch + hex(*buf++);
set_char (mem++, ch);
}
}
/**********************************************/
/* WHILE WE FIND NICE HEX CHARS, BUILD AN INT */
/* RETURN NUMBER OF CHARS PROCESSED */
/**********************************************/
static int
hexToInt (unsigned char **ptr, long *intValue)
{
int numChars = 0;
int hexValue;
*intValue = 0;
while (**ptr)
{
hexValue = hex(**ptr);
if (hexValue >=0)
{
*intValue = (*intValue <<4) | (unsigned) hexValue;
numChars ++;
}
else
break;
(*ptr)++;
}
return (numChars);
}
/* Function: opcode_size
Determine number of bytes in full opcode by examining first word.
*/
static int
opcode_size(unsigned int opcode)
{
if ((opcode & 0xff00) == 0)
return 2;
if ((opcode & 0xf800) == 0)
return 4;
if ((opcode & 0xf800) == 0x7800)
return 4;
if ((opcode & 0xf000) == 0xc000)
return 4;
if ((opcode & 0xf100) == 0x2000)
return 4;
if ((opcode & 0xfff0) == 0x30e0)
return 4;
if ((opcode & 0xf008) == 0x6008)
return 4;
if ((opcode & 0xf808) == 0x7008)
return 4;
opcode >>= 8;
if (opcode == 0x0c || opcode == 0x0d || opcode == 0x31)
return 4;
return 2;
}
static struct {
unsigned long addr;
unsigned long addr2;
unsigned int opcode;
unsigned int opcode2;
} stepinfo;
/* Function: prepare_to_step
Called from handle_exception to prepare the user program to single-step.
Places a trap instruction after the target instruction, with special
extra handling for branch instructions.
*/
static void
prepare_to_step(void)
{
unsigned long pc = registers.pc;
unsigned long next_pc, next_pc2;
unsigned int op, op2, sp;
unsigned char op_msb, op_lsb;
int r12;
char r8;
op = get_word(pc);
op_msb = (op >> 8) & 0xff;
op_lsb = op & 0xff;
op2 = get_word(pc + 2);
next_pc = pc + opcode_size(op);
next_pc2 = 0;
if (op_msb == 0)
{
if (op_lsb == 2)
{
/* IRET */
sp = registers.r[SP];
next_pc = *(unsigned *)(sp - 4);
next_pc = (next_pc << 16) | *(unsigned *)(sp - 6);
}
else if (op_lsb == 3)
{
/* RET */
sp = registers.r[SP];
next_pc = *(unsigned *)(sp - 2);
next_pc = (next_pc << 16) | *(unsigned *)(sp - 4);
}
else
{
op2 = op_lsb & 0xf0;
if (op2 && op2 < 0x40)
{
/* {CALLR,BR,ICALLR} Rs */
next_pc = (pc + 2) + (int)registers.r[op_lsb & 0xf];
}
else if (op2 < 0x80 || op2 == 0xa0 || op2 == 0xb0)
{
/* {JMP,ICALL,CALL} Rb,Rs */
next_pc = registers.r[(op_lsb & 0x10) ? 9 : 8];
next_pc = (next_pc << 16) | (unsigned int)registers.r[op_lsb & 0xf];
}
}
}
else if (op_msb < 4)
{
/* {CALLF,JMPF,ICALLF} a24 */
next_pc = ((unsigned long)op2) << 8;
next_pc |= op_lsb;
}
else if (op_msb < 8)
{
if ((op2 & 0xf000) == 0)
{
/* Bx Rd,#imm4,r12 */
/* Bx Rd,Rs,r12 */
r12 = op2 << 4;
r12 >>= 4;
next_pc2 = (pc + 4) + r12;
}
}
else if (op_msb == 0x0c || op_msb == 0x0d || (op_msb & 0xf1) == 0x20 ||
((op_msb >= 0x7c && op_msb <= 0x7f) && (op2 & 0x8000) == 0))
{
/* Bxx Rd,Rs,r12 */
/* Bxx Rd,#imm8,r12 */
/* Bx m8,#imm3,r12 */
/* Bx s8,#imm3,r12 */
r12 = op2 << 4;
r12 >>= 4;
next_pc2 = (pc + 4) + r12;
}
else if ((op_msb & 0xf0) == 0x10)
{
/* {BR,CALLR} r12 */
r12 = (op & 0xffe) << 4;
r12 >>= 4;
next_pc = (pc + 2) + r12;
}
else if ((op_msb & 0xe0) == 0xc0)
{
/* Bxx Rx,#imm16,r8 */
/* TBxx r8 */
r8 = op_lsb;
next_pc2 = next_pc + r8;
}
stepinfo.addr = next_pc;
stepinfo.opcode = get_word(next_pc);
set_word(next_pc, BREAKPOINT_OPCODE);
if (next_pc2)
{
stepinfo.addr2 = next_pc2;
stepinfo.opcode2 = get_word(next_pc2);
set_word(next_pc2, BREAKPOINT_OPCODE);
}
}
/* Function: finish_from_step
Called from handle_exception to finish up when the user program
returns from a single-step. Replaces the instructions that had
been overwritten by breakpoint. */
static void
finish_from_step (void)
{
if (stepinfo.addr) /* anything to do? */
{
set_word(stepinfo.addr, stepinfo.opcode);
stepinfo.addr = 0;
if (stepinfo.addr2)
{
set_word(stepinfo.addr2, stepinfo.opcode2);
stepinfo.addr2 = 0;
}
}
}
/*
* UART support
*/
#define UART0_BASE 0x7f38
#define UART1_BASE 0x7f48
#define UART_CR(base) (*(volatile unsigned char *)(base))
#define UART_RXD(base) (*(volatile unsigned int *)((base) + 2))
#define UART_TXD(base) (*(volatile unsigned int *)((base) + 4))
#define UART_CR_RUN 0x80
#define UART_CR_ERR 0x40
#define UART_CR_BAUD_115k 0x20
#define UART_CR_PARITY 0x10
#define UART_CR_TXEMPTY 0x08
#define UART_CR_TXIEN 0x04
#define UART_CR_RXRDY 0x02
#define UART_CR_RXIEN 0x01
#define DBG_UART UART0_BASE
static void
putDebugChar(unsigned ch)
{
while ((UART_CR(DBG_UART) & UART_CR_TXEMPTY) == 0) ;
UART_TXD(DBG_UART) = ch;
}
static unsigned char
getDebugChar(void)
{
while ((UART_CR(DBG_UART) & UART_CR_RXRDY) == 0) ;
return UART_RXD(DBG_UART);
}
void
uart_init(void)
{
UART_CR(DBG_UART) |= (UART_CR_RUN | UART_CR_RXIEN);
}

View File

@ -1,3 +1,19 @@
2001-12-22 Geoffrey Keating <geoffk@redhat.com>
Catherine Moore <clm@redhat.com>
Richard Henderson <rth@redhat.com>
Corinna Vinschen <vinschen@redhat.com>
* configure.host: Add support for xstormy16.
* libc/include/machine/ieeefp.h: Add support for xstormy16.
* libc/include/machine/setjmp.h: Add support for xstormy16.
* libc/include/sys/config.h: Add support for xstormy16.
* libc/machine/xstormy16/Makefile.am: New file.
* libc/machine/xstormy16/Makefile.in: New file.
* libc/machine/xstormy16/aclocal.m4: New file.
* libc/machine/xstormy16/configure: New file.
* libc/machine/xstormy16/configure.in: New file.
* libc/machine/xstormy16/setjmp.S: New file.
2001-12-19 Thomas Fitzsimmons <fitzsim@redhat.com>
* libm/machine/configure.in (HAVE_LIBM_MACHINE_DIR): New conditional.

View File

@ -189,6 +189,9 @@ case "${host_cpu}" in
w65*)
machine_dir=w65
;;
xstormy16)
machine_dir=xstormy16
;;
z8k)
machine_dir=z8k
;;
@ -530,6 +533,10 @@ case "${host}" in
syscall_dir=syscalls
newlib_cflags="${newlib_cflags} -DSMALL_DTOA -DSMALL_MEMORY"
;;
xstormy16-*-*)
newlib_cflags="${newlib_cflags} -DHAVE_GETTIMEOFDAY"
syscall_dir=syscalls
;;
z8k-*-*)
syscall_dir=syscalls
;;

View File

@ -186,6 +186,11 @@
#define __IEEE_BIG_ENDIAN
#endif
#ifdef __xstormy16__
#define __IEEE_LITTLE_ENDIAN
#define __SMALL_BITFIELDS
#endif
#ifndef __IEEE_BIG_ENDIAN
#ifndef __IEEE_LITTLE_ENDIAN

View File

@ -151,6 +151,11 @@ typedef int jmp_buf[_JBLEN];
#define _JBTYPE unsigned long
#endif
#ifdef __xstormy16__
/* 4 GPRs plus SP plus PC. */
#define _JBLEN 8
#endif
#ifdef _JBLEN
#ifdef _JBTYPE
typedef _JBTYPE jmp_buf[_JBLEN];

View File

@ -110,6 +110,19 @@
#endif
#endif
#ifdef __xstormy16__
#define __IEEE_LITTLE_ENDIAN
#define __SMALL_BITFIELDS
#undef INT_MAX
#undef UINT_MAX
#define INT_MAX __INT_MAX__
#define UINT_MAX (__INT_MAX__ * 2U + 1)
#define SIZE_T_SMALLER_THAN_LONG
#define MALLOC_ALIGNMENT 8
#define _POINTER_INT short
#define __BUFSIZ__ 16
#endif
#if INT_MAX == 32767
typedef long int __int32_t;
typedef unsigned long int __uint32_t;

View File

@ -0,0 +1,14 @@
## Process this file with automake to generate Makefile.in
AUTOMAKE_OPTIONS = cygnus
# hack: putting $(newlib_basedir)/libm/common into INCLUDES forces automake
# to output a definition for newlib_basedir.
INCLUDES = -I $(newlib_basedir)/libm/common $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS)
noinst_LIBRARIES = lib.a
lib_a_SOURCES = setjmp.S
ACLOCAL_AMFLAGS = -I ../../..
CONFIG_STATUS_DEPENDENCIES = $(newlib_basedir)/configure.host

View File

@ -0,0 +1,320 @@
# Makefile.in generated automatically by automake 1.4 from Makefile.am
# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
SHELL = @SHELL@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
sbindir = @sbindir@
libexecdir = @libexecdir@
datadir = @datadir@
sysconfdir = @sysconfdir@
sharedstatedir = @sharedstatedir@
localstatedir = @localstatedir@
libdir = @libdir@
infodir = @infodir@
mandir = @mandir@
includedir = @includedir@
oldincludedir = /usr/include
DESTDIR =
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = .
ACLOCAL = @ACLOCAL@
AUTOCONF = @AUTOCONF@
AUTOMAKE = @AUTOMAKE@
AUTOHEADER = @AUTOHEADER@
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
INSTALL_DATA = @INSTALL_DATA@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
transform = @program_transform_name@
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
host_alias = @host_alias@
host_triplet = @host@
AR = @AR@
AS = @AS@
CC = @CC@
CPP = @CPP@
EXEEXT = @EXEEXT@
MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
NEWLIB_CFLAGS = @NEWLIB_CFLAGS@
PACKAGE = @PACKAGE@
RANLIB = @RANLIB@
VERSION = @VERSION@
machine_dir = @machine_dir@
newlib_basedir = @newlib_basedir@
sys_dir = @sys_dir@
AUTOMAKE_OPTIONS = cygnus
# hack: putting $(newlib_basedir)/libm/common into INCLUDES forces automake
# to output a definition for newlib_basedir.
INCLUDES = -I $(newlib_basedir)/libm/common $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS)
noinst_LIBRARIES = lib.a
lib_a_SOURCES = setjmp.S
ACLOCAL_AMFLAGS = -I ../../..
CONFIG_STATUS_DEPENDENCIES = $(newlib_basedir)/configure.host
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
mkinstalldirs = $(SHELL) $(top_srcdir)/../../../../mkinstalldirs
CONFIG_CLEAN_FILES =
LIBRARIES = $(noinst_LIBRARIES)
DEFS = @DEFS@ -I. -I$(srcdir)
CPPFLAGS = @CPPFLAGS@
LDFLAGS = @LDFLAGS@
LIBS = @LIBS@
lib_a_LIBADD =
lib_a_OBJECTS = setjmp.o
CFLAGS = @CFLAGS@
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
DIST_COMMON = Makefile.am Makefile.in aclocal.m4 configure configure.in
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
TAR = gtar
GZIP_ENV = --best
SOURCES = $(lib_a_SOURCES)
OBJECTS = $(lib_a_OBJECTS)
all: all-redirect
.SUFFIXES:
.SUFFIXES: .S .c .o .s
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
cd $(top_srcdir) && $(AUTOMAKE) --cygnus Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
cd $(top_builddir) \
&& CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ configure.in \
../../../acinclude.m4 ../../../aclocal.m4
cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
$(SHELL) ./config.status --recheck
$(srcdir)/configure: @MAINTAINER_MODE_TRUE@$(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES)
cd $(srcdir) && $(AUTOCONF)
mostlyclean-noinstLIBRARIES:
clean-noinstLIBRARIES:
-test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
distclean-noinstLIBRARIES:
maintainer-clean-noinstLIBRARIES:
.c.o:
$(COMPILE) -c $<
.s.o:
$(COMPILE) -c $<
.S.o:
$(COMPILE) -c $<
mostlyclean-compile:
-rm -f *.o core *.core
clean-compile:
distclean-compile:
-rm -f *.tab.c
maintainer-clean-compile:
lib.a: $(lib_a_OBJECTS) $(lib_a_DEPENDENCIES)
-rm -f lib.a
$(AR) cru lib.a $(lib_a_OBJECTS) $(lib_a_LIBADD)
$(RANLIB) lib.a
tags: TAGS
ID: $(HEADERS) $(SOURCES) $(LISP)
list='$(SOURCES) $(HEADERS)'; \
unique=`for i in $$list; do echo $$i; done | \
awk ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
here=`pwd` && cd $(srcdir) \
&& mkid -f$$here/ID $$unique $(LISP)
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS)'; \
unique=`for i in $$list; do echo $$i; done | \
awk ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
|| (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS)
mostlyclean-tags:
clean-tags:
distclean-tags:
-rm -f TAGS ID
maintainer-clean-tags:
distdir = $(PACKAGE)-$(VERSION)
top_distdir = $(distdir)
# This target untars the dist file and tries a VPATH configuration. Then
# it guarantees that the distribution is self-contained by making another
# tarfile.
distcheck: dist
-rm -rf $(distdir)
GZIP=$(GZIP_ENV) $(TAR) zxf $(distdir).tar.gz
mkdir $(distdir)/=build
mkdir $(distdir)/=inst
dc_install_base=`cd $(distdir)/=inst && pwd`; \
cd $(distdir)/=build \
&& ../configure --srcdir=.. --prefix=$$dc_install_base \
&& $(MAKE) $(AM_MAKEFLAGS) \
&& $(MAKE) $(AM_MAKEFLAGS) dvi \
&& $(MAKE) $(AM_MAKEFLAGS) check \
&& $(MAKE) $(AM_MAKEFLAGS) install \
&& $(MAKE) $(AM_MAKEFLAGS) installcheck \
&& $(MAKE) $(AM_MAKEFLAGS) dist
-rm -rf $(distdir)
@banner="$(distdir).tar.gz is ready for distribution"; \
dashes=`echo "$$banner" | sed s/./=/g`; \
echo "$$dashes"; \
echo "$$banner"; \
echo "$$dashes"
dist: distdir
-chmod -R a+r $(distdir)
GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir)
-rm -rf $(distdir)
dist-all: distdir
-chmod -R a+r $(distdir)
GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir)
-rm -rf $(distdir)
distdir: $(DISTFILES)
-rm -rf $(distdir)
mkdir $(distdir)
-chmod 777 $(distdir)
@for file in $(DISTFILES); do \
if test -f $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
cp -pr $$d/$$file $(distdir)/$$file; \
else \
test -f $(distdir)/$$file \
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|| cp -p $$d/$$file $(distdir)/$$file || :; \
fi; \
done
info-am:
info: info-am
dvi-am:
dvi: dvi-am
check-am:
check: check-am
installcheck-am:
installcheck: installcheck-am
install-info-am:
install-info: install-info-am
install-exec-am:
install-exec: install-exec-am
install-data-am:
install-data: install-data-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
install: install-am
uninstall-am:
uninstall: uninstall-am
all-am: Makefile $(LIBRARIES)
all-redirect: all-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
installdirs:
mostlyclean-generic:
clean-generic:
distclean-generic:
-rm -f Makefile $(CONFIG_CLEAN_FILES)
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
maintainer-clean-generic:
mostlyclean-am: mostlyclean-noinstLIBRARIES mostlyclean-compile \
mostlyclean-tags mostlyclean-generic
mostlyclean: mostlyclean-am
clean-am: clean-noinstLIBRARIES clean-compile clean-tags clean-generic \
mostlyclean-am
clean: clean-am
distclean-am: distclean-noinstLIBRARIES distclean-compile \
distclean-tags distclean-generic clean-am
distclean: distclean-am
-rm -f config.status
maintainer-clean-am: maintainer-clean-noinstLIBRARIES \
maintainer-clean-compile maintainer-clean-tags \
maintainer-clean-generic distclean-am
@echo "This command is intended for maintainers to use;"
@echo "it deletes files that may require special tools to rebuild."
maintainer-clean: maintainer-clean-am
-rm -f config.status
.PHONY: mostlyclean-noinstLIBRARIES distclean-noinstLIBRARIES \
clean-noinstLIBRARIES maintainer-clean-noinstLIBRARIES \
mostlyclean-compile distclean-compile clean-compile \
maintainer-clean-compile tags mostlyclean-tags distclean-tags \
clean-tags maintainer-clean-tags distdir info-am info dvi-am dvi check \
check-am installcheck-am installcheck install-info-am install-info \
install-exec-am install-exec install-data-am install-data install-am \
install uninstall-am uninstall all-redirect all-am all installdirs \
mostlyclean-generic distclean-generic clean-generic \
maintainer-clean-generic clean mostlyclean distclean maintainer-clean
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

291
newlib/libc/machine/xstormy16/aclocal.m4 vendored Normal file
View File

@ -0,0 +1,291 @@
dnl aclocal.m4 generated automatically by aclocal 1.4
dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
dnl This program is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
dnl PARTICULAR PURPOSE.
dnl This provides configure definitions used by all the newlib
dnl configure.in files.
dnl Basic newlib configury. This calls basic introductory stuff,
dnl including AM_INIT_AUTOMAKE and AC_CANONICAL_HOST. It also runs
dnl configure.host. The only argument is the relative path to the top
dnl newlib directory.
AC_DEFUN(NEWLIB_CONFIGURE,
[
dnl Default to --enable-multilib
AC_ARG_ENABLE(multilib,
[ --enable-multilib build many library versions (default)],
[case "${enableval}" in
yes) multilib=yes ;;
no) multilib=no ;;
*) AC_MSG_ERROR(bad value ${enableval} for multilib option) ;;
esac], [multilib=yes])dnl
dnl Support --enable-target-optspace
AC_ARG_ENABLE(target-optspace,
[ --enable-target-optspace optimize for space],
[case "${enableval}" in
yes) target_optspace=yes ;;
no) target_optspace=no ;;
*) AC_MSG_ERROR(bad value ${enableval} for target-optspace option) ;;
esac], [target_optspace=])dnl
dnl Support --enable-malloc-debugging - currently only supported for Cygwin
AC_ARG_ENABLE(malloc-debugging,
[ --enable-malloc-debugging indicate malloc debugging requested],
[case "${enableval}" in
yes) malloc_debugging=yes ;;
no) malloc_debugging=no ;;
*) AC_MSG_ERROR(bad value ${enableval} for malloc-debugging option) ;;
esac], [malloc_debugging=])dnl
dnl Support --enable-newlib-mb
AC_ARG_ENABLE(newlib-mb,
[ --enable-newlib-mb enable multibyte support],
[case "${enableval}" in
yes) newlib_mb=yes ;;
no) newlib_mb=no ;;
*) AC_MSG_ERROR(bad value ${enableval} for newlib-mb option) ;;
esac], [newlib_mb=no])dnl
dnl We may get other options which we don't document:
dnl --with-target-subdir, --with-multisrctop, --with-multisubdir
test -z "[$]{with_target_subdir}" && with_target_subdir=.
if test "[$]{srcdir}" = "."; then
if test "[$]{with_target_subdir}" != "."; then
newlib_basedir="[$]{srcdir}/[$]{with_multisrctop}../$1"
else
newlib_basedir="[$]{srcdir}/[$]{with_multisrctop}$1"
fi
else
newlib_basedir="[$]{srcdir}/$1"
fi
AC_SUBST(newlib_basedir)
AC_CANONICAL_HOST
AM_INIT_AUTOMAKE(newlib, 1.9.0)
# FIXME: We temporarily define our own version of AC_PROG_CC. This is
# copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We
# are probably using a cross compiler, which will not be able to fully
# link an executable. This should really be fixed in autoconf
# itself.
AC_DEFUN(LIB_AC_PROG_CC,
[AC_BEFORE([$0], [AC_PROG_CPP])dnl
AC_CHECK_PROG(CC, gcc, gcc)
if test -z "$CC"; then
AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc)
test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH])
fi
AC_PROG_CC_GNU
if test $ac_cv_prog_gcc = yes; then
GCC=yes
dnl Check whether -g works, even if CFLAGS is set, in case the package
dnl plays around with CFLAGS (such as to build both debugging and
dnl normal versions of a library), tasteless as that idea is.
ac_test_CFLAGS="${CFLAGS+set}"
ac_save_CFLAGS="$CFLAGS"
CFLAGS=
AC_PROG_CC_G
if test "$ac_test_CFLAGS" = set; then
CFLAGS="$ac_save_CFLAGS"
elif test $ac_cv_prog_cc_g = yes; then
CFLAGS="-g -O2"
else
CFLAGS="-O2"
fi
else
GCC=
test "${CFLAGS+set}" = set || CFLAGS="-g"
fi
])
LIB_AC_PROG_CC
# AC_CHECK_TOOL does AC_REQUIRE (AC_CANONICAL_BUILD). If we don't
# run it explicitly here, it will be run implicitly before
# NEWLIB_CONFIGURE, which doesn't work because that means that it will
# be run before AC_CANONICAL_HOST.
AC_CANONICAL_BUILD
AC_CHECK_TOOL(AS, as)
AC_CHECK_TOOL(AR, ar)
AC_CHECK_TOOL(RANLIB, ranlib, :)
AC_PROG_INSTALL
AM_MAINTAINER_MODE
# We need AC_EXEEXT to keep automake happy in cygnus mode. However,
# at least currently, we never actually build a program, so we never
# need to use $(EXEEXT). Moreover, the test for EXEEXT normally
# fails, because we are probably configuring with a cross compiler
# which can't create executables. So we include AC_EXEEXT to keep
# automake happy, but we don't execute it, since we don't care about
# the result.
if false; then
AC_EXEEXT
fi
. [$]{newlib_basedir}/configure.host
case [$]{newlib_basedir} in
/* | [A-Za-z]:[/\\]*) newlib_flagbasedir=[$]{newlib_basedir} ;;
*) newlib_flagbasedir='[$](top_builddir)/'[$]{newlib_basedir} ;;
esac
newlib_cflags="[$]{newlib_cflags} -I"'[$](top_builddir)'"/$1/targ-include -I[$]{newlib_flagbasedir}/libc/include"
case "${host}" in
*-*-cygwin*)
newlib_cflags="[$]{newlib_cflags} -I[$]{newlib_flagbasedir}/../winsup/cygwin/include -I[$]{newlib_flagbasedir}/../winsup/w32api/include"
;;
esac
newlib_cflags="[$]{newlib_cflags} -fno-builtin"
NEWLIB_CFLAGS=${newlib_cflags}
AC_SUBST(NEWLIB_CFLAGS)
AC_SUBST(machine_dir)
AC_SUBST(sys_dir)
])
# Do all the work for Automake. This macro actually does too much --
# some checks are only needed if your package does certain things.
# But this isn't really a big deal.
# serial 1
dnl Usage:
dnl AM_INIT_AUTOMAKE(package,version, [no-define])
AC_DEFUN(AM_INIT_AUTOMAKE,
[AC_REQUIRE([AC_PROG_INSTALL])
PACKAGE=[$1]
AC_SUBST(PACKAGE)
VERSION=[$2]
AC_SUBST(VERSION)
dnl test to see if srcdir already configured
if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
fi
ifelse([$3],,
AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package]))
AC_REQUIRE([AM_SANITY_CHECK])
AC_REQUIRE([AC_ARG_PROGRAM])
dnl FIXME This is truly gross.
missing_dir=`cd $ac_aux_dir && pwd`
AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
AC_REQUIRE([AC_PROG_MAKE_SET])])
#
# Check to make sure that the build environment is sane.
#
AC_DEFUN(AM_SANITY_CHECK,
[AC_MSG_CHECKING([whether build environment is sane])
# Just in case
sleep 1
echo timestamp > conftestfile
# Do `set' in a subshell so we don't clobber the current shell's
# arguments. Must try -L first in case configure is actually a
# symlink; some systems play weird games with the mod time of symlinks
# (eg FreeBSD returns the mod time of the symlink's containing
# directory).
if (
set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
if test "[$]*" = "X"; then
# -L didn't work.
set X `ls -t $srcdir/configure conftestfile`
fi
if test "[$]*" != "X $srcdir/configure conftestfile" \
&& test "[$]*" != "X conftestfile $srcdir/configure"; then
# If neither matched, then we have a broken ls. This can happen
# if, for instance, CONFIG_SHELL is bash and it inherits a
# broken ls alias from the environment. This has actually
# happened. Such a system could not be considered "sane".
AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
alias in your environment])
fi
test "[$]2" = conftestfile
)
then
# Ok.
:
else
AC_MSG_ERROR([newly created file is older than distributed files!
Check your system clock])
fi
rm -f conftest*
AC_MSG_RESULT(yes)])
dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
dnl The program must properly implement --version.
AC_DEFUN(AM_MISSING_PROG,
[AC_MSG_CHECKING(for working $2)
# Run test in a subshell; some versions of sh will print an error if
# an executable is not found, even if stderr is redirected.
# Redirect stdin to placate older versions of autoconf. Sigh.
if ($2 --version) < /dev/null > /dev/null 2>&1; then
$1=$2
AC_MSG_RESULT(found)
else
$1="$3/missing $2"
AC_MSG_RESULT(missing)
fi
AC_SUBST($1)])
# Add --enable-maintainer-mode option to configure.
# From Jim Meyering
# serial 1
AC_DEFUN(AM_MAINTAINER_MODE,
[AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
dnl maintainer-mode is disabled by default
AC_ARG_ENABLE(maintainer-mode,
[ --enable-maintainer-mode enable make rules and dependencies not useful
(and sometimes confusing) to the casual installer],
USE_MAINTAINER_MODE=$enableval,
USE_MAINTAINER_MODE=no)
AC_MSG_RESULT($USE_MAINTAINER_MODE)
AM_CONDITIONAL(MAINTAINER_MODE, test $USE_MAINTAINER_MODE = yes)
MAINT=$MAINTAINER_MODE_TRUE
AC_SUBST(MAINT)dnl
]
)
# Define a conditional.
AC_DEFUN(AM_CONDITIONAL,
[AC_SUBST($1_TRUE)
AC_SUBST($1_FALSE)
if $2; then
$1_TRUE=
$1_FALSE='#'
else
$1_TRUE='#'
$1_FALSE=
fi])

1701
newlib/libc/machine/xstormy16/configure vendored Executable file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,12 @@
dnl This is the newlib/libc/machine/calmrisc16 configure.in file.
dnl Process this file with autoconf to produce a configure script.
AC_PREREQ(2.5)
AC_INIT(setjmp.S)
dnl Can't be done in NEWLIB_CONFIGURE because that confuses automake.
AC_CONFIG_AUX_DIR(../../../..)
NEWLIB_CONFIGURE(../../..)
AC_OUTPUT(Makefile)

View File

@ -0,0 +1,57 @@
;; xstormy16
;; Copyright (C) 2001 by Red Hat, Incorporated. All rights reserved.
;;
;; Permission to use, copy, modify, and distribute this software
;; is freely granted, provided that this notice is preserved.
;;
.file "setjmp.S"
.section .text
.align 1
.global setjmp
.type setjmp,@function
setjmp:
mov r0,r10
mov (r2++),r0
mov r0,r11
mov (r2++),r0
mov r0,r12
mov (r2++),r0
mov r0,r13
mov (r2++),r0
pop r0 ; PC high word
pop r1 ; PC low word
mov (r2++), r0
mov (r2++), r1
mov r3,sp
mov (r2++),r3
mov.w r2,#0
mov r8, r0
mov r9, r1
jmp r8, r9
.size setjmp,.-setjmp
.global longjmp
.type longjmp,@function
longjmp:
mov r0,(r2++)
mov r10,r0
mov r0,(r2++)
mov r11,r0
mov r0,(r2++)
mov r12,r0
mov r0,(r2++)
mov r13,r0
mov r0,(r2++)
mov r8, r0
mov r1,(r2++)
mov r9, r1
mov r4,(r2++)
mov sp,r4
;; status arg (r3) to longjmp is return value
;; if it's zero, return 1
bnz r3, #0, 0f
mov.w r3,#1
0: mov r2, r3
jmp r8,r9
.size longjmp,.-longjmp