This is the mail archive of the
newlib@sources.redhat.com
mailing list for the newlib project.
[PATCH]: libgloss port for 68hc11/68hc12
- From: Stephane Carrez <stcarrez at nerim dot fr>
- To: newlib at sources dot redhat dot com
- Date: Wed, 17 Jul 2002 00:33:19 +0200
- Subject: [PATCH]: libgloss port for 68hc11/68hc12
Hi!
This is the libgloss port for 68HC11/68HC12, posted some months ago,
(See http://sources.redhat.com/ml/newlib/2001/msg00525.html)
and with new license (same as other libgloss files).
Can you integrate this patch ?
Thanks,
Stephane
2002-07-16 Stephane Carrez <stcarrez@nerim.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 -Nrup --exclude=Makefile.in --exclude=configure --exclude=CVS newlib-main/libgloss/README newlib-main-integrate/libgloss/README
--- newlib-main/libgloss/README Fri Mar 17 23:48:49 2000
+++ newlib-main-integrate/libgloss/README Wed Jul 17 00:28:02 2002
@@ -1,5 +1,6 @@
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 -Nrup --exclude=Makefile.in --exclude=configure --exclude=CVS newlib-main/libgloss/configure.in newlib-main-integrate/libgloss/configure.in
--- newlib-main/libgloss/configure.in Tue Jun 18 23:41:22 2002
+++ newlib-main-integrate/libgloss/configure.in Sat Jul 13 15:23:34 2002
@@ -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 -Nrup --exclude=Makefile.in --exclude=configure --exclude=CVS newlib-main/libgloss/m68hc11/configure.in newlib-main-integrate/libgloss/m68hc11/configure.in
--- newlib-main/libgloss/m68hc11/configure.in Thu Jan 1 01:00:00 1970
+++ newlib-main-integrate/libgloss/m68hc11/configure.in Sat Jul 13 15:23:34 2002
@@ -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 -Nrup --exclude=Makefile.in --exclude=configure --exclude=CVS newlib-main/libgloss/m68hc11/sci-inout.S newlib-main-integrate/libgloss/m68hc11/sci-inout.S
--- newlib-main/libgloss/m68hc11/sci-inout.S Thu Jan 1 01:00:00 1970
+++ newlib-main-integrate/libgloss/m68hc11/sci-inout.S Sat Jul 13 15:23:34 2002
@@ -0,0 +1,134 @@
+/* M68HC11/M68HC12 serial line operations
+ * Copyright (C) 1999, 2001 Stephane Carrez (stcarrez@nerim.fr)
+ *
+ * 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.
+ */
+
+#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