Reading time: | 10 min |
Last updated: | 29 Aug 2024 |
Reading time: |
10 min |
Last updated: |
29 Aug 2024 |
This guide is intended to get you up and running with this tool quickly with the most common settings. For a thorough review of all options, refer to the official documentation.
The
LLVM Embedded Toolchain for Arm
allows Cortex-M developers to build projects with the clang
compiler.
Pre-built binaries are available for Windows (x86_64), macOS (x86_64 and Apple Silicon), and Linux (x86_64 and AArch64) hosts.
Copy and paste the URL below into your browser to download the latest release from GitHub:
https://github.com/ARM-software/LLVM-embedded-toolchain-for-Arm/releases/download/release-18.1.3/LLVM-ET-Arm-18.1.3-Windows-x86_64.zip
Unzip the download to a location of your choice on your host machine.
Open Windows Control Panel
and add the LLVM bin
directory to the Path
.
Open a Command Prompt
and
test your installation
.
Copy and paste the URL below into your browser to download the latest release from GitHub:
https://github.com/ARM-software/LLVM-embedded-toolchain-for-Arm/releases/download/release-18.1.3/LLVM-ET-Arm-18.1.3-Darwin-universal.dmg
Install the toolchain by clicking on the dmg file and following the instructions.
Add the LLVM bin
directory to your PATH
:
export PATH=/Applications/LLVM-ET-Arm-18.1.3-Darwin-universal/bin:$PATH
The toolchain binaries may be quarantined. Navigate to the bin
directory and use the xattr
command to remove the quarantine:
cd /Applications/LLVM-ET-Arm-18.1.3-Darwin-universal/bin
find . -type f -perm +0111 | xargs xattr -d com.apple.quarantine
You can now test your installation .
The information below assumes Ubuntu Linux
on an AArch64
host. Modify the filenames and paths as needed for other hosts.
Download the latest release using wget
:
wget https://github.com/ARM-software/LLVM-embedded-toolchain-for-Arm/releases/download/release-18.1.3/LLVM-ET-Arm-18.1.3-Linux-AArch64.tar.xz
Open a terminal application and use tar
to extract the file:
tar xfJ LLVM-ET-Arm-18.1.3-Linux-AArch64.tar.xz -C $HOME
Add the LLVM bin
directory to your PATH
:
export PATH=$HOME/LLVM-ET-Arm-18.1.3-Linux-AArch64/bin:$PATH
You can now test your installation .
Use the --version
option to verify the correct compiler is being invoked:
clang --version
You should observe output similar to:
clang version 18.1.3
Target: aarch64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/ubuntu/LLVM-ET-Arm-18.1.3-Linux-AArch64/bin
Use a text editor to create an example source file with the name hello.c
and the code below:
#include <stdio.h>
int main()
{
printf("hello");
return 0;
}
A number of compiler options are needed. See Using the toolchain for full details.
To build for Armv6-M
:
clang --target=armv6m-none-eabi -fno-exceptions -fno-rtti -lcrt0-semihost -lsemihost -T picolibc.ld -o hello_v6m hello.c
To build for Armv7-M
:
clang --target=armv7m-none-eabi -fno-exceptions -fno-rtti -lcrt0-semihost -lsemihost -T picolibc.ld -o hello_v7m hello.c
The applications can be run on Fixed Virtual Platforms (FVP) .
There is no FVP release for macOS.
To run the Armv6-M
example on Cortex-M0
FVP:
FVP_MPS2_Cortex-M0 -a hello_v6m
To run the Armv7-M
example on Cortex-M3
FVP:
FVP_MPS2_Cortex-M3 -a hello_v7m
You will see the hello
message on the console (as well as other diagnostic output from the FVP):
telnetterminal1: Listening for serial connection on port 5000
telnetterminal2: Listening for serial connection on port 5002
telnetterminal0: Listening for serial connection on port 5001
hello
Info: /OSCI/SystemC: Simulation stopped by user.
How would you rate the overall quality of this tool quick-install guide?
What is the primary reason for your feedback ?
Thank you. We're grateful for your feedback on how to improve this tool quick-install guide.