How to compile clang to use as compiler for avr?

谁说我不能喝 提交于 2019-12-11 05:25:31

问题


I'd like to cross-compile clang to use as compiler for avr (arduino to be more detailed). i feel i should do smth like next:

  1. create standalone toolchain from android ndk
  2. compile with correct CC and CXX parameters.

Smth else? Does it support --target=avr or how can i compile? Does it make sense as it will be used like IDE autocompletion tool to parse the sources using clang-c API?

UPDATE: configuration with --host and --target params:

export CROSS_COMPILE=arm-linux-androideabi
export CC=${CROSS_COMPILE}-gcc
export CXX=${CROSS_COMPILE}-g++
export NDK=/softdev/android-ndk-r8e
export ANDROID_NDK_ROOT=/softdev/android-ndk-r8e
export SYSROOT=$NDK/platforms/android-8/arch-arm
export PATH=/softdev/arm-toolchain/bin:$PATH:/softdev/android-ndk-r8e/platforms/android-8/arch-arm

./configure --host=arm-linux-androideabi --target=arm-linux-androideabi --prefix=/softdev/arduinodroid_clang/arm
 make

... leads to make error (Makefile exists):

llvm asmirnov$ sudo make
llvm[0]: Constructing LLVMBuild project information.
configure: error: Already configured in /Users/asmirnov/Documents/dev/src/llvm
make[1]: *** No targets specified and no makefile found.  Stop.
make: *** [cross-compile-build-tools] Error 1

回答1:


The current set of targets in the LLVM repository does not include AVR. This does not mean that there has been no work done towards compiling for AVR, just that it is not in the official source repository.

For documentation on adding a backend to LLVM go here.




回答2:


LLVM contains AVR target since some time now (see http://llvm.org/svn/llvm-project/llvm/trunk/lib/Target/AVR/). The skeleton was added in late 2015 and the majority of backend implementation was done about May 2016.

As of now (2017-09-05), the README.md file says that this target is still experimental and done for a 8-bit Atmel AVR microcontroller.



来源:https://stackoverflow.com/questions/19006000/how-to-compile-clang-to-use-as-compiler-for-avr

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!