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

salvatore benedetto salvatore.benedetto at gmail.com
Wed Jul 18 07:24:28 PDT 2012


On Wed, Jul 18, 2012 at 4:15 PM, Renato Golin <rengolin at systemcall.org> wrote:
> On 18 July 2012 14:57, salvatore benedetto
> <salvatore.benedetto at gmail.com> wrote:
>> $ 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!
>
> Ah, yes! Try:
>
> $ clang -ccc-host-triple thumbv7m-none-gnueabi testReference.cpp -c
>
> Cross compilation in Clang is very broken at the moment. There was
> some effort to fix this last year, but I guess it lost momentum...

Almost there I'd say...

$ clang++ -ccc-host-triple thumbv7m-none-gnueabi testReference.cpp -c -v
clang version 3.2 (http://llvm.org/git/clang.git
88237bf587581026dcfc8386abf055cb201aa487)
(http://llvm.org/git/llvm.git
18a1b616ea123548b61a037c4f4fea4133aac1b5)
Target: thumbv7m-none--gnueabi
<------------------------------------------- Seems OK!
Thread model: posix
 "/home/emitrax/bin/llvm/bin/clang" -cc1 -triple armv4t-none--gnueabi
-S -disable-free -main-file-name testReference.cpp -mrelocation-model
static -mdisable-fp-elim -fmath-errno -mconstructor-aliases
-target-abi aapcs-linux -target-cpu arm7tdmi -mfloat-abi soft
-target-feature +soft-float-abi -target-linker-version
2.21.53.20110810 -momit-leaf-frame-pointer -v -coverage-file
/tmp/testReference-Shww7Y.s -resource-dir
/home/emitrax/bin/llvm/bin/../lib/clang/3.2 -fmodule-cache-path
/var/tmp/clang-module-cache -fdeprecated-macro
-fno-dwarf-directory-asm -fdebug-compilation-dir
/home/emitrax/programming -ferror-limit 19 -fmessage-length 106
-mstackrealign -fobjc-runtime=gcc -fcxx-exceptions -fexceptions
-fdiagnostics-show-option -fcolor-diagnostics -o
/tmp/testReference-Shww7Y.s -x c++ testReference.cpp
clang -cc1 version 3.2 based upon LLVM 3.2svn default target
x86_64-unknown-linux-gnu
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/include
 /home/emitrax/bin/llvm/bin/../lib/clang/3.2/include
 /usr/include
End of search list.
 "/usr/bin/g++" -v -c -o testReference.o -x assembler
/tmp/testReference-Shww7Y.s
Using built-in specs.
COLLECT_GCC=/usr/bin/g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.6.1/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro
4.6.1-9ubuntu3'
--with-bugurl=file:///usr/share/doc/gcc-4.6/README.Bugs
--enable-languages=c,c++,fortran,objc,obj-c++,go --prefix=/usr
--program-suffix=-4.6 --enable-shared --enable-linker-build-id
--with-system-zlib --libexecdir=/usr/lib --without-included-gettext
--enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.6
--libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu
--enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-plugin
--enable-objc-gc --disable-werror --with-arch-32=i686
--with-tune=generic --enable-checking=release --build=x86_64-linux-gnu
--host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.6.1 (Ubuntu/Linaro 4.6.1-9ubuntu3)
COLLECT_GCC_OPTIONS='-v' '-c' '-o' 'testReference.o' '-shared-libgcc'
'-mtune=generic' '-march=x86-64'
 as --64 -o testReference.o /tmp/testReference-Shww7Y.s
/tmp/testReference-Shww7Y.s: Assembler messages:
/tmp/testReference-Shww7Y.s:1: Error: unknown pseudo-op: `.syntax'
/tmp/testReference-Shww7Y.s:2: Error: unknown pseudo-op: `.eabi_attribute'
... and on for a bit.

The source code of course compiles fine with g++ 4.6.1 in case you are
wondering.

I'm not sure how to interpret the above output, but I don't understand
why if say  -triple armv4t-none--gnueabi .

Thanks a lot for your time.

Regards,
Salvatore



More information about the llvm-dev mailing list