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:
@@ -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
17
libgloss/configure
vendored
@@ -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
|
||||
|
@@ -88,6 +88,9 @@ case "${target}" in
|
||||
mcore-*-*)
|
||||
configdirs="${configdirs} mcore testsuite"
|
||||
;;
|
||||
xstormy16-*-*)
|
||||
configdirs="${configdirs} xstormy16 testsuite"
|
||||
;;
|
||||
esac
|
||||
|
||||
# temporarily strip out testsuite
|
||||
|
55
libgloss/libnosys/configure
vendored
55
libgloss/libnosys/configure
vendored
@@ -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
|
||||
|
@@ -121,6 +121,8 @@ case "${target}" in
|
||||
;;
|
||||
w65-*-*)
|
||||
;;
|
||||
xstormy16-*-*)
|
||||
;;
|
||||
z8k-*-*)
|
||||
;;
|
||||
*)
|
||||
|
130
libgloss/xstormy16/Makefile.in
Normal file
130
libgloss/xstormy16/Makefile.in
Normal 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
|
25
libgloss/xstormy16/close.c
Normal file
25
libgloss/xstormy16/close.c
Normal 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
1219
libgloss/xstormy16/configure
vendored
Executable file
File diff suppressed because it is too large
Load Diff
75
libgloss/xstormy16/configure.in
Normal file
75
libgloss/xstormy16/configure.in
Normal 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
94
libgloss/xstormy16/crt0.s
Normal 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
|
178
libgloss/xstormy16/crt0_stub.s
Normal file
178
libgloss/xstormy16/crt0_stub.s
Normal 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
|
||||
|
||||
|
9
libgloss/xstormy16/crti.s
Normal file
9
libgloss/xstormy16/crti.s
Normal file
@@ -0,0 +1,9 @@
|
||||
.section .init,"ax"
|
||||
.align 1
|
||||
.globl _init
|
||||
_init:
|
||||
|
||||
.section .fini,"ax"
|
||||
.align 1
|
||||
.globl _fini
|
||||
_fini:
|
5
libgloss/xstormy16/crtn.s
Normal file
5
libgloss/xstormy16/crtn.s
Normal file
@@ -0,0 +1,5 @@
|
||||
.section .init,"ax"
|
||||
ret
|
||||
|
||||
.section .fini,"ax"
|
||||
ret
|
78
libgloss/xstormy16/eva_app.c
Normal file
78
libgloss/xstormy16/eva_app.c
Normal 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) */
|
||||
}
|
||||
}
|
128
libgloss/xstormy16/eva_app.ld
Normal file
128
libgloss/xstormy16/eva_app.ld
Normal 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 . */
|
||||
}
|
129
libgloss/xstormy16/eva_stub.ld
Normal file
129
libgloss/xstormy16/eva_stub.ld
Normal 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 . */
|
||||
}
|
30
libgloss/xstormy16/fstat.c
Normal file
30
libgloss/xstormy16/fstat.c
Normal 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);
|
||||
}
|
25
libgloss/xstormy16/getpid.c
Normal file
25
libgloss/xstormy16/getpid.c
Normal 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
28
libgloss/xstormy16/kill.c
Normal 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;
|
||||
}
|
31
libgloss/xstormy16/lseek.c
Normal file
31
libgloss/xstormy16/lseek.c
Normal 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
31
libgloss/xstormy16/open.c
Normal 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
55
libgloss/xstormy16/sbrk.c
Normal 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
|
||||
}
|
132
libgloss/xstormy16/sim_high.ld
Normal file
132
libgloss/xstormy16/sim_high.ld
Normal 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
30
libgloss/xstormy16/stat.c
Normal 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);
|
||||
}
|
||||
|
162
libgloss/xstormy16/syscalls.S
Normal file
162
libgloss/xstormy16/syscalls.S
Normal 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
|
40
libgloss/xstormy16/syscalls.m4
Normal file
40
libgloss/xstormy16/syscalls.m4
Normal 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
|
28
libgloss/xstormy16/unlink.c
Normal file
28
libgloss/xstormy16/unlink.c
Normal 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);
|
||||
}
|
837
libgloss/xstormy16/xstormy16_stub.c
Normal file
837
libgloss/xstormy16/xstormy16_stub.c
Normal 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, ®isters);
|
||||
|
||||
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, ®isters.pc, 4);
|
||||
ptr = putreg (ptr, FP, ®isters.r[FP], 2);
|
||||
ptr = putreg (ptr, SP, ®isters.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)®isters, NUMREGBYTES);
|
||||
else if (kind == 'P')
|
||||
{
|
||||
/* set the value of a single CPU register - return OK */
|
||||
unsigned long regno;
|
||||
|
||||
if (hexToInt (&ptr, ®no)
|
||||
&& *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)®isters, 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 (®isters, &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);
|
||||
}
|
||||
|
Reference in New Issue
Block a user