salvatore benedetto
2012-Jul-18 13:30 UTC
[LLVMdev] Setting up a cross-compiler for cortex-m3
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
salvatore benedetto
2012-Jul-18 13:33 UTC
[LLVMdev] Setting up a cross-compiler for cortex-m3
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
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), and possibly -ccc-gcc-name code sourcery's gcc, or possibly --sysroot=code sourcery/libc -- cheers, --renato http://systemcall.org/
Seemingly Similar Threads
- [LLVMdev] Setting up a cross-compiler for cortex-m3
- [LLVMdev] Setting up a cross-compiler for cortex-m3
- [LLVMdev] Setting up a cross-compiler for cortex-m3
- [LLVMdev] Setting up a cross-compiler for cortex-m3
- [LLVMdev] Setting up a cross-compiler for cortex-m3