help: big endian arm-elf toolchain

Carl Miller chaz@energoncube.net
Fri Sep 27 10:37:00 GMT 2002


> Anyone knows how to build a big endian arm-elf
> cross toolchain? I am using 
> newlib-1.10.0
> binutils-2.11.2,
> gcc-2.95.3 
> insight-5.2.1. 

We've got a big-endian-defaulting toolchain for arm
here, but we used binutils-2.10.something and gcc
2.95.2.  So I'm not sure our patches will go in
cleanly to the tool versions you're using.  But I'll
send them along anyway; at least they'll be a decent
starting point.

Failing that, you could always just invoke little-
endian tools with -mbig-endian to gcc and -EB to gas
and gld.  That should work also.

> I've heard newlib has to be recompiled and gdb has to
> be adapted also.

No experience with newlib, but all a recent gdb should
need is "set endian big".  You could put that in the
project's .gdbinit once, and forget about it.  And I
think (not entirely sure) that once gdb is taken care
of, insight should be fine as well without any
additional effort.

Good luck.

-------------------------------------------
Carl Miller               Firmware Engineer
                              Gordian, Inc.
                     http://www.gordian.com

-------------- next part --------------
Index: config.sub
===================================================================
RCS file: /prj/cvsroot/gbinutils/config.sub,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- config.sub	2001/06/05 06:55:05	1.1
+++ config.sub	2001/12/20 23:38:46	1.2
@@ -203,7 +203,7 @@
 	# Recognize the basic CPU types with company name.
 	# FIXME: clean up the formatting here.
 	vax-* | tahoe-* | i[34567]86-* | i860-* | ia64-* | m32r-* | m68k-* | m68000-* \
-	      | m88k-* | sparc-* | ns32k-* | fx80-* | arc-* | arm-* | c[123]* \
+	      | m88k-* | sparc-* | ns32k-* | fx80-* | arc-* | arm-* | arme[lb]-* | c[123]* \
 	      | mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* \
 	      | power-* | none-* | 580-* | cray2-* | h8300-* | h8500-* | i960-* \
 	      | xmp-* | ymp-* \
Index: bfd/config.bfd
===================================================================
RCS file: /prj/cvsroot/gbinutils/bfd/config.bfd,v
retrieving revision 1.1
retrieving revision 1.3
diff -u -d -r1.1 -r1.3
--- bfd/config.bfd	2001/06/05 06:55:11	1.1
+++ bfd/config.bfd	2001/12/20 23:55:34	1.3
@@ -117,14 +117,23 @@
     targ_defvec=aout_arm_big_vec
     targ_selvecs=aout_arm_little_vec
     ;;
-  arm-*-coff)
+  arm-*-coff | armel-*-coff)
     targ_defvec=armcoff_little_vec
     targ_selvecs=armcoff_big_vec
     targ_underscore=yes
     ;;
-  arm-*-elf | arm*-*-linux-gnu* | arm*-*-conix*)
+  armeb-*-coff)
+    targ_defvec=armcoff_big_vec
+    targ_selvecs=armcoff_little_vec
+    targ_underscore=yes
+    ;;
+  arm-*-elf | armel-*-elf | arm*-*-linux-gnu* | arm*-*-conix*)
     targ_defvec=bfd_elf32_littlearm_vec
     targ_selvecs=bfd_elf32_bigarm_vec
+    ;;
+  armeb-*-elf | arm*-*-linux-gnu* | arm*-*-conix*)
+    targ_defvec=bfd_elf32_bigarm_vec
+    targ_selvecs=bfd_elf32_littlearm_vec
     ;;
   arm-*-oabi)
     targ_defvec=bfd_elf32_littlearm_oabi_vec
Index: ld/Makefile.in
===================================================================
RCS file: /prj/cvsroot/gbinutils/ld/Makefile.in,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- ld/Makefile.in	2001/06/05 06:55:33	1.1
+++ ld/Makefile.in	2001/12/22 01:22:40	1.2
@@ -204,13 +204,15 @@
 	eaixrs6.o \
 	ealpha.o \
 	earcelf.o \
