This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
Newlib compilation broken for ARMv6-M
- From: Dirk Behme <dirk dot behme at googlemail dot com>
- To: newlib at sourceware dot org
- Date: Wed, 02 Jul 2008 08:38:45 +0200
- Subject: Newlib compilation broken for ARMv6-M
I try to build newlib 1.16 with arm-none-eabi-gcc 4.2.3 (Sourcery G++
Lite 2008q1-126). This is able to compile code for ARMv6-M. Newlib
configuration with this results in
MULTIDIRS = thumb thumb2 armv6-m
With this, I get the following errors:
While compiling with -mthumb -march=armv7:
newlib-1.16.0/newlib/libc/machine/arm/setjmp.S:123: Error: SP not
allowed in register list -- `stmea a1!,{v1-v7,fp,ip,sp,lr}'
newlib-1.16.0/newlib/libc/machine/arm/setjmp.S:145: Error: SP not
allowed in register list -- `ldmfd a1!,{v1-v7,fp,ip,sp,lr}'
While compiling with -mthumb -march=armv6-m:
newlib-1.16.0/newlib/libc/sys/arm/trap.S:88: Error: lo register
required -- `sub ip,sp,ip'
newlib-1.16.0/newlib/libc/sys/arm/crt0.S:30: Error: selected processor
does not support ARM opcodes
newlib-1.16.0/newlib/libc/sys/arm/crt0.S:57: Error: attempt to use an
ARM instruction on a Thumb-only processor -- `mov r0,#0x16'
newlib-1.16.0/newlib/libc/sys/arm/crt0.S:58: Error: attempt to use an
ARM instruction on a Thumb-only processor -- `adr r1,.LC0'
...
newlib-1.16.0/newlib/libc/machine/arm/setjmp.S:123: Error: attempt to
use an ARM instruction on a Thumb-only processor -- `stmea
a1!,{v1-v7,fp,ip,lr}'
newlib-1.16.0/newlib/libc/machine/arm/setjmp.S:132: Error: attempt to
use an ARM instruction on a Thumb-only processor -- `mov a1,#0'
...
and some more similiar errors.
Note that I don't need ARMv6-M newlib, therefore I just disabled the
broken parts. I just want to compile newlib with this compiler for
ARM9 processor. To get this working, I used hack in attachment. It's
mainly wrong, but I want to get things compiling. Maybe it helps for
proper fixing.
Dirk
Index: newlib-1.16.0/newlib/libc/sys/arm/crt0.S
===================================================================
--- newlib-1.16.0.orig/newlib/libc/sys/arm/crt0.S
+++ newlib-1.16.0/newlib/libc/sys/arm/crt0.S
@@ -1,6 +1,8 @@
#include "newlib.h"
#include "swi.h"
+#if !defined(__ARM_ARCH_6M__)
+
/* ANSI concatenation macros. */
#define CONCAT(a, b) CONCAT2(a, b)
#define CONCAT2(a, b) a ## b
@@ -303,3 +305,5 @@ CommandLine: .space 256,0 /* Maximum le
.section .idata$3
.long 0,0,0,0,0,0,0,0
#endif
+
+#endif
Index: newlib-1.16.0/newlib/libc/sys/arm/trap.S
===================================================================
--- newlib-1.16.0.orig/newlib/libc/sys/arm/trap.S
+++ newlib-1.16.0/newlib/libc/sys/arm/trap.S
@@ -1,5 +1,5 @@
/* Run-time exception support */
-#if !defined(__thumb2__)
+#if !defined(__thumb2__) && !defined(__ARM_ARCH_6M__)
#include "swi.h"
/* .text is used instead of .section .text so it works with arm-aout too. */
Index: newlib-1.16.0/newlib/libc/machine/arm/setjmp.S
===================================================================
--- newlib-1.16.0.orig/newlib/libc/machine/arm/setjmp.S
+++ newlib-1.16.0/newlib/libc/machine/arm/setjmp.S
@@ -55,6 +55,8 @@
For Thumb-2 do everything in Thumb mode. */
+#if !defined(__ARM_ARCH_6M__)
+
#ifdef __APCS_26__
#define RET movs pc, lr
#elif defined(__thumb2__)
@@ -120,7 +122,7 @@ SYM (\name):
FUNC_START setjmp
/* Save all the callee-preserved registers into the jump buffer. */
- stmea a1!, { v1-v7, fp, ip, sp, lr }
+ stmea a1!, { v1-v7, fp, ip, lr }
#if 0 /* Simulator does not cope with FP instructions yet. */
#ifndef __SOFTFP__
@@ -142,7 +144,7 @@ SYM (\name):
/* If we have stack extension code it ought to be handled here. */
/* Restore the registers, retrieving the state when setjmp() was called. */
- ldmfd a1!, { v1-v7, fp, ip, sp, lr }
+ ldmfd a1!, { v1-v7, fp, ip, lr }
#if 0 /* Simulator does not cope with FP instructions yet. */
#ifndef __SOFTFP__
@@ -160,3 +162,5 @@ SYM (\name):
FUNC_END longjmp
+#endif
+
Index: newlib-1.16.0/libgloss/arm/linux-crt0.c
===================================================================
--- newlib-1.16.0.orig/libgloss/arm/linux-crt0.c
+++ newlib-1.16.0/libgloss/arm/linux-crt0.c
@@ -11,7 +11,7 @@
static int _main(int argc, char *argv[]) __attribute__((noreturn));
-#if __thumb__ && !__thumb2__
+#if __thumb__ && !__thumb2__ && !__ARM_ARCH_6M__
asm("\n"
".code 32\n"
".global _start\n"
Index: newlib-1.16.0/libgloss/arm/redboot-crt0.S
===================================================================
--- newlib-1.16.0.orig/libgloss/arm/redboot-crt0.S
+++ newlib-1.16.0/libgloss/arm/redboot-crt0.S
@@ -1,5 +1,7 @@
.file "crt0.S"
+
+#if !defined(__ARM_ARCH_6M__)
#define XGLUE(a,b) a##b
#define GLUE(a,b) XGLUE(a,b)
@@ -125,3 +127,4 @@ SYM_NAME(__syscall):
#endif
mov pc, r12
#endif
+#endif
Index: newlib-1.16.0/libgloss/arm/trap.S
===================================================================
--- newlib-1.16.0.orig/libgloss/arm/trap.S
+++ newlib-1.16.0/libgloss/arm/trap.S
@@ -1,5 +1,5 @@
/* Run-time exception support */
-#if !defined(__thumb2__)
+#if !defined(__thumb2__) && !defined(__ARM_ARCH_6M__)
#include "swi.h"
/* .text is used instead of .section .text so it works with arm-aout too. */