Kaushik Phatak  kaushik.phatak@kpitcummins.com

        * configure.in: Add CR16 support.
        * configure: Regenerated.
        * cr16/aclocal.m4: New.
        * cr16/close.c: New.
        * cr16/configure: New.
        * cr16/configure.in: New.
        * cr16/crt1.S: New.
        * cr16/crti.S: New.
        * cr16/crtn.S: New.
        * cr16/dvz_hndl.c: New.
        * cr16/_exit.c: New.
        * cr16/flg_hndl.c: New.
        * cr16/fstat.c: New.
        * cr16/_getenv.c: New.
        * cr16/getpid.c: New.
        * cr16/iad_hndl.c: New.
        * cr16/intable.c: New.
        * cr16/isatty.c: New.
        * cr16/kill.c: New.
        * cr16/lseek.c: New.
        * cr16/Makefile.in: New.
        * cr16/open.c: New.
        * cr16/putnum.c: New.
        * cr16/read.c: New.
        * cr16/_rename.c: New.
        * cr16/sbrk.c: New.
        * cr16/sim.ld: New.
        * cr16/stat.c: New.
        * cr16/svc_hndl.c: New.
        * cr16/time.c: New.
        * cr16/und_hndl.c: New.
        * cr16/unlink.c: New.
        * cr16/write.c: New.
This commit is contained in:
Jeff Johnston 2010-12-02 19:35:47 +00:00
parent 874a87f8cd
commit 8ae0b98903
34 changed files with 5633 additions and 0 deletions

View File

@ -1,3 +1,40 @@
2010-12-02 Jayant Sonar jayant.sonar@kpitcummins.com
Kaushik Phatak kaushik.phatak@kpitcummins.com
* configure.in: Add CR16 support.
* configure: Regenerated.
* cr16/aclocal.m4: New.
* cr16/close.c: New.
* cr16/configure: New.
* cr16/configure.in: New.
* cr16/crt1.S: New.
* cr16/crti.S: New.
* cr16/crtn.S: New.
* cr16/dvz_hndl.c: New.
* cr16/_exit.c: New.
* cr16/flg_hndl.c: New.
* cr16/fstat.c: New.
* cr16/_getenv.c: New.
* cr16/getpid.c: New.
* cr16/iad_hndl.c: New.
* cr16/intable.c: New.
* cr16/isatty.c: New.
* cr16/kill.c: New.
* cr16/lseek.c: New.
* cr16/Makefile.in: New.
* cr16/open.c: New.
* cr16/putnum.c: New.
* cr16/read.c: New.
* cr16/_rename.c: New.
* cr16/sbrk.c: New.
* cr16/sim.ld: New.
* cr16/stat.c: New.
* cr16/svc_hndl.c: New.
* cr16/time.c: New.
* cr16/und_hndl.c: New.
* cr16/unlink.c: New.
* cr16/write.c: New.
2010-11-17 Bernd Schmidt <bernds@codesourcery.com>
* tic6x/syscalls.c (cio_getclk_to_host, cio_getclk_from_host): New

5
libgloss/configure vendored
View File

@ -714,6 +714,7 @@ rs6000
mn10200
mn10300
bfin
cr16
cris
crx
d30v
@ -2488,6 +2489,10 @@ case "${target}" in
subdirs="$subdirs bfin"
;;
cr16-*-*)
subdirs="$subdirs cr16"
;;
cris-*-* | crisv32-*-*)
subdirs="$subdirs cris"

View File

@ -73,6 +73,9 @@ case "${target}" in
bfin-*-*)
AC_CONFIG_SUBDIRS([bfin])
;;
cr16-*-*)
AC_CONFIG_SUBDIRS([cr16])
;;
cris-*-* | crisv32-*-*)
AC_CONFIG_SUBDIRS([cris])
;;

156
libgloss/cr16/Makefile.in Normal file
View File

