Postby ESP_igrr » Wed Feb 13, 2019 7:58 am

has to be used together with GNU Binutils and GCC-built libraries

Code: Select all git clone https://github.com/espressif/llvm-xtensa.git git clone https://github.com/espressif/clang-xtensa.git llvm-xtensa/tools/clang mkdir llvm_build cd llvm_build cmake ../llvm-xtensa -DLLVM_TARGETS_TO_BUILD=Xtensa -DCMAKE_BUILD_TYPE=Release -G "Ninja" cmake --build .

Code: Select all llvm_build/bin/clang -target xtensa -fomit-frame-pointer -S test.c -o test.S

In some of the existing topics it has been already mentioned that Espressif is working on adding Xtensa support to LLVM. Today we are releasing the first work-in-progress version based on release/6.x branch of LLVM.The compiler is now in the stage of active development and testing. It was successfully tested using GCC torture testsuite and multiple ESP-IDF applications (although ESP-IDF versions available on Github do not support LLVM/Clang out of the box, yet).Current release can generate Xtensa assembly code as output (not object files!), and(libgcc, libstdc++, newlib) to create object and binary files.- support Xtensa Core Architecture instructions- support Code Density option- support Windowed Register option- support Floating-Point Coprocessor option- support Boolean option (only a subset of instructions)- support Thread Pointer option- support atomic operations- ESP32 target (used by default, can be selected withflags)- ESP8266 target (can be selected withflags)Compiler optimization levels include O0/O1/O2/O3/Os options.Since at the current release is not intended for developers who just want to build ESP-IDF apps, we do not provide binary releases of LLVM for Xtensa, yet. To compile LLVM from source, follow these steps:Create a test.c source file and run:This should produce test.S, an assembly file produced from test.c. You can then use the existing xtensa-esp32-elf-as assembler to generate the object file.Development of the compiler and its testing is constantly ongoing. In future releases, improved performance is planned, such as support for Zero Overhead Loop optimization, support for various architectures and targets.Object code generation and standalone toolchain based on Clang/LLVM is also planned.Summary features which will be implemented in next releases:- rebasing on the upstream version of LLVM, following the new monorepo layout ( https://github.com/llvm/llvm-project/ ).- object code generation- support for LX106 target (ESP8266)- binary releases on Github- support for using LLVM to build ESP-IDF apps- improvements of generated code performance- support for zero-overhead loop option- MAC16 option- PSRAM cache workaround for ESP32 chipFor general questions and feedback, please post in this forum thread. For specific bug reports (code generation, handling of some language features) please use https://github.com/espressif/llvm-xtensa/issues : support for both ESP32 and ESP8266 targets (-mcpu=esp32, -mcpu=esp8266)