-	earmelf.o \
+	earmelfb.o \
+	earmelfl.o \
 	earmelf_oabi.o \
 	earmelf_linux.o \
 	earmelf_linux26.o \
 	earmaoutb.o \
 	earmaoutl.o \
-	earmcoff.o \
+	earmcoffb.o \
+	earmcoffl.o \
 	earmnbsd.o \
 	earmpe.o \
 	earm_epoc_pe.o \
@@ -997,9 +999,12 @@
 earcelf.c: $(srcdir)/emulparams/arcelf.sh \
   $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
 	${GENSCRIPTS} arcelf "$(tdir_arcelf)"
-earmelf.c: $(srcdir)/emulparams/armelf.sh \
+earmelfb.c: $(srcdir)/emulparams/armelfb.sh \
   $(srcdir)/emultempl/armelf.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
-	${GENSCRIPTS} armelf "$(tdir_armelf)"
+	${GENSCRIPTS} armelfb "$(tdir_armelfb)"
+earmelfl.c: $(srcdir)/emulparams/armelfl.sh \
+  $(srcdir)/emultempl/armelf.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
+	${GENSCRIPTS} armelfl "$(tdir_armelfl)"
 earmelf_oabi.c: $(srcdir)/emulparams/armelf_oabi.sh \
   $(srcdir)/emultempl/armelf_oabi.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
 	${GENSCRIPTS} armelf_oabi "$(tdir_armelf)"
@@ -1015,9 +1020,12 @@
 earmaoutl.c:	$(srcdir)/emulparams/armaoutl.sh \
   $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/armaout.sc ${GEN_DEPENDS}
 	${GENSCRIPTS} armaoutl "$(tdir_armaoutl)"
-earmcoff.c:	$(srcdir)/emulparams/armcoff.sh \
+earmcoffb.c:	$(srcdir)/emulparams/armcoffb.sh \
   $(srcdir)/emultempl/armcoff.em $(srcdir)/scripttempl/armcoff.sc ${GEN_DEPENDS}
-	${GENSCRIPTS} armcoff "$(tdir_armcoff)"
+	${GENSCRIPTS} armcoffb "$(tdir_armcoffb)"
+earmcoffl.c:	$(srcdir)/emulparams/armcoffl.sh \
+  $(srcdir)/emultempl/armcoff.em $(srcdir)/scripttempl/armcoff.sc ${GEN_DEPENDS}
+	${GENSCRIPTS} armcoffl "$(tdir_armcoffl)"
 earmnbsd.c:	$(srcdir)/emulparams/armnbsd.sh \
   $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS}
 	${GENSCRIPTS} armnbsd "$(tdir_armnbsd)"
Index: ld/configure.tgt
===================================================================
RCS file: /prj/cvsroot/gbinutils/ld/configure.tgt,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- ld/configure.tgt	2001/06/05 06:55:33	1.1
+++ ld/configure.tgt	2001/12/22 01:22:41	1.2
@@ -152,18 +152,24 @@
 #  arm-*-riscix*)		targ_emul=riscix ;;
 arm-*-aout | armel-*-aout) targ_emul=armaoutl ;;
 armeb-*-aout)		targ_emul=armaoutb ;;
-arm-*-coff)		targ_emul=armcoff ;;
+arm-*-coff | armel-*-coff) targ_emul=armcoffl ;;
+armeb-*-coff)		targ_emul=armcoffb ;;
 arm-*-netbsd*)		targ_emul=armnbsd ;;
-arm-*-elf)		targ_emul=armelf ;;
+arm-*-elf | armel-*-elf) targ_emul=armelfl ;;
+armeb-*-elf)		targ_emul=armelfb ;;
 arm-*-oabi)		targ_emul=armelf_oabi ;;
