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

salvatore benedetto salvatore.benedetto at gmail.com
Wed Jul 18 06:57:50 PDT 2012


On Wed, Jul 18, 2012 at 3:52 PM, Renato Golin <rengolin at systemcall.org> wrote:
> On 18 July 2012 14:33, salvatore benedetto
> <salvatore.benedetto at gmail.com> wrote:
>> but I still haven't figure out how to build for cortex-m3
>>
>> clang -march=armv7-m -mfloat-abi=soft <something missing?> testReference.cpp -c
>
> -march should have done the trick.
>
> You can also try -mcpu=cortex-m3,
>
> or try -ccc-host-triple armv7m-none-gnueabi (or -eabi),

I've tried with all of the following

$ clang -march=armv7-m -mfloat-abi=soft -triple thumb2-unknown-unknown
-integrated-as testReference.cpp -c
clang: warning: argument unused during compilation: '-mfloat-abi=soft'
clang: warning: argument unused during compilation: '-triple
thumb2-unknown-unknown'
error: unknown target CPU 'armv7-m'

$ clang -march=armv7-m -mfloat-abi=soft -mcpu=cortex-m3 testReference.cpp -c
clang: warning: argument unused during compilation: '-mfloat-abi=soft'
clang: warning: argument unused during compilation: '-mcpu=cortex-m3'
error: unknown target CPU 'armv7-m'

$ clang -mcpu=cortex-m3 testReference.cpp -c
clang: warning: argument unused during compilation: '-mcpu=cortex-m3'

$ clang -march=armv7-m -mfloat-abi=soft -ccc-host-triple
armv7m-none-gnueabi testReference.cpp -c
fatal error: error in backend: CPU: 'cortex-m3' does not support ARM
mode execution!

> and possibly -ccc-gcc-name code sourcery's gcc,
>
> or possibly --sysroot=code sourcery/libc

I guess those would be used for the linking part?

Anyway thanks for your rapid response.

S.



More information about the llvm-dev mailing list