@ -0,0 +1,156 @@
#
#
DESTDIR =
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@
OBJDUMP = `if [ -f ${objroot}/../binutils/objdump ] ; \
then echo ${objroot}/../binutils/objdump ; \
else t='$(program_transform_name)'; echo objdump | sed -e $$t ; fi`
OBJCOPY = `if [ -f ${objroot}/../binutils/objcopy ] ; \
then echo ${objroot}/../binutils/objcopy ; \
else t='$(program_transform_name)'; echo objcopy | sed -e $$t ; fi`
# Here is all of the handlers stuff
H_SCRIPTS =
H_BSP = libh.a
H_OBJS = intable.o dvz_hndl.o flg_hndl.o iad_hndl.o svc_hndl.o und_hndl.o
H_TEST = hndl-test
H_INSTALL = install-hndl
# Here is all of the simulator stuff
SIM_SCRIPTS = sim.ld
SIM_BSP = libsim.a
SIM_OBJS = _exit.o close.o _getenv.o lseek.o open.o read.o \
_rename.o sbrk.o time.o unlink.o write.o \
stat.o putnum.o kill.o getpid.o isatty.o fstat.o
SIM_TEST = sim-test
SIM_INSTALL = install-sim
# Here is all of the CRT stuff
CRT = crti.o crtn.o crt1.o
CRT_INSTALL = install-crt
# 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: ${CRT} ${SIM_BSP} ${H_BSP}
#
# here's where we build the board support packages for each target
#
${H_BSP}: ${H_OBJS}
${AR} ${ARFLAGS} ${H_BSP} ${H_OBJS}
${RANLIB} ${H_BSP}
${SIM_BSP}: ${SIM_OBJS}
${AR} ${ARFLAGS} ${SIM_BSP} ${SIM_OBJS}
${RANLIB} ${SIM_BSP}
#
# here's where we build the test programs for each target
#
.PHONY: test
test: ${SIM_TEST} ${H_TEST}
hndl-test: hndl-test.x hndl-test.dis
hndl-test.x: test.o ${H_BSP}
${CC} ${LDFLAGS_FOR_TARGET} -L${objdir} \
test.o \
-o hndl-test.x ${LIBS_FOR_TARGET} -lc ${H_BSP} -Wl,-T${SIM_SCRIPTS}
hndl-test.dis: hndl-test.x
${OBJDUMP} -d hndl-test.x > hndl-test.dis
sim-test: sim-test.x sim-test.dis
sim-test.x: test.o ${SIM_BSP}
${CC} ${LDFLAGS_FOR_TARGET} -L${objdir} \
test.o \
-o sim-test.x ${LIBS_FOR_TARGET} -lc ${SIM_BSP} -Wl,-T${SIM_SCRIPTS}
sim-test.dis: sim-test.x
${OBJDUMP} -d sim-test.x > sim-test.dis
#
#
#
.c.S:
${CC} ${CFLAGS_FOR_TARGET} -c $<
clean mostlyclean:
rm -f a.out core *.i *.o *-test *.srec *.dis *.x $(SIM_BSP) $(H_BSP)
distclean maintainer-clean realclean: clean
rm -f Makefile config.status *~
.PHONY: install info install-info clean-info
install: ${CRT_INSTALL} ${SIM_INSTALL} ${H_INSTALL}
install-crt:
set -e; for x in ${CRT} ; do\
${INSTALL_DATA} $$x $(DESTDIR)${tooldir}/lib${MULTISUBDIR}/$$x; \
done
install-sim:
for x in ${SIM_BSP} ; do\
${INSTALL_PROGRAM} $${x} $(DESTDIR)${tooldir}/lib${MULTISUBDIR}/$$x; \
done
for x in ${SIM_SCRIPTS}; do\
${INSTALL_DATA} ${srcdir}/$${x} $(DESTDIR)${tooldir}/lib${MULTISUBDIR}/$$x; \
done
install-hndl:
for x in ${H_BSP}; do\
${INSTALL_PROGRAM} $${x} $(DESTDIR)${tooldir}/lib${MULTISUBDIR}/$$x; \
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

23
libgloss/cr16/_exit.c Normal file
View File

@ -0,0 +1,23 @@
/* _exit.c -- Implementation of the low-level _exit() routine
*
* Copyright (c) 2004 National Semiconductor Corporation
*
* 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 <stdlib.h>
#include <sys/syscall.h>
/* Returns control to the debugger. */
void _exit (int stat)
{
HOST_SERVICE (SVC_EOP);
}

36
libgloss/cr16/_getenv.c Normal file
View File