-arm*-*-linux-gnu*)	targ_emul=armelf_linux; targ_extra_emuls="armelf_linux26 armelf" ;;
-arm*-*-uclinux*)	targ_emul=armelf_linux; targ_extra_emuls=armelf ;;
-arm*-*-conix*)		targ_emul=armelf ;;
-thumb-*-linux-gnu* | thumb-*-uclinux*)	targ_emul=armelf_linux; targ_extra_emuls=armelf ;;
-strongarm-*-coff)	targ_emul=armcoff ;;
-strongarm-*-elf)	targ_emul=armelf ;;
-thumb-*-coff)		targ_emul=armcoff ;;
-thumb-*-elf)		targ_emul=armelf ;;
+arm*-*-linux-gnu*)	targ_emul=armelf_linux; targ_extra_emuls="armelf_linux26 armelfl" ;;
+arm*-*-uclinux*)	targ_emul=armelf_linux; targ_extra_emuls=armelfl ;;
+arm*-*-conix*)		targ_emul=armelfl ;;
+thumb-*-linux-gnu* | thumb-*-uclinux*)	targ_emul=armelf_linux; targ_extra_emuls=armelfl ;;
+strongarm-*-coff | strongarmel-*-coff) targ_emul=armcoffl ;;
+strongarmeb-*-coff)	targ_emul=armcoffb ;;
+strongarm-*-elf | strongarmel-*-elf) targ_emul=armelfl ;;
+strongarmeb-*-elf)	targ_emul=armelfb ;;
+thumb-*-coff | thumbel-*-coff) targ_emul=armcoffl ;;
+thumbeb-*-coff)		targ_emul=armcoffb ;;
+thumb-*-elf | thumbel-*-elf) targ_emul=armelfl ;;
+thumbeb-*-elf)		targ_emul=armelfb ;;
 thumb-*-oabi)           targ_emul=armelf_oabi ;;
 thumb-epoc-pe)		targ_emul=arm_epoc_pe ;
 			targ_extra_ofiles="deffilep.o pe-dll.o" ;;
