Installing Arm Embedded GCC on Fedora 35
2022-01-07 / raynayX

The Need

Most personal computers these days use CPUs of the x86_64 architecture. In order to build software for them, one needs tools that build binaries compatible with said architecture. A typical flow is writing the software in a compiled language (say C,C++) and then using compilers and linkers to convert the English-like text into machine readable instructions. For the personal computer space, one will need tools like MSVC,Clang or GCC for such a workflow.

However, as stated earlier, these tools will produce machine readable instructions for the x86_64 architecture. If one needs to build software for any other type of architecture, one needs any of the compiler toolchains for the specific architecture in question. In this text, my concern is with writing code for the ARM architecture which has become very popular. The ARM architecture is found in most mobile phones in the form of the A-series(say Cortex A-76), in microcontrollers (say Cortex M-4) and others.

It follows therefore that to build for the ARM architecture, one will need an ARM specific compiler toolchain. GCC is a common compiler toolchain that is opensource and free. And ARM provides the ARM specific GCC toolchain.
Since, most PCs today are x86_64, you would have to build for ARM on an x86_64 computer – a process known as cross-compiling.

Arm Embedded GCC Toolchain

The Embedded GCC Toolchain is made up of compilers,linkers,debuggers and some other utilities that make the work of an embedded software developer simpler.
The default compilers are: arm-none-eabi-gcc,arm-none-eabi-g++. There is also a linker –arm-none-eabi-ld and the venerable gdb debugger in its tasteful ARM flavour as arm-none-eabi-gdb.
In order to make use of them, we need to have them installed on our system. Here is one way that can be done on Fedora(35) as tested.

The How

In order to install the GCC toolchain for ARM on Fedora(35),

  • Go to developer.arm.com to fetch the latest compiler set which comes as a compressed file.

  • Remove any vestiges of previous installs by running:

    1
    $ sudo dnf remove binutils-arm-none-eabi gcc-arm-none-eabi libnewlib-arm-none-eabi
  • If the feedback is No packages marked for removal, that’s fine as there are no previous installations on the sysem.

  • Then run the following commands:

    1
    2
    3
    4
    $ mkdir ~/opt   #create opt in $HOME
    $ cd ~/opt #change into opt
    $ tar -xvf *.bz2 #uncompress the file
    $ chmod -R -w gcc-arm-none-eabi-* #
  • Add the path to the .bashrc file to make the toolchain available system wide:

    1
    export PATH=$PATH:~/opt/gcc-arm-none-eabi-*/bin/
  • Source the .bashrc file thus:

    1
    $ source ~/.bashrc
  • If libncurses.so.5 library is not present on the Fedora system, run:

    1
    $ sudo dnf install ncurses-compat-libs

Confirm installation

After installing, you can run the following in a new terminal window:

1
$ arm-none-eabi-gcc --version

If you get a feedback stating:
arm-none-eabi-gcc (GNU Arm Embedded Toolchain 10.3-2021.10) 10.3.1 20210824 (release) with dates that match the version you downloaded, then you have correctly installed the ARM Toolchain.

Next

After installation, the next step will be to use the shinny new toolchain. We will take a look at doing that pretty soon!

PermaLink:
https://raynayx.com/2022/01/07/armToolChain/