@ -0,0 +1,36 @@
/* _getenv.c -- Implementation of the low-level _getenv() routine
*
* Copyright (c) 2004 National Semiconductor Corporation
*
* 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/syscall.h>
#include <stdlib.h>
register char *R2 __asm__("r2");
register char *R3 __asm__("r3");
char * _getenv (const char *name)
{
char *x;
char *y;
x = R2;
y = (char *) calloc (256, 1);
R3 = y;
R2 = x;
HOST_SERVICE (SVC_GETENV);
}

21
libgloss/cr16/_rename.c Normal file
View File

@ -0,0 +1,21 @@
/* _rename.c -- Implementation of the low-level rename() routine
*
* Copyright (c) 2004 National Semiconductor Corporation
*
* 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/syscall.h>
int _rename (char *from, char *to)
{
HOST_SERVICE (SVC_RENAME);
}

404
libgloss/cr16/aclocal.m4 vendored Normal file
View File

@ -0,0 +1,404 @@
# generated automatically by aclocal 1.11.1 -*- Autoconf -*-
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
# 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
# This file 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.
# AM_CONDITIONAL -*- Autoconf -*-
# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008
# Free Software Foundation, Inc.
#
# This file 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.
# serial 9
# AM_CONDITIONAL(NAME, SHELL-CONDITION)
# -------------------------------------
# Define a conditional.
AC_DEFUN([AM_CONDITIONAL],
[AC_PREREQ(2.52)dnl
ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])],
[$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
AC_SUBST([$1_TRUE])dnl
AC_SUBST([$1_FALSE])dnl
_AM_SUBST_NOTMAKE([$1_TRUE])dnl
_AM_SUBST_NOTMAKE([$1_FALSE])dnl
m4_define([_AM_COND_VALUE_$1], [$2])dnl
if $2; then
$1_TRUE=
$1_FALSE='#'
else
$1_TRUE='#'
$1_FALSE=
fi
AC_CONFIG_COMMANDS_PRE(
[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
AC_MSG_ERROR([[conditional "$1" was never defined.
Usually this means the macro was only invoked conditionally.]])
fi])])
# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009
# Free Software Foundation, Inc.
#
# This file 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.
# serial 10
# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
# written in clear, in which case automake, when reading aclocal.m4,
# will think it sees a *use*, and therefore will trigger all it's
# C support machinery. Also note that it means that autoscan, seeing
# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
# _AM_DEPENDENCIES(NAME)
# ----------------------
# See how the compiler implements dependency checking.
# NAME is "CC", "CXX", "GCJ", or "OBJC".
# We try a few techniques and use that to set a single cache variable.
#
# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
# dependency, and given that the user is not expected to run this macro,
# just rely on AC_PROG_CC.
AC_DEFUN([_AM_DEPENDENCIES],
[AC_REQUIRE([AM_SET_DEPDIR])dnl
AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
AC_REQUIRE([AM_MAKE_INCLUDE])dnl
AC_REQUIRE([AM_DEP_TRACK])dnl
ifelse([$1], CC, [depcc="$CC" am_compiler_list=],
[$1], CXX, [depcc="$CXX" am_compiler_list=],
[$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
[$1], UPC, [depcc="$UPC" am_compiler_list=],
[$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'],
[depcc="$$1" am_compiler_list=])
AC_CACHE_CHECK([dependency style of $depcc],
[am_cv_$1_dependencies_compiler_type],
[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
# We make a subdir and do the tests there. Otherwise we can end up
# making bogus files that we don't know about and never remove. For
# instance it was reported that on HP-UX the gcc test will end up
# making a dummy file named `D' -- because `-MD' means `put the output
# in D'.
mkdir conftest.dir
# Copy depcomp to subdir because otherwise we won't find it if we're
# using a relative directory.
cp "$am_depcomp" conftest.dir
cd conftest.dir
# We will build objects and dependencies in a subdirectory because
# it helps to detect inapplicable dependency modes. For instance
# both Tru64's cc and ICC support -MD to output dependencies as a
# side effect of compilation, but ICC will put the dependencies in
# the current directory while Tru64 will put them in the object
# directory.
mkdir sub
am_cv_$1_dependencies_compiler_type=none
if test "$am_compiler_list" = ""; then
am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
fi
am__universal=false
m4_case([$1], [CC],
[case " $depcc " in #(
*\ -arch\ *\ -arch\ *) am__universal=true ;;
esac],
[CXX],
[case " $depcc " in #(
*\ -arch\ *\ -arch\ *) am__universal=true ;;
esac])
for depmode in $am_compiler_list; do
# Setup a source with many dependencies, because some compilers
# like to wrap large dependency lists on column 80 (with \), and
# we should not choose a depcomp mode which is confused by this.
#
# We need to recreate these files for each test, as the compiler may
# overwrite some of them when testing with obscure command lines.
# This happens at least with the AIX C compiler.
: > sub/conftest.c
for i in 1 2 3 4 5 6; do
echo '#include "conftst'$i'.h"' >> sub/conftest.c
# Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
# Solaris 8's {/usr,}/bin/sh.
touch sub/conftst$i.h
done
echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
# We check with `-c' and `-o' for the sake of the "dashmstdout"
# mode. It turns out that the SunPro C++ compiler does not properly
# handle `-M -o', and we need to detect this. Also, some Intel
# versions had trouble with output in subdirs
am__obj=sub/conftest.${OBJEXT-o}
am__minus_obj="-o $am__obj"
case $depmode in
gcc)
# This depmode causes a compiler race in universal mode.
test "$am__universal" = false || continue
;;
nosideeffect)
# after this tag, mechanisms are not by side-effect, so they'll
# only be used when explicitly requested
if test "x$enable_dependency_tracking" = xyes; then
continue
else
break
fi
;;
msvisualcpp | msvcmsys)
# This compiler won't grok `-c -o', but also, the minuso test has
# not run yet. These depmodes are late enough in the game, and
# so weak that their functioning should not be impacted.
am__obj=conftest.${OBJEXT-o}
am__minus_obj=
;;
none) break ;;
esac
if depmode=$depmode \
source=sub/conftest.c object=$am__obj \
depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
$SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
>/dev/null 2>conftest.err &&
grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
${MAKE-make} -s -f confmf > /dev/null 2>&1; then
# icc doesn't choke on unknown options, it will just issue warnings
# or remarks (even with -Werror). So we grep stderr for any message
# that says an option was ignored or not supported.
# When given -MP, icc 7.0 and 7.1 complain thusly:
# icc: Command line warning: ignoring option '-M'; no argument required
# The diagnosis changed in icc 8.0:
# icc: Command line remark: option '-MP' not supported
if (grep 'ignoring option' conftest.err ||
grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
am_cv_$1_dependencies_compiler_type=$depmode
break
fi
fi
done
cd ..
rm -rf conftest.dir
else
am_cv_$1_dependencies_compiler_type=none
fi
])
AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
AM_CONDITIONAL([am__fastdep$1], [
test "x$enable_dependency_tracking" != xno \
&& test "$am_cv_$1_dependencies_compiler_type" = gcc3])
])
# AM_SET_DEPDIR
# -------------
# Choose a directory name for dependency files.
# This macro is AC_REQUIREd in _AM_DEPENDENCIES
AC_DEFUN([AM_SET_DEPDIR],
[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
])
# AM_DEP_TRACK
# ------------
AC_DEFUN([AM_DEP_TRACK],
[AC_ARG_ENABLE(dependency-tracking,
[ --disable-dependency-tracking speeds up one-time build
--enable-dependency-tracking do not reject slow dependency extractors])
if test "x$enable_dependency_tracking" != xno; then
am_depcomp="$ac_aux_dir/depcomp"
AMDEPBACKSLASH='\'
fi
AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
AC_SUBST([AMDEPBACKSLASH])dnl
_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
])
# Generate code to set up dependency tracking. -*- Autoconf -*-
# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008
# Free Software Foundation, Inc.
#
# This file 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.
#serial 5
# _AM_OUTPUT_DEPENDENCY_COMMANDS
# ------------------------------
AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
[{
# Autoconf 2.62 quotes --file arguments for eval, but not when files
# are listed without --file. Let's play safe and only enable the eval
# if we detect the quoting.
case $CONFIG_FILES in
*\'*) eval set x "$CONFIG_FILES" ;;
*) set x $CONFIG_FILES ;;
esac
shift
for mf
do
# Strip MF so we end up with the name of the file.
mf=`echo "$mf" | sed -e 's/:.*$//'`
# Check whether this is an Automake generated Makefile or not.
# We used to match only the files named `Makefile.in', but
# some people rename them; so instead we look at the file content.
# Grep'ing the first line is not enough: some people post-process
# each Makefile.in and add a new line on top of each file to say so.
# Grep'ing the whole file is not good either: AIX grep has a line
# limit of 2048, but all sed's we know have understand at least 4000.
if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
dirpart=`AS_DIRNAME("$mf")`
else
continue
fi
# Extract the definition of DEPDIR, am__include, and am__quote
# from the Makefile without running `make'.
DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
test -z "$DEPDIR" && continue
am__include=`sed -n 's/^am__include = //p' < "$mf"`
test -z "am__include" && continue
am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
# When using ansi2knr, U may be empty or an underscore; expand it
U=`sed -n 's/^U = //p' < "$mf"`
# Find all dependency output files, they are included files with
# $(DEPDIR) in their names. We invoke sed twice because it is the
# simplest approach to changing $(DEPDIR) to its actual value in the
# expansion.
for file in `sed -n "
s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
# Make sure the directory exists.
test -f "$dirpart/$file" && continue
fdir=`AS_DIRNAME(["$file"])`
AS_MKDIR_P([$dirpart/$fdir])
# echo "creating $dirpart/$file"
echo '# dummy' > "$dirpart/$file"
done
done
}
])# _AM_OUTPUT_DEPENDENCY_COMMANDS
# AM_OUTPUT_DEPENDENCY_COMMANDS
# -----------------------------
# This macro should only be invoked once -- use via AC_REQUIRE.
#
# This code is only required when automatic dependency tracking
# is enabled. FIXME. This creates each `.P' file that we will
# need in order to bootstrap the dependency handling code.
AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
[AC_CONFIG_COMMANDS([depfiles],
[test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
[AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
])
# Copyright (C) 2003, 2005 Free Software Foundation, Inc.
#
# This file 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.
# serial 2
# Check whether the underlying file-system supports filenames
# with a leading dot. For instance MS-DOS doesn't.
AC_DEFUN([AM_SET_LEADING_DOT],
[rm -rf .tst 2>/dev/null
mkdir .tst 2>/dev/null
if test -d .tst; then
am__leading_dot=.
else
am__leading_dot=_
fi
rmdir .tst 2>/dev/null
AC_SUBST([am__leading_dot])])
# Check to see how 'make' treats includes. -*- Autoconf -*-
# Copyright (C) 2001, 2002, 2003, 2005, 2009 Free Software Foundation, Inc.
#
# This file 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.
# serial 4
# AM_MAKE_INCLUDE()
# -----------------
# Check to see how make treats includes.
AC_DEFUN([AM_MAKE_INCLUDE],
[am_make=${MAKE-make}
cat > confinc << 'END'
am__doit:
@echo this is the am__doit target
.PHONY: am__doit
END
# If we don't find an include directive, just comment out the code.
AC_MSG_CHECKING([for style of include used by $am_make])
am__include="#"
am__quote=
_am_result=none
# First try GNU make style include.
echo "include confinc" > confmf
# Ignore all kinds of additional output from `make'.
case `$am_make -s -f confmf 2> /dev/null` in #(
*the\ am__doit\ target*)
am__include=include
am__quote=
_am_result=GNU
;;
esac
# Now try BSD make style include.
if test "$am__include" = "#"; then
echo '.include "confinc"' > confmf
case `$am_make -s -f confmf 2> /dev/null` in #(
*the\ am__doit\ target*)
am__include=.include
am__quote="\""
_am_result=BSD
;;
esac
fi
AC_SUBST([am__include])
AC_SUBST([am__quote])
AC_MSG_RESULT([$_am_result])
rm -f confinc confmf
])
# Copyright (C) 2006, 2008 Free Software Foundation, Inc.
#
# This file 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.
# serial 2
# _AM_SUBST_NOTMAKE(VARIABLE)
# ---------------------------
# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
# This macro is traced by Automake.
AC_DEFUN([_AM_SUBST_NOTMAKE])
# AM_SUBST_NOTMAKE(VARIABLE)
# ---------------------------
# Public sister of _AM_SUBST_NOTMAKE.
AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
m4_include([../acinclude.m4])

21
libgloss/cr16/close.c Normal file
View File

@ -0,0 +1,21 @@
/* close.c -- Implementation of the low-level close() routine
*
* Copyright (c) 2004 National Semiconductor Corporation
*
* 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/syscall.h>
int _close (int fd)
{
HOST_SERVICE (SVC_CLOSE);
}

3975
libgloss/cr16/configure vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,55 @@
dnl Process this file with autoconf to produce a configure script.
AC_PREREQ(2.59)
AC_INIT(crt1.S)
if test "${enable_shared}" = "yes" ; then
echo "Shared libraries not supported for cross compiling, ignored"
fi
if test "$srcdir" = "." ; then
if test "${with_target_subdir}" != "." ; then
libgloss_topdir="${srcdir}/${with_multisrctop}../../.."
else
libgloss_topdir="${srcdir}/${with_multisrctop}../.."
fi
else
libgloss_topdir="${srcdir}/../.."
fi
AC_CONFIG_AUX_DIR($libgloss_topdir)
AC_CANONICAL_SYSTEM
AC_ARG_PROGRAM
AC_PROG_INSTALL
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
LIB_AM_PROG_AS
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_CONFIG_FILES(Makefile,
. ${libgloss_topdir}/config-ml.in,
srcdir=${srcdir}
target=${target}
with_multisubdir=${with_multisubdir}
ac_configure_args="${ac_configure_args} --enable-multilib"
CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
libgloss_topdir=${libgloss_topdir}
)
AC_OUTPUT

98
libgloss/cr16/crt1.S Normal file
View File

@ -0,0 +1,98 @@
##############################################################################
# crt0.s -- CR16 default start-up routine #
# #
# Copyright (c) 2004 National Semiconductor Corporation #
# #
# The authors hereby grant permission to use, copy, modify, distribute, #
# and license this software and its documentation for any purpose, provided #
# that existing copyright notices are retained in all copies and that this #
# notice is included verbatim in any distributions. No written agreement, #
# license, or royalty fee is required for any of the authorized uses. #
# Modifications to this software may be copyrighted by their authors #
# and need not follow the licensing terms described here, provided that #
# the new terms are clearly indicated on the first page of each file where #
# they apply. #
# #
# This is the start routine of your CR16 program. #
# It is linked with your application automatically. You can use #
# this routine as a template and modify it to your needs, yet this #
# file must be supplied for the compiler. #
# It is assumed that the following symbols are defined in your linker #
# script: __STACK_START, __ISTACK_START #
##############################################################################
.text
#ifdef __CR16CP__
.align 4
#else
.align 2
#endif
.global _main
.global _atexit
.global _exit
.global _start
.global __fini
.global __init
.global __STACK_START
.global __ISTACK_START
_start:
#----------------------------------------------------------------------------#
# Initialize the stack pointers. The constants __STACK_START and #
# __ISTACK_START should be defined in the linker script. #
movd $__STACK_START, (sp)
movd $__ISTACK_START, (r1,r0)
lprd (r1,r0), isp
#----------------------------------------------------------------------------#
# Initialize the default sections according to the linker script. #
# bal (ra), __init_bss_data
#----------------------------------------------------------------------#
# Set the Extended Dispatch bit in the CFG register. This is the #
# default configuration for CR16C. #
spr cfg, r0 # Set dispatch table width
orw $0x100, r0
lpr r0, cfg
#----------------------------------------------------------------------------#
#----------------------------------------------------------------------------#
# Handle global and static constructurs execution and setup #
# destructors to be called from exit. #
bal (ra),__init
movd $__fini@c, (r3,r2)
bal (ra), _atexit
#----------------------------------------------------------------------------#
# Jump to the main function in your application. #
#ifdef __INT32__
movd $0, (r3,r2) # Number of arguments
movd $0, (r5,r4) # conatins pointer to argument string.
#else
movw $0, r2 # Number of arguments
movd $0, (r4,r3) # conatins pointer to argument string.
#endif
bal (ra), _main
#----------------------------------------------------------------------------#
# Upon returning from the main function (if it isn't an infinite loop), #
# jump to the exit function. The exit function is located in the #
# library 'libc.a'. #
#ifdef __INT32__
movd (r1,r0), (r3,r2) # _main return value gets forwarded.
#else
movw r0, r2 # _main return value gets forwarded.
#endif
br _exit # returns control to the functional simulator.

47
libgloss/cr16/crti.S Normal file
View File

@ -0,0 +1,47 @@
/* Specialized code needed to support construction and destruction of
file-scope objects in C++ and Java code, and to support exception handling.
Copyright (C) 1999 Free Software Foundation, Inc.
Contributed by Charles-Antoine Gauthier (charles.gauthier@iit.nrc.ca).
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GCC is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
/* As a special exception, if you link this library with files
compiled with GCC to produce an executable, this does not cause
the resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why
the executable file might be covered by the GNU General Public License. */
/*
* This file just supplies function prologues for the .init and .fini
* sections. It is linked in before crtbegin.o.
*/
.file "crti.o"
.ident "GNU C crti.o"
.section .init
.globl _init
.type _init,@function
_init:
push ra
.section .fini
.globl _fini
.type _fini,@function
_fini:
push ra

