[LLVMdev] Setting up a cross-compiler for cortex-m3

salvatore benedetto salvatore.benedetto at gmail.com
Wed Jul 18 09:08:12 PDT 2012


On Wed, Jul 18, 2012 at 5:45 PM, Renato Golin <rengolin at systemcall.org> wrote:
> On 18 July 2012 15:46, salvatore benedetto
> <salvatore.benedetto at gmail.com> wrote:
>> $ clang++ -ccc-host-triple thumbv7m-none-gnueabi noInclude.cpp -c
>> --sysroot=/home/emitrax/CodeSourcery/Sourcery_G++_Lite/arm-none-linux-gnueabi/libc/
>
> Try -ccc-gcc-name arm-none-linux-gnueabi-g++ -ccc-host-triple
> thumbv7m-none-linux-gnueabi
>
> Sometimes it's better than sysroot, as it finds it all by itself.

And the winner is..

clang++ -ccc-gcc-name arm-none-linux-gnueabi-g++ -ccc-host-triple
thumbv7m-none-gnueabi testReference.cpp -c

It seems like it worked.

$ arm-none-linux-gnueabi-objdump -D --section=.text testReference.o

testReference.o:     file format elf32-littlearm


Disassembly of section .text:

00000000 <main>:
   0:	e92d4800 	push	{fp, lr}
   4:	e1a0b00d 	mov	fp, sp
   8:	e24dd030 	sub	sp, sp, #48	; 0x30
...

I'm not 100% sure if that's the correct ISA, because I haven't run the
code, but it seems ok.

I of course own you a beer :-) Thank you very much.

Now, a grep of clang++ --ccc-gcc-name didn't give any result so I'm
still wondering what
exactly I am doing here.

Which part of gcc I'm using with that option?
Just the libc, libgcc et all?

Regards,
S.



More information about the llvm-dev mailing list