Index: ld/emulparams/armcoff.sh
===================================================================
RCS file: /prj/cvsroot/gbinutils/ld/emulparams/armcoff.sh,v
--- ld/emulparams/armcoff.sh	2001/06/05 06:55:33	1.1
+++ ld/emulparams/armcoff.sh	2001/12/22 06:22:41	1.0
@@ -1,6 +0,0 @@
-ARCH=arm
-SCRIPT_NAME=armcoff
-OUTPUT_FORMAT="coff-arm-little"
-LITTLE_OUTPUT_FORMAT="coff-arm-little"
-BIG_OUTPUT_FORMAT="coff-arm-big"
-TEMPLATE_NAME=armcoff
Index: ld/emulparams/armcoffl.sh
===================================================================
RCS file: /prj/cvsroot/gbinutils/ld/emulparams/armcoffl.sh,v
--- ld/emulparams/armcoffl.sh	2001/06/05 06:55:33	1.0
+++ ld/emulparams/armcoffl.sh	2001/12/22 06:22:41	1.1
@@ -0,0 +1,6 @@
+ARCH=arm
+SCRIPT_NAME=armcoff
+OUTPUT_FORMAT="coff-arm-little"
+LITTLE_OUTPUT_FORMAT="coff-arm-little"
+BIG_OUTPUT_FORMAT="coff-arm-big"
+TEMPLATE_NAME=armcoff
Index: ld/emulparams/armcoffb.sh
===================================================================
RCS file: /prj/cvsroot/gbinutils/ld/emulparams/armcoffb.sh,v
--- ld/emulparams/armcoffb.sh	2001/06/05 06:55:33	1.0
+++ ld/emulparams/armcoffb.sh	2001/12/22 06:22:41	1.1
@@ -0,0 +1,6 @@
+ARCH=arm
+SCRIPT_NAME=armcoff
+OUTPUT_FORMAT="coff-arm-big"
+LITTLE_OUTPUT_FORMAT="coff-arm-little"
+BIG_OUTPUT_FORMAT="coff-arm-big"
+TEMPLATE_NAME=armcoff
Index: ld/emulparams/armelf.sh
===================================================================
RCS file: /prj/cvsroot/gbinutils/ld/emulparams/armelf.sh,v
--- ld/emulparams/armelf.sh	2001/06/05 06:55:33	1.1
+++ ld/emulparams/armelf.sh	2001/12/22 06:22:41	1.0
@@ -1,22 +0,0 @@
-MACHINE=
-SCRIPT_NAME=elf
-OUTPUT_FORMAT="elf32-littlearm"
-BIG_OUTPUT_FORMAT="elf32-bigarm"
-LITTLE_OUTPUT_FORMAT="elf32-littlearm"
-TEXT_START_ADDR=0x8000
-TEMPLATE_NAME=armelf
-OTHER_TEXT_SECTIONS='*(.glue_7t) *(.glue_7)'
-OTHER_BSS_SYMBOLS='__bss_start__ = .;'
-OTHER_BSS_END_SYMBOLS='_bss_end__ = . ; __bss_end__ = . ; __end__ = . ;'
-
-GENERATE_SHLIB_SCRIPT=yes
-
-ARCH=arm
-MACHINE=
-MAXPAGESIZE=256
-ENTRY=_start
-EMBEDDED=yes
-
-# Hmmm, there's got to be a better way.  This sets the stack to the
-# top of the simulator memory (2^19 bytes).
-OTHER_RELOCATING_SECTIONS='.stack 0x80000 : { _stack = .; *(.stack) }'
Index: ld/emulparams/armelfl.sh
===================================================================
RCS file: /prj/cvsroot/gbinutils/ld/emulparams/armelfl.sh,v
--- ld/emulparams/armelfl.sh	2001/06/05 06:55:33	1.0
+++ ld/emulparams/armelfl.sh	2001/12/22 06:22:41	1.1
@@ -0,0 +1,22 @@
+MACHINE=
+SCRIPT_NAME=elf
+OUTPUT_FORMAT="elf32-littlearm"
+BIG_OUTPUT_FORMAT="elf32-bigarm"
+LITTLE_OUTPUT_FORMAT="elf32-littlearm"
+TEXT_START_ADDR=0x8000
+TEMPLATE_NAME=armelf
+OTHER_TEXT_SECTIONS='*(.glue_7t) *(.glue_7)'
+OTHER_BSS_SYMBOLS='__bss_start__ = .;'
+OTHER_BSS_END_SYMBOLS='_bss_end__ = . ; __bss_end__ = . ; __end__ = . ;'
+
+GENERATE_SHLIB_SCRIPT=yes
+
+ARCH=arm
+MACHINE=
+MAXPAGESIZE=256
+ENTRY=_start
+EMBEDDED=yes
+
+# Hmmm, there's got to be a better way.  This sets the stack to the
+# top of the simulator memory (2^19 bytes).
+OTHER_RELOCATING_SECTIONS='.stack 0x80000 : { _stack = .; *(.stack) }'
Index: ld/emulparams/armelfb.sh
===================================================================
RCS file: /prj/cvsroot/gbinutils/ld/emulparams/armelfb.sh,v
--- ld/emulparams/armelfb.sh	2001/06/05 06:55:33	1.0
+++ ld/emulparams/armelfb.sh	2001/12/22 06:22:41	1.1
@@ -0,0 +1,22 @@
+MACHINE=
+SCRIPT_NAME=elf
+OUTPUT_FORMAT="elf32-bigarm"
+BIG_OUTPUT_FORMAT="elf32-bigarm"
+LITTLE_OUTPUT_FORMAT="elf32-littlearm"
+TEXT_START_ADDR=0x8000
+TEMPLATE_NAME=armelf
+OTHER_TEXT_SECTIONS='*(.glue_7t) *(.glue_7)'
+OTHER_BSS_SYMBOLS='__bss_start__ = .;'
+OTHER_BSS_END_SYMBOLS='_bss_end__ = . ; __bss_end__ = . ; __end__ = . ;'
+
+GENERATE_SHLIB_SCRIPT=yes
+
+ARCH=arm
+MACHINE=
+MAXPAGESIZE=256
+ENTRY=_start
+EMBEDDED=yes
+
+# Hmmm, there's got to be a better way.  This sets the stack to the
+# top of the simulator memory (2^19 bytes).
+OTHER_RELOCATING_SECTIONS='.stack 0x80000 : { _stack = .; *(.stack) }'
-------------- next part --------------
Index: config.sub
===================================================================
RCS file: /prj/cvsroot/ggcc/config.sub,v
--- config.sub	2001/06/05 04:49:53	1.1
+++ config.sub	2001/12/24 19:46:34	1.2
@@ -208,7 +208,7 @@
 		;;
 	# Recognize the basic CPU types with company name.
 	vax-* | tahoe-* | i[34567]86-* | i860-* | m32r-* | m68k-* | m68000-* \
