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.

GCC is available on all Linux distributions and can be installed using the package manager.

This covers gcc and g++ for compiling C and C++ as a cross-compiler targeting the Arm architecture.

Before you begin

GCC is often used to cross-compile software for Arm microcontrollers and embedded devices which have firmware and other low-level software. The executables are arm-none-eabi-gcc and arm-none-eabi-g++.

GCC is also used to cross compile Linux applications. Applications can be compiled for 32-bit or 64-bit Linux systems.

The executables for 32-bit are arm-linux-gnueabihf-gcc and arm-linux-gnueabihf-g++.

The executables for 64-bit are aarch64-linux-gnu-gcc and aarch64-linux-gnu-g++.

Software can be compiled on an x86 or Arm host machine.

Download

The Linux package manager will download the required files so there are no special download instructions.

Installation

Installing on Debian based distributions such as Ubuntu

Use the apt command to install software packages on any Debian based Linux distribution.

    

        
        
            sudo apt update
sudo apt install gcc-arm-none-eabi -y
sudo apt install gcc-arm-linux-gnueabihf -y
sudo apt install gcc-aarch64-linux-gnu -y
        
    

Installing on Red Hat / Fedora / Amazon Linux

These Linux distributions use yum as the package manager.

To install the most common development tools use the commands below. If the machine has sudo you can use it or run yum as root.

    

        
        
            sudo yum update -y
sudo yum install arm-none-eabi-gcc-cs -y
sudo yum install arm-none-eabi-newlib -y
sudo yum install gcc-aarch64-linux-gnu -y
sudo yum install gcc-arm-linux-gnu -y
        
    

If sudo is not available become root and omit the sudo.

    

        
        
            yum update
yum install arm-none-eabi-gcc-cs -y
yum install arm-none-eabi-newlib -y
yum install gcc-aarch64-linux-gnu -y
yum install gcc-arm-linux-gnu -y
        
    

Setting up product license

GCC is open source and freely available for use.

Get started

To confirm the installation is successful, enter:

    

        
        
            arm-none-eabi-gcc --version
        
    

To compile an example program, create a text file named hello-world-embedded.c with the contents below.

    

        
        
            #include <stdio.h>

int main()
{
    printf("Hello, Arm World!\n");
    return 0;
}
        
    

To compile hello-world as a bare-metal application:

    

        
        
            arm-none-eabi-gcc --specs=rdimon.specs hello-world-embedded.c -o hello-world.elf
        
    

To cross-compile hello-world as a 32-bit Linux application. On Fedora, only building kernels is currently supported. Support for cross-building user space programs is not currently provided as that would massively multiply the number of packages.

    

        
        
            arm-linux-gnueabihf-gcc  hello-world-embedded.c -o hello-world.elf
        
    

To cross-compile hello-world as a 64-bit Linux application. On Fedora, only building kernels is currently supported. Support for cross-building user space programs is not currently provided as that would massively multiply the number of packages.

    

        
        
            aarch64-linux-gnu-gcc hello-world-embedded.c -o hello-world.elf
        
    

Feedback

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