41
libgloss/cr16/crtn.S Normal file
View File

@ -0,0 +1,41 @@
/* Specialized code needed to support construction and destruction of
file-scope objects in C++ and Java code, and to support exception handling.
Copyright (C) 1999 Free Software Foundation, Inc.
Contributed by Charles-Antoine Gauthier (charles.gauthier@iit.nrc.ca).
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GCC is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
/* As a special exception, if you link this library with files
compiled with GCC to produce an executable, this does not cause
the resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why
the executable file might be covered by the GNU General Public License. */
/*
* This file supplies function epilogues for the .init and .fini sections.
* It is linked in after all other files.
*/
.file "crtn.o"
.ident "GNU C crtn.o"
.section .init
popret ra
.section .fini
popret ra

23
libgloss/cr16/dvz_hndl.c Normal file
View File

@ -0,0 +1,23 @@
/* dvz_hndl.c -- Implementation of the DVZ trap handler
*
* Copyright (c) 2004 National Semiconductor Corporation
*
* 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/syscall.h>
void dvz_handler (void) __attribute__ ((interrupt ()));
void dvz_handler (void)
{
HOST_SERVICE (SVC_DVZ);
}

23
libgloss/cr16/flg_hndl.c Normal file
View File

@ -0,0 +1,23 @@
/* flg_hndl.c -- Implementation of the FLG trap handler
*
* Copyright (c) 2004 National Semiconductor Corporation
*
* 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/syscall.h>
void flg_handler (void) __attribute__ ((interrupt ()));
void flg_handler (void)
{
HOST_SERVICE (SVC_FLG);
}

30
libgloss/cr16/fstat.c Normal file
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 <_ansi.h>
#include <sys/stat.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);
}

26
libgloss/cr16/getpid.c Normal file
View File

@ -0,0 +1,26 @@
/* 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 <_ansi.h>
#define __MYPID 1
/*
* getpid -- only one process, so just return 1.
*/
int
_DEFUN (_getpid, (),
)
{
return __MYPID;
}

