Arm Toolchain for Embedded (ATfE)
- Arm Toolchain for Embedded (ATfE) is a C and C++ toolchain from Arm based
- on the free and open-source LLVM Compiler Infrastructure and the Picolib C library for baremetal targets. 
- ATfE is fined-tuned with a particular focus on performance for newer
- ARM products (post 2024) like 64-bit Arm Architectures (AArch64), or the M-Profile Vector Extension (MVE, a 32-bit Armv8.1-M extension). 
Installation
- Download and install a Arm toolchain for embedded build for your operating system and extract it on your file system. 
- Set these environment variables: - Set - ZEPHYR_TOOLCHAIN_VARIANTto- llvm.
- Set - LLVM_TOOLCHAIN_PATHto the toolchain installation directory.
 
- To check that you have set these variables correctly in your current environment, follow these example shell sessions (the - LLVM_TOOLCHAIN_PATHvalues may be different on your system):- echo $ZEPHYR_TOOLCHAIN_VARIANT llvm echo $LLVM_TOOLCHAIN_PATH /home/you/Downloads/ATfE - echo $ZEPHYR_TOOLCHAIN_VARIANT llvm echo $LLVM_TOOLCHAIN_PATH /home/you/Downloads/ATfE - > echo %ZEPHYR_TOOLCHAIN_VARIANT% llvm > echo %LLVM_TOOLCHAIN_PATH% C:\ATfE 
- You can also set - ZEPHYR_TOOLCHAIN_VARIANTand- LLVM_TOOLCHAIN_PATHas CMake variables when generating a build system for a Zephyr application, like so:- west build … – -DZEPHYR_TOOLCHAIN_VARIANT=llvm -DLLVM_TOOLCHAIN_PATH=… 
Toolchain settings
- Because LLVM is widely compatible with GNU tools, When builiding with any
- LLVM toolchain, you have to specify some settings to let the compiler know what tools to use: 
- Linker:
- Set - CONFIG_LLVM_USE_LLD=yto use LLVM linker. set- CONFIG_LLVM_USE_LD=yto use the GNU LD linker.
- Runtime library:
- Set - CONFIG_COMPILER_RT_RTLIB=yto use LLVM runtime library. Set- CONFIG_LIBGCC_RTLIB=yto use LibGCC runtime library.
west build ... -- -DZEPHYR_TOOLCHAIN_VARIANT=llvm -DLLVM_TOOLCHAIN_PATH=... -DCONFIG_LLVM_USE_LLD=y -DCONFIG_COMPILER_RT_RTLIB=y