About this Install Guide

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.

Windows

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-16.0.0/LLVMEmbeddedToolchainForArm-16.0.0-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 .

macOS

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-16.0.0/LLVMEmbeddedToolchainForArm-16.0.0-Darwin.tar.gz
        
    

Open a terminal application and use tar to extract the file:

    

        
        
            tar -xf ~/Downloads/LLVMEmbeddedToolchainForArm-16.0.0-Darwin.tar.gz -C $HOME
        
    

Add the LLVM bin directory to your PATH:

    

        
        
            export PATH=$HOME/LLVMEmbeddedToolchainForArm-16.0.0-Darwin/bin:$PATH
        
    

The toolchain binaries may be quarantined. Navigate to the bin directory and use the xattr command to remove the quarantine:

    

        
        
            cd $HOME/LLVMEmbeddedToolchainForArm-16.0.0-Darwin/bin
find . -type f -perm +0111 | xargs xattr -d com.apple.quarantine
        
    

You can now test your installation .

Linux

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-16.0.0/LLVMEmbeddedToolchainForArm-16.0.0-Linux-AArch64.tar.gz
        
    

Open a terminal application and use tar to extract the file:

    

        
        
            tar -xf LLVMEmbeddedToolchainForArm-16.0.0-Linux-AArch64.tar.gz -C $HOME
        
    

Add the LLVM bin directory to your PATH:

    

        
        
            export PATH=$HOME/LLVMEmbeddedToolchainForArm-16.0.0-Linux-AArch64/bin:$PATH
        
    

Install the required library libtinfo5:

    

        
        
            sudo apt install -y libtinfo5
        
    

You can now test your installation .

Test installation

Verify the clang installation

Use the --version option to verify the correct compiler is being invoked:

    

        
        
            clang --version
        
    

You should observe output similar to:

    

        
        clang version 16.0.0
Target: aarch64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/ubuntu/LLVMEmbeddedToolchainForArm-16.0.0-Linux-AArch64/bin

        
    

Build a simple application

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
        
    

Run the examples

The applications can be run on Fixed Virtual Platforms (FVP) .

Note

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.

        
    

Feedback

How would you rate the overall quality of this tool quick-install guide?