23
libgloss/cr16/iad_hndl.c Normal file
View File

@ -0,0 +1,23 @@
/* iad_hndl.c -- Implementation of the IAD trap handler
*
* Copyright (c) 2004 National Semiconductor Corporation
*
* 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/syscall.h>
void iad_handler (void) __attribute__ ((interrupt ()));
void iad_handler (void)
{
HOST_SERVICE (SVC_IAD);
}

37
libgloss/cr16/intable.c Normal file
View File

@ -0,0 +1,37 @@
/* intable.c -- CompactRISC default dispatch table definition
*
* Copyright (c) 2004 National Semiconductor Corporation
*
* 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 <stdio.h>
#include <sys/libh.h>
void (* const _dispatch_table[32])(void)=
{
NULL,
NULL,
NULL,
NULL,
NULL,
svc_handler,
dvz_handler,
flg_handler,
NULL,
NULL,
und_handler,
NULL,
iad_handler,
NULL,
NULL,
NULL
};

27
libgloss/cr16/isatty.c Normal file
View File

@ -0,0 +1,27 @@
/* isatty.c -- chek the terminal device.
*
* 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 <_ansi.h>
/*
* isatty -- returns 1 if connected to a terminal device,
* returns 0 if not. Since we're hooked up to a
* serial port, we'll say yes _AND return a 1.
*/
int
_DEFUN (_isatty, (fd),
int fd)
{
return (1);
}

