This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Building for cortex-m3


Jon suggested I rebuild newlib with GCC. I withdraw my remarks about multilib and crt0.o (which may have been down to leaving -mthumb out of the ld command) but crt0.o is still miscompiled: objdump -D says

$ arm-none-eabi-objdump -D crt0.o

crt0.o:     file format elf32-littlearm

Disassembly of section .text:

00000000 <_mainCRTStartup>:
   0:   e59f30d0        ldr     r3, [pc, #208]  ; d8 <change_back+0x8>
   4:   e3530000        cmp     r3, #0
....

which is ARM code, isn't it?

--S

On 17 Apr 2011, at 22:56, Jon Beniston wrote:

> Try building newlib with GCC (copy newlib and libgloss subdirs into gcc
> source dir)
> 
> http://wyper.ca/news/2009/05/building-gcc-for-arm-cortex-m3/
> 
> Cheers,
> Jon
> 
>> -----Original Message-----
>> From: newlib-owner@sourceware.org [mailto:newlib-
>> owner@sourceware.org] On Behalf Of Simon Wright
>> Sent: 17 April 2011 17:22
>> To: newlib@sourceware.org
>> 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
> 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]