This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
Re: [PATCH] add bfin target
Hi Jeff,
attached an update for the patch.
On 9/14/06, Jeff Johnston <jjohnstn@redhat.com> wrote:
1. You need to define the setjmp buffer in libc/include/machine/setjmp.h
done
2. Your Makefile.am and configure.in should be based on the
ones in libc/machine/fr30 to comply with the latest
autotools support
they were based on fr30 from 1.1.14 which of course is outdated.
Is now updated.
3. Minor nit: remove reference to arm in your configure.in
well, i copied that arm reference from the fr30 :-). changed to bfin
4. What do the #defines at the top of setjmp.S do?
nothing. I removed them.
5. Are the defaults in libc/include/sys/config.h ok for you?
as far as I understand those defaults, yes.
I have also added a copyright notice ( asked by Ralf Corsepius)
Should I include configure, aclocal.m4, Makefile.in as
mentioned by Michael Ambrus ? Or are the generated automatically
when you do a maintainer build ?
Thanks,
alain
diff -urN newlib-1.14.0-orig/newlib/configure.host newlib-1.14.0/newlib/configure.host
--- newlib-1.14.0-orig/newlib/configure.host 2005-12-12 12:25:07.000000000 +0100
+++ newlib-1.14.0/newlib/configure.host 2006-08-18 13:11:47.000000000 +0200
@@ -96,6 +96,9 @@
avr*)
newlib_cflags="${newlib_cflags} -DPREFER_SIZE_OVER_SPEED -mcall-prologues"
;;
+ bfin)
+ machine_dir=bfin
+ ;;
cris | crisv32)
machine_dir=cris
;;
diff -urN newlib-1.14.0-orig/newlib/libc/machine/bfin/configure.in newlib-1.14.0/newlib/libc/machine/bfin/configure.in
--- newlib-1.14.0-orig/newlib/libc/machine/bfin/configure.in 1970-01-01 01:00:00.000000000 +0100
+++ newlib-1.14.0/newlib/libc/machine/bfin/configure.in 2006-09-14 02:48:13.000000000 +0200
@@ -0,0 +1,14 @@
+dnl This is the newlib/libc/machine/bfin configure.in file.
+dnl Process this file with autoconf to produce a configure script.
+
+AC_PREREQ(2.59)
+AC_INIT([newlib],[NEWLIB_VERSION])
+AC_CONFIG_SRCDIR([Makefile.am])
+
+dnl Can't be done in NEWLIB_CONFIGURE because that confuses automake.
+AC_CONFIG_AUX_DIR(../../../..)
+
+NEWLIB_CONFIGURE(../../..)
+
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
diff -urN newlib-1.14.0-orig/newlib/libc/machine/bfin/Makefile.am newlib-1.14.0/newlib/libc/machine/bfin/Makefile.am
--- newlib-1.14.0-orig/newlib/libc/machine/bfin/Makefile.am 1970-01-01 01:00:00.000000000 +0100
+++ newlib-1.14.0/newlib/libc/machine/bfin/Makefile.am 2006-09-14 02:45:04.000000000 +0200
@@ -0,0 +1,16 @@
+## Process this file with automake to generate Makefile.in
+
+AUTOMAKE_OPTIONS = cygnus
+
+INCLUDES = $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS)
+
+AM_CCASFLAGS = $(INCLUDES)
+
+noinst_LIBRARIES = lib.a
+
+lib_a_SOURCES = setjmp.S
+lib_a_CCASFLAGS=$(AM_CCASFLAGS)
+lib_a_CFLAGS=$(AM_CFLAGS)
+
+ACLOCAL_AMFLAGS = -I ../../..
+CONFIG_STATUS_DEPENDENCIES = $(newlib_basedir)/configure.host
diff -urN newlib-1.14.0-orig/newlib/libc/machine/bfin/setjmp.S newlib-1.14.0/newlib/libc/machine/bfin/setjmp.S
--- newlib-1.14.0-orig/newlib/libc/machine/bfin/setjmp.S 1970-01-01 01:00:00.000000000 +0100
+++ newlib-1.14.0/newlib/libc/machine/bfin/setjmp.S 2006-09-14 13:16:28.000000000 +0200
@@ -0,0 +1,194 @@
+/*
+ * Setjmp/Longjump implementation for the Blackfin Architecture
+ * Alain Schaefer, 14 September 2006
+ */
+.text
+.global setjmp
+.align 4;
+setjmp:
+ /*save P0 first*/
+ [--SP] = P0;
+ P0 = R0;
+ [ P0 + 0x00 ] = R0;
+ [ P0 + 0x04 ] = R1;
+ [ P0 + 0x08 ] = R2;
+ [ P0 + 0x0c ] = R3;
+ [ P0 + 0x10 ] = R4;
+ [ P0 + 0x14 ] = R5;
+ [ P0 + 0x18 ] = R6;
+ [ P0 + 0x1c ] = R7;
+ [ P0 + 0x24 ] = P1;
+ /* save the original value of P0 */
+ P1 = [SP++];
+ [ P0 + 0x20 ] = P1;
+ [ P0 + 0x28 ] = P2;
+ [ P0 + 0x2c ] = P3;
+ [ P0 + 0x30 ] = P4;
+ [ P0 + 0x34 ] = P5;
+ [ P0 + 0x38 ] = FP;
+ [ P0 + 0x3c ] = SP;
+
+ /* save ASTAT */
+ R0 = ASTAT;
+ [P0 + 0x40] = R0;
+
+ /* save Loop Counters */
+ R0 = LC0;
+ [P0 + 0x44] = R0;
+ R0 = LC1;
+ [P0 + 0x48] = R0;
+
+ /* save Accumulators */
+ R0 = A0.W;
+ [P0 + 0x4C] = R0;
+ R0 = A0.X;
+ [P0 + 0x50] = R0;
+ R0 = A1.W;
+ [P0 + 0x54] = R0;
+ R0 = A1.X;
+ [P0 + 0x58] = R0;
+
+ /* save Index Registers */
+ R0 = I0;
+ [P0 + 0x5C] = R0;
+ R0 = I1;
+ [P0 + 0x60] = R0;
+ R0 = I2;
+ [P0 + 0x64] = R0;
+ R0 = I3;
+ [P0 + 0x68] = R0;
+
+ /* save Modifier Registers */
+ R0 = M0;
+ [P0 + 0x6C] = R0;
+ R0 = M1;
+ [P0 + 0x70] = R0;
+ R0 = M2;
+ [P0 + 0x74] = R0;
+ R0 = M3;
+ [P0 + 0x78] = R0;
+
+ /* save Length Registers */
+ R0 = L0;
+ [P0 + 0x7c] = R0;
+ R0 = L1;
+ [P0 + 0x80] = R0;
+ R0 = L2;
+ [P0 + 0x84] = R0;
+ R0 = L3;
+ [P0 + 0x88] = R0;
+
+ /* Base Registers */
+ R0 = B0;
+ [P0 + 0x8C] = R0;
+ R0 = B1;
+ [P0 + 0x90] = R0;
+ R0 = B2;
+ [P0 + 0x94] = R0;
+ R0 = B3;
+ [P0 + 0x98] = R0;
+
+ R0 = RETS;
+ [P0 + 0x9C] = R0;
+
+ /* return 0 in R0 */
+ R0 = 0x00;
+ RTS;
+
+
+.global longjmp
+longjmp:
+ /*setup P0*/
+ P0 = R0;
+ R2 = [ P0 + 0x08 ];
+ R3 = [ P0 + 0x0c ];
+ R4 = [ P0 + 0x10 ];
+ R5 = [ P0 + 0x14 ];
+ R6 = [ P0 + 0x18 ];
+ R7 = [ P0 + 0x1c ];
+ P1 = [ P0 + 0x24 ];
+ P2 = [ P0 + 0x28 ];
+ P3 = [ P0 + 0x2c ];
+ P4 = [ P0 + 0x30 ];
+ P5 = [ P0 + 0x34 ];
+ FP = [ P0 + 0x38 ];
+ SP = [ P0 + 0x3c ];
+
+ /* save ASTAT */
+ R0 = [P0 + 0x40];
+ ASTAT = R0;
+
+ /* save Loop Counters */
+ R0 = [P0 + 0x44];
+ LC0 = R0;
+ R0 = [P0 + 0x48];
+ LC1 = R0;
+
+ /* save Accumulators */
+ R0 = [P0 + 0x4C];
+ A0.W = R0;
+ R0 = [P0 + 0x50];
+ A0.X = R0;
+ R0 = [P0 + 0x54];
+ A1.W = R0;
+ R0 = [P0 + 0x58];
+ A1.X = R0;
+
+ /* save Index Registers */
+ R0 = [P0 + 0x5C];
+ I0 = R0;
+ R0 = [P0 + 0x60];
+ I1 = R0;
+ R0 = [P0 + 0x64];
+ I2 = R0;
+ R0 = [P0 + 0x68];
+ I3 = R0;
+
+ /* save Modifier Registers */
+ R0 = [P0 + 0x6C];
+ M0 = R0;
+ R0 = [P0 + 0x70];
+ M1 = R0;
+ R0 = [P0 + 0x74];
+ M2 = R0;
+ R0 = [P0 + 0x78];
+ M3 = R0;
+
+ /* save Length Registers */
+ R0 = [P0 + 0x7c];
+ L0 = R0;
+ R0 = [P0 + 0x80];
+ L1 = R0;
+ R0 = [P0 + 0x84];
+ L2 = R0;
+ R0 = [P0 + 0x88];
+ L3 = R0;
+
+ /* Base Registers */
+ R0 = [P0 + 0x8C];
+ B0 = R0;
+ R0 = [P0 + 0x90];
+ B1 = R0;
+ R0 = [P0 + 0x94];
+ B2 = R0;
+ R0 = [P0 + 0x98];
+ B3 = R0;
+
+ R0 = [P0 + 0x9C];
+ RETS = R0;
+
+
+
+ /* return orig R1 should be non zero */
+ CC = R1 == 0x0;
+ IF CC JUMP return1;
+ R0 = R1;
+ JUMP finished
+return1:
+ R0 = 0x1;
+jmpfinished:
+ /* restore R1 and P0 */
+ R1 = [P0 + 0x04]
+ P0 = [P0 + 0x20]
+ rts;
+