30
libgloss/cr16/kill.c Normal file
View File

@ -0,0 +1,30 @@
/* 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 <_ansi.h>
#define __MYPID 1
extern void _exit (int) __attribute__((__noreturn__));
/*
* kill -- go out via exit...
*/
int
_DEFUN (_kill, (pid, sig),
int pid _AND
int sig)
{
if(pid == __MYPID)
_exit(sig);
return 0;
}

21
libgloss/cr16/lseek.c Normal file
View File

@ -0,0 +1,21 @@
/* lseek.c -- Implementation of the low-level lseek() routine
*
* Copyright (c) 2004 National Semiconductor Corporation
*
* 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/syscall.h>
long _lseek (int fd, long offset, int whence)
{
HOST_SERVICE (SVC_LSEEK);
}

41
libgloss/cr16/open.c Normal file
View File

@ -0,0 +1,41 @@
/* open.c -- Implementation of the low-level open() routine
*
* Copyright (c) 2004 National Semiconductor Corporation
*
* 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/syscall.h>
#include <stdarg.h>
int open_aux (char *, int, int);
/* The prototype in <fcntl.h> for open() uses ..., meaning function
* parameters reside on stack, but the debugger expects the parameters
* to reside in registers, thus we call an auxiliary function with
* bounded number of parameters.
*/
int _open (char *path, int flags, ...)
{
int mode;
va_list ap;
va_start(ap, flags);
mode = va_arg(ap, int);
open_aux (path, flags, mode);
va_end(ap);
}
int open_aux (char *path, int flags, int mode)
{
HOST_SERVICE (SVC_OPEN);
}

