[LLVMdev] Setting up a cross-compiler for cortex-m3
salvatore benedetto
salvatore.benedetto at gmail.com
Wed Jul 18 06:33:38 PDT 2012
Hi there,
I'm trying to switch from GCC to llvm (clang++) for cross-compiling
a firmware of mine for a stm32 (ARM cortex-m3).
After looking in the documentation and a bit of googling here is what
I did (in case someone else in the future is having the same problem)
cd llvm
git clone http://llvm.org/git/llvm.git
cd llvm/tools
git clone http://llvm.org/git/clang.git
cd llvm/projects
git clone http://llvm.org/git/compiler-rt.git
cd ../llvm-build/
../llvm/configure --prefix=$(HOME)/bin/llvm
--exec-prefix=$(HOME)/bin/llvm --enable-targets=x86_64,arm,cpp
--enable-optimized
make
make install
It seems everything compiled smoothly, but I can't figure out if there
is any options that list all available targets.
The following only display my host platform as target.
clang -v
clang version 3.2 (http://llvm.org/git/clang.git
88237bf587581026dcfc8386abf055cb201aa487)
(http://llvm.org/git/llvm.git
18a1b616ea123548b61a037c4f4fea4133aac1b5)
Target: x86_64-unknown-linux-gnu
Thread model: posix
After some more bit of searching I managed to build for cortex-a with
clang -march=armv7-a -mfloat-abi=soft -ccc-host-triple arm-elf
-integrated-as testReference.cpp -c
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
If anyone can point me to some reading or shine some light on this
one, I'd really appreciate it.
Thanks,
Salvatore
More information about the llvm-dev
mailing list