-	      | m88k-* | sparc-* | ns32k-* | fx80-* | arc-* | arm-* | c[123]* \
+	      | m88k-* | sparc-* | ns32k-* | fx80-* | arc-* | arm-* | arme[lb]-* | c[123]* \
 	      | mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* \
 	      | power-* | none-* | 580-* | cray2-* | h8300-* | i960-* \
 	      | xmp-* | ymp-* \
Index: gcc/configure.in
===================================================================
RCS file: /prj/cvsroot/ggcc/gcc/configure.in,v
--- gcc/configure.in	2001/06/18 18:34:31	1.5
+++ gcc/configure.in	2001/12/24 21:41:47	1.7
@@ -717,6 +717,10 @@
 		tm_file=arm/coff.h
 		tmake_file=arm/t-bare
 		;;
+	armeb-*-coff*)
+		tm_file=arm/coffeb.h
+		tmake_file=arm/t-bare
+		;;
 	arm-*-vxworks*)
 		tm_file=arm/vxarm.h
 		tmake_file=arm/t-bare
@@ -792,6 +796,10 @@
 		tm_file=arm/ecos-elf.h
 		tmake_file=arm/t-elf
 		;;
+	arm*eb-*-elf)
+		tm_file=arm/unknown-elfeb.h
+		tmake_file=arm/t-arm-elf
+		;;
 	arm*-*-elf)
 		tm_file=arm/unknown-elf.h
 		tmake_file=arm/t-arm-elf
Index: gcc/configure
===================================================================
RCS file: /prj/cvsroot/ggcc/gcc/configure,v
--- gcc/configure	2001/06/18 18:34:31	1.5
+++ gcc/configure	2001/12/24 21:41:47	1.7
@@ -3146,6 +3146,10 @@
 		tm_file=arm/coff.h
 		tmake_file=arm/t-bare
 		;;
+	armeb-*-coff*)
+		tm_file=arm/coffeb.h
+		tmake_file=arm/t-bare
+		;;
 	arm-*-vxworks*)
 		tm_file=arm/vxarm.h
 		tmake_file=arm/t-bare
@@ -3219,6 +3223,10 @@
 		tm_file=arm/ecos-elf.h
 		tmake_file=arm/t-elf
 		;;
+	arm*eb-*-elf)
+		tm_file=arm/unknown-elfeb.h
+		tmake_file=arm/t-arm-elf
+		;;
 	arm*-*-elf)
 		tm_file=arm/unknown-elf.h
 		tmake_file=arm/t-arm-elf