41
libgloss/cr16/putnum.c Normal file
View File

@ -0,0 +1,41 @@
/* putnum.c -- put a hex number on the output device.
*
* 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 <_ansi.h>
/*
* putnum -- print a 32 bit number in hex
*/
void
_DEFUN (putnum, (num),
unsigned int num)
{
char buf[9];
int cnt;
char *ptr;
int digit;
ptr = buf;
for (cnt = 7 ; cnt >= 0 ; cnt--) {
digit = (num >> (cnt * 4)) & 0xf;
if (digit <= 9)
*ptr++ = (char) ('0' + digit);
else
*ptr++ = (char) ('a' - 10 + digit);
}
*ptr = (char) 0;
print (buf);
}

21
libgloss/cr16/read.c Normal file
View File

@ -0,0 +1,21 @@
/* read.c -- Implementation of the low-level read() routine
*
* Copyright (c) 2004 National Semiconductor Corporation
*
* 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/syscall.h>
int _read (int fd, char *buffer, int nbytes)
{
HOST_SERVICE (SVC_READ);
}

56
libgloss/cr16/sbrk.c Normal file
View File

@ -0,0 +1,56 @@
/* sbrk.c -- Implementation of the low-level sbrk() routine
*
* Copyright (c) 2004 National Semiconductor Corporation
*
* 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 <stddef.h> /* where ptrdiff_t is defined */
#include <stdlib.h>
/* Extend heap space by size bytes.
Return start of new space allocated, or -1 for errors
Error cases:
1. Allocation is not within heap range */
void * _sbrk (ptrdiff_t size)
{
/*
* The following two memory locations should be defined in the linker script file
*/
extern const char _HEAP_START; /* start of heap */
extern const char _HEAP_MAX; /* end of heap (maximum value of heap_ptr) */
static const char * heap_ptr; /* pointer to head of heap */
const char * old_heap_ptr;
static unsigned char init_sbrk = 0;
/* heap_ptr is initialized to HEAP_START */
if (init_sbrk == 0)
{
heap_ptr = &_HEAP_START;
init_sbrk = 1;
}
old_heap_ptr = heap_ptr;
if ((heap_ptr + size) > &_HEAP_MAX)
{
/* top of heap is bigger than _HEAP_MAX */
errno = ENOMEM;
return (void *) -1;
}
/* success: update heap_ptr and return previous value */
heap_ptr += size;
return (void *)old_heap_ptr;
}

138
libgloss/cr16/sim.ld Normal file
View File

