This is the mail archive of the
newlib@sources.redhat.com
mailing list for the newlib project.
[PATCH]: libgloss port for 68hc11/68hc12
- To: newlib at sources dot redhat dot com
- Subject: [PATCH]: libgloss port for 68hc11/68hc12
- From: Stephane Carrez <Stephane dot Carrez at worldnet dot fr>
- Date: Mon, 01 Oct 2001 15:32:31 +0200
Hi!
I've ported libgloss to 68hc11/68hc12 microcontrollers.
The patch below is the complete port.
I've tested this with Axiom Manufacturing 68HC11 board and gcc 3.0.2 (cvs tree
of 2001-10-01).
Would you agree to include that port in libgloss ?
Thanks,
Stephane
2001-10-01 Stephane Carrez <stcarrez@worldnet.fr>
* README: Mention 68HC11/68HC12 support.
* configure.in: Recognize m6811-elf and m6812-elf.
* m68hc11/Makefile.in: New file.
* m68hc11/configure.in: New file.
* m68hc11/configure: New file.
* m68hc11/sci-inout.S: New file for 68hc11/68hc12 sio.
diff --exclude=configure --exclude=*.orig --exclude=CVS --exclude=*~ --exclude=ChangeLog* -Nrup newlib/libgloss/README newlib-m68hc11/libgloss/README
--- newlib/libgloss/README Mon Oct 1 14:14:26 2001
+++ newlib-m68hc11/libgloss/README Mon Oct 1 12:03:13 2001
@@ -1,5 +1,7 @@
sparc - Fujitsu Sparclite board. Works on the ex930, ex931, ex933
hp74x - Hewlett Packard HP742 board. Also some support for the hp743.
+m68hc11 - Motorola 68HC11 or 68HC12 support.
m68k - Motorola MVME135 and IDP board. For CPU32 systems.
pa - WinBond and Oki boards with a PA.
mips - R3000 support. Array Tech LSI33k based RAID disk controller.
+
diff --exclude=configure --exclude=*.orig --exclude=CVS --exclude=*~ --exclude=ChangeLog* -Nrup newlib/libgloss/configure.in newlib-m68hc11/libgloss/configure.in
--- newlib/libgloss/configure.in Mon Oct 1 14:16:49 2001
+++ newlib-m68hc11/libgloss/configure.in Sat Aug 4 15:38:42 2001
@@ -34,6 +34,9 @@ case "${target}" in
m32r-*-*)
configdirs="${configdirs} m32r testsuite"
;;
+ m68hc11-*-*|m6811-*-*|m68hc12-*-*|m6812-*-*)
+ configdirs="m68hc11 testsuite"
+ ;;
m68*-*-*)
configdirs="${configdirs} m68k testsuite"
;;
diff --exclude=configure --exclude=*.orig --exclude=CVS --exclude=*~ --exclude=ChangeLog* -Nrup newlib/libgloss/m68hc11/Makefile.in newlib-m68hc11/libgloss/m68hc11/Makefile.in
--- newlib/libgloss/m68hc11/Makefile.in Thu Jan 1 01:00:00 1970
+++ newlib-m68hc11/libgloss/m68hc11/Makefile.in Sat Aug 4 15:43:06 2001
@@ -0,0 +1,168 @@
+# Copyright (c) 2001 Free Software Foundation, Inc.
+#
+# The authors hereby grant permission to use, copy, modify, distribute,
+# and license this software and its documentation for any purpose, provided
+# that existing copyright notices are retained in all copies and that this
+# notice is included verbatim in any distributions. No written agreement,
+# license, or royalty fee is required for any of the authorized uses.
+# Modifications to this software may be copyrighted by their authors
+# and need not follow the licensing terms described here, provided that
+# the new terms are clearly indicated on the first page of each file where
+# they apply.
+#
+# This currently works with Motorola's 68HC11 based target boards.
+# (should work with 68HC12 but not tested yet)
+
+srcdir = @srcdir@
+objdir = .
+srcroot = $(srcdir)/../..
+objroot = $(objdir)/../..
+
+VPATH = $(srcdir) $(srcdir)/..
+
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+
+host_alias = @host_alias@
+target_alias = @target_alias@
+program_transform_name = @program_transform_name@
+
+bindir = @bindir@
+libdir = @libdir@
+tooldir = $(exec_prefix)/$(target_alias)
+
+# Multilib support variables.
+# TOP is used instead of MULTI{BUILD,SRC}TOP.
+MULTIDIRS =
+MULTISUBDIR =
+MULTIDO = true
+MULTICLEAN = true
+
+INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_DATA = @INSTALL_DATA@
+
+SHELL = /bin/sh
+
+NEWLIB_INCLUDES=-I../../../newlib/libc/include
+
+CC = @CC@ $(NEWLIB_INCLUDES)
+
+AS = @AS@
+AR = @AR@
+LD = @LD@
+RANLIB = @RANLIB@
+AR_FLAGS = qv
+
+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`
+
+SCRIPTS =
+
+OBJS = close.o fstat.o getpid.o isatty.o kill.o \
+ lseek.o open.o print.o read.o sbrk.o stat.o \
+ unlink.o write.o
+
+CFLAGS =
+# ARFLAGS = rv
+
+CRT0 =
+
+#
+# here's all the generic target stuff
+#
+GEN_LDFLAGS= -L${srcdir}
+GEN_BSP= libbcc.a
+GEN_OBJS= sci-inout.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: ${CRT0} ${GEN_BSP}
+
+#
+# here's where we build the board support packages for each target
+#
+${GEN_BSP}: $(OBJS) ${GEN_OBJS}
+ ${AR} ${ARFLAGS} $@ $(OBJS) ${GEN_OBJS}
+ ${RANLIB} $@
+
+
+close.o: $(srcdir)/../close.c
+ $(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $<
+
+fstat.o: $(srcdir)/../fstat.c
+ $(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $<
+
+getpid.o: $(srcdir)/../getpid.c
+ $(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $<
+
+isatty.o: $(srcdir)/../isatty.c
+ $(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $<
+
+kill.o: $(srcdir)/../kill.c
+ $(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $<
+
+lseek.o: $(srcdir)/../lseek.c
+ $(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $<
+
+open.o: $(srcdir)/../open.c
+ $(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $<
+
+print.o: $(srcdir)/../print.c
+ $(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $<
+
+read.o: $(srcdir)/../read.c
+ $(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $<
+
+putnum.o: $(srcdir)/../putnum.c
+ $(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $<
+
+sbrk.o: $(srcdir)/../sbrk.c
+ $(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $<
+
+stat.o: $(srcdir)/../stat.c
+ $(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $<
+
+unlink.o: $(srcdir)/../unlink.c
+ $(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $<
+
+write.o: $(srcdir)/../write.c
+ $(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $<
+
+
+.PHONY: install info dvi doc install-info clean-info
+install:
+ # install GEN stuff
+ $(INSTALL_PROGRAM) $(GEN_BSP) $(tooldir)/lib${MULTISUBDIR}/$(GEN_BSP)
+
+clean mostlyclean:
+ rm -f a.out core *.[oais] *-test *.srec *.dis *.x syscall.h
+
+distclean maintainer-clean realclean: clean
+ rm -f Makefile config.status *~
+
+.PHONY: install info install-info clean-info
+install: ${SIM_INSTALL}
+
+install-sim:
+ set -e; for x in ${SIM_CRT0} ${SIM_BSP} ${SIM_SCRIPTS}; do ${INSTALL_DATA} $$x ${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
diff --exclude=configure --exclude=*.orig --exclude=CVS --exclude=*~ --exclude=ChangeLog* -Nrup newlib/libgloss/m68hc11/configure.in newlib-m68hc11/libgloss/m68hc11/configure.in
--- newlib/libgloss/m68hc11/configure.in Thu Jan 1 01:00:00 1970
+++ newlib-m68hc11/libgloss/m68hc11/configure.in Sat Aug 4 15:38:42 2001
@@ -0,0 +1,91 @@
+dnl Process this file with autoconf to produce a configure script.
+AC_PREREQ(2.5)dnl
+AC_INIT(sci-inout.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
+
+# 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,
+. ${libgloss_topdir}/config-ml.in,
+srcdir=${srcdir}
+target=${target}
+ac_configure_args="${ac_configure_args} --enable-multilib"
+CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
+libgloss_topdir=${libgloss_topdir}
+)
+
diff --exclude=configure --exclude=*.orig --exclude=CVS --exclude=*~ --exclude=ChangeLog* -Nrup newlib/libgloss/m68hc11/sci-inout.S newlib-m68hc11/libgloss/m68hc11/sci-inout.S
--- newlib/libgloss/m68hc11/sci-inout.S Thu Jan 1 01:00:00 1970
+++ newlib-m68hc11/libgloss/m68hc11/sci-inout.S Sat Aug 4 15:38:42 2001
@@ -0,0 +1,147 @@
+/* M68HC11/M68HC12 serial line operations
+ Copyright (C) 1999, 2001 Free Software Foundation, Inc.
+ Written by Stephane Carrez (stcarrez@worldnet.fr)
+
+This file 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.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file with other programs, and to distribute
+those programs without any restriction coming from the use of this
+file. (The General Public License restrictions do apply in other
+respects; for example, they cover modification of the file, and
+distribution when not linked into another program.)
+
+This file 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 this program; see the file COPYING. If not, write to
+the Free Software Foundation, 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA. */
+
+#ifdef mc68hc12
+ SC0CR1 = 0xC2
+ SC0CR2 = 0xC3
+ SC0SR1 = 0xC4
+ SC0DRL = 0xC7
+ SC0BD = 0xC0
+
+ .sect .data
+ .globl _m68hc12_ports
+_m68hc12_ports: .word 0
+
+ .sect .text
+ .globl outbyte
+;;;
+;;; int outbyte(char c);
+;;;
+;;; B : Character to send
+;;;
+outbyte:
+ bsr _sci_init
+L1:
+ ldaa SC0SR1,x
+ bge L1
+ stab SC0DRL,x
+ ldab SC0CR2,x
+ orab #0x8
+ stab SC0CR2,x
+ rts
+
+ .sect .text
+ .globl inbyte
+;;;
+;;; char inbyte(void);
+;;;
+inbyte:
+ bsr _sci_init
+ ldaa SC0SR1,x
+ bita #0x20
+ beq inbyte
+ ldab SC0CR2,x
+ rts
+
+ .globl _sci_init
+ .sect .text
+_sci_init:
+ ldx _m68hc12_ports
+ beq do_init
+ dex
+ rts
+do_init:
+ ldx #0x1
+ stx _m68hc12_ports
+ dex
+ ldd #26
+ std SC0BD,x
+ ldaa #0
+ staa SC0CR1,x
+ ldaa #0xC
+ staa SC0CR2,x
+ rts
+#else
+ BAUD = 0x2b
+ SCCR1= 0x2c
+ SCCR2= 0x2d
+ SCSR = 0x2e
+ SCDR = 0x2f
+
+ .sect .data
+ .globl _m68hc11_ports
+_m68hc11_ports: .word 0
+
+ .sect .text
+ .globl outbyte
+;;;
+;;; int outbyte(char c);
+;;;
+;;; B : Character to send
+;;;
+outbyte:
+ bsr _sci_init
+L1:
+ ldaa SCSR,x
+ bge L1
+ stab SCDR,x
+ ldab SCCR2,x
+ orab #0x8
+ stab SCCR2,x
+ rts
+
+ .sect .text
+ .globl inbyte
+;;;
+;;; char inbyte(void);
+;;;
+inbyte:
+ bsr _sci_init
+ ldaa SCSR,x
+ bita #0x20
+ beq inbyte
+ ldab SCDR,x
+ rts
+
+ .globl _sci_init
+ .sect .text
+_sci_init:
+ ldx _m68hc11_ports
+ beq do_init
+ rts
+do_init:
+ ldx #0x1000
+ stx _m68hc11_ports
+ ldaa #0x30
+ staa BAUD,x
+ clra
+ staa SCCR1,x
+ ldaa #0xC
+ staa SCCR2,x
+ rts
+
+#endif