Index: gcc/config/arm/coffeb.h
===================================================================
RCS file: /prj/cvsroot/ggcc/gcc/config/arm/coffeb.h,v
--- gcc/config/arm/coffeb.h	2001/12/24 21:41:46	1.0
+++ gcc/config/arm/coffeb.h	2001/12/24 21:41:47	1.1
@@ -0,0 +1,14 @@
+#include "arm/coff.h"
+
+/* Change defaults to big endian, and options to little endian. */
+/* Run-time Target Specification.  */
+#undef  TARGET_VERSION
+#define TARGET_VERSION fputs (" (ARM/coffeb)", stderr)
+
+#undef  TARGET_DEFAULT
+#define TARGET_DEFAULT (ARM_FLAG_SOFT_FLOAT | ARM_FLAG_APCS_32 |\
+			ARM_FLAG_BIG_END)
+
+#undef MULTILIB_DEFAULTS
+#define MULTILIB_DEFAULTS { "mbig-endian", "msoft-float", "mapcs-32" }
+
Index: gcc/config/arm/elfeb.h
===================================================================
RCS file: /prj/cvsroot/ggcc/gcc/config/arm/elfeb.h,v
--- gcc/config/arm/elfeb.h	2001/12/24 21:41:46	1.0
+++ gcc/config/arm/elfeb.h	2001/12/24 21:41:47	1.1
@@ -0,0 +1,26 @@
+/* Change defaults to big endian, and allow little endian flags to work. */
+
+#ifndef ASM_SPEC
+#define ASM_SPEC "%{mlittle-endian:-EL} %{mbig-endian:-EB} %{mcpu=*:-m%*} %{march=*:-m%*} \
+ %{mapcs-*:-mapcs-%*} %{mthumb-interwork:-mthumb-interwork} %{mapcs-float:mfloat}"
+#endif
+
+#ifndef LINK_SPEC
+#define LINK_SPEC "%{mlittle-endian:-EL} %{mbig-endian:-EB} -X"
+#endif
+  
+/* Run-time Target Specification.  */
+#ifndef TARGET_VERSION
+#define TARGET_VERSION fputs (" (ARM/elfeb)", stderr)
+#endif
+
+#ifndef TARGET_DEFAULT
+#define TARGET_DEFAULT (ARM_FLAG_SOFT_FLOAT | ARM_FLAG_APCS_32 | ARM_FLAG_BIG_END)
+#endif
+
+#ifndef MULTILIB_DEFAULTS
+#define MULTILIB_DEFAULTS { "mbig-endian", "msoft-float", "mapcs-32", "mno-thumb-interwork" }
+#endif
+
+#include "arm/elf.h"
+
Index: gcc/config/arm/unknown-elfeb.h
===================================================================
RCS file: /prj/cvsroot/ggcc/gcc/config/arm/unknown-elfeb.h,v
--- gcc/config/arm/unknown-elfeb.h	2001/12/24 21:41:46	1.0
+++ gcc/config/arm/unknown-elfeb.h	2001/12/24 21:41:47	1.1
@@ -0,0 +1,26 @@
+/* Change defaults to big endian, and allow little endian flags to work. */
+
+#ifndef ASM_SPEC
+#define ASM_SPEC "%{mlittle-endian:-EL} %{mbig-endian:-EB} %{mcpu=*:-m%*} %{march=*:-m%*} \
+ %{mapcs-*:-mapcs-%*} %{mthumb-interwork:-mthumb-interwork} %{mapcs-float:mfloat}"
+#endif
+
+#ifndef LINK_SPEC
+#define LINK_SPEC "%{mlittle-endian:-EL} %{mbig-endian:-EB} -X"
+#endif
+  
+/* Run-time Target Specification.  */
+#ifndef TARGET_VERSION
+#define TARGET_VERSION fputs (" (ARM/elfeb non-Linux)", stderr)
+#endif
+
+#ifndef TARGET_DEFAULT
+#define TARGET_DEFAULT (ARM_FLAG_SOFT_FLOAT | ARM_FLAG_APCS_32 | ARM_FLAG_BIG_END)
+#endif
+
+#ifndef MULTILIB_DEFAULTS
+#define MULTILIB_DEFAULTS { "mbig-endian", "msoft-float", "mapcs-32", "mno-thumb-interwork" }
+#endif
+
+#include "arm/unknown-elf.h"
+

-------------- next part --------------
------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com


More information about the crossgcc mailing list