@ -0,0 +1,138 @@
/* Example Linker Script for linking NS CR16 elf32 files.*/
OUTPUT_FORMAT("elf32-cr16")
OUTPUT_ARCH(cr16)
/*
The libh.a library includes various CR default handlers.
The libsim.a library includes low-level functions, which
are used as an interface to communicate with the simulator.
*/
GROUP(-lc -lsim -lh -lgcc)
/*
The next line forces the entry point (_start in this script)
to be entered in the output file as an undefined symbol.
It is needed in case the entry point is not called explicitly
(which is the usual case) AND is in an archive.
*/
EXTERN(_start)
ENTRY(_start)
/* Define memory regions: Only RAM required for simulator */
MEMORY
{
ram : ORIGIN = 0x2, LENGTH = 10M
}
SECTIONS
{
.init :
{
__INIT_START = .;
KEEP (*(.init))
__INIT_END = .;
} > ram
.fini :
{
__FINI_START = .;
KEEP (*(.fini))
__FINI_END = .;
} > ram
.jcr :
{
KEEP (*(.jcr))
} > ram
.text :
{
__TEXT_START = .;
*(.text) *(.text.*) *(.gnu.linkonce.t.*)
__TEXT_END = .;
} > ram
.rdata :
{
__RDATA_START = .;
*(.rdata_4) *(.rdata_2) *(.rdata_1) *(.rdata.*) *(.gnu.linkonce.r.*) *(.rodata*)
__RDATA_END = .;
} > ram
.ctor ALIGN(4) :
{
__CTOR_START = .;
KEEP (*crtbegin*.o(.ctors))
KEEP (*(EXCLUDE_FILE (*crtend*.o) .ctors))
KEEP (*(SORT(.ctors.*)))
KEEP (*(.ctors))
__CTOR_END = .;
} > ram
.dtor ALIGN(4) :
{
__DTOR_START = .;
KEEP (*crtbegin*.o(.dtors))
KEEP (*(EXCLUDE_FILE (*crtend*.o) .dtors))
KEEP (*(SORT(.dtors.*)))
KEEP (*(.dtors))
__DTOR_END = .;
} > ram
.data :
{
__DATA_START = .;
*(.data_4) *(.data_2) *(.data_1) *(.data) *(.data.*) *(.gnu.linkonce.d.*)
*(.eh_frame_hdr)
*(.eh_frame)
*(.gcc_except_table)
*(.got.plt) *(.got)
__DATA_END = .;
} > ram
.got :
{
*(.got)
} > ram
.got.plt :
{
*(.got.plt)
} > ram
.bss (NOLOAD) :
{
__BSS_START = .;
*(.bss_4) *(.bss_2) *(.bss_1) *(.bss) *(COMMON) *(.bss.*) *(.gnu.linkonce.b.*)
__BSS_END = .;
} > ram
/*
You may change the sizes of the following sections to fit the actual
size your program requires.
The heap and stack are aligned to the bus width, as a speed optimization
for accessing data located there.
*/
.heap :
{
. = ALIGN(4);
__HEAP_START = .;
. += 0x2000;
__HEAP_MAX = .;
} > ram
.stack :
{
. = ALIGN(4);
. += 0x6000;
__STACK_START = .;
} > ram
.istack :
{
. = ALIGN(4);
. += 0x100;
__ISTACK_START = .;
} > ram
}
__DATA_IMAGE_START = LOADADDR(.data);

30
libgloss/cr16/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 <_ansi.h>
#include <sys/stat.h>
#include <errno.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);
}

23
libgloss/cr16/svc_hndl.c Normal file
View File

@ -0,0 +1,23 @@
/* svc_hndl.c -- Implementation of the SVC trap handler
*
* Copyright (c) 2004 National Semiconductor Corporation
*
* 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/syscall.h>
void svc_handler (void) __attribute__ ((interrupt ()));
void svc_handler (void)
{
HOST_SERVICE (SVC_SVC);
}

56
libgloss/cr16/time.c Normal file
View File

@ -0,0 +1,56 @@
/* time.c -- Implementation of the low-level time() routine
*
* Copyright (c) 2004 National Semiconductor Corporation
*
* 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 <unistd.h>
#include <time.h>
#include <errno.h>
#include <sys/time.h>
#include <sys/times.h>
#include <sys/syscall.h>
time_t _Time (time_t *timer)
{
HOST_SERVICE (SVC_TIME);
}
time_t _time (time_t *tod)
{
time_t t = _Time (NULL);
if (tod)
*tod = t;
return (t);
}
/* _times -- no clock, so return an error. */
clock_t _times (struct tms *buf)
{
errno = EINVAL;
return (-1);
}
/* _gettimeofday -- implement in terms of time. */
int _gettimeofday (struct timeval *tv, void *tzvp)
{
struct timezone *tz = tzvp;
if (tz)
tz->tz_minuteswest = tz->tz_dsttime = 0;
tv->tv_usec = 0;
tv->tv_sec = _time (0);
return 0;
}

23
libgloss/cr16/und_hndl.c Normal file
View File

@ -0,0 +1,23 @@
/* und_hndl.c -- Implementation of the UND trap handler
*
* Copyright (c) 2004 National Semiconductor Corporation
*
* 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/syscall.h>
void und_handler (void) __attribute__ ((interrupt ()));
void und_handler (void)
{
HOST_SERVICE (SVC_UND);
}

21
libgloss/cr16/unlink.c Normal file
View File

@ -0,0 +1,21 @@
/* unlink.c -- Implementation of the low-level unlink() routine
*
* Copyright (c) 2004 National Semiconductor Corporation
*
* 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/syscall.h>
int _unlink (char *path)
{
HOST_SERVICE (SVC_UNLINK);
}

21
libgloss/cr16/write.c Normal file
View File

@ -0,0 +1,21 @@
/* write.c -- Implementation of the low-level write() routine
*
* Copyright (c) 2004 National Semiconductor Corporation
*
* 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/syscall.h>
int _write (int fd, char *buffer, int nbytes)
{
HOST_SERVICE (SVC_WRITE);
}