This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
Building for cortex-m3
- From: Simon Wright <simon at pushface dot org>
- To: newlib at sourceware dot org
- Date: Sun, 17 Apr 2011 17:21:56 +0100
- Subject: Building for cortex-m3
I'm a newbie at Newlib, so please pardon any stupidities.
I've been trying to build newlib-1.19.0 with GCC-4.6.0 for use with a bare cortex-m3 (under qemu at the moment).
The configurations I've tried include as basis
$ ../newlib-1.19.0/configure --target=arm-none-eabi --disable-newlib-supplied-syscalls
and with just this I see that libgloss/arm/crt0.S and newlib/libc/sys/arm/crt0.S both compile _mainCRTStartup in ARM mode; which (I think) isn't going to work on the M3. They define FUNC_START as
#if defined(__thumb2__)
.syntax unified
.thumb
.macro FUNC_START name
.global \name
.thumb_func
\name:
.endm
#else
.code 32
.macro FUNC_START name
.global \name
\name:
.endm
#endif
so what happens if just __thumb__ is defined? (actually, I'm not at all clear whether it is or not; is it a GCC builtin?).
I've gone to my build directory and compiled arm-none-eabi/thumb/newlib/libc/sys/arm/crt0.o (which is suppressed in the Makefile). I copied it to $prefix/arm-none-eabi//lib/thumb/crt0.o with no effect, then to $prefix/arm-none-eabi//lib/crt0.o which was used in my build. (The fact that I'm now getting a usage fault is, I think, progress!) Shouldn't crt0.o be part of the multilib scheme?
TIA for any suggestions/pointers/...
--S