Skip to content

Instantly share code, notes, and snippets.

@disposedtrolley
Created August 27, 2020 10:46
Show Gist options
  • Save disposedtrolley/06d37e1db82b80ccf8c5d801eaa29373 to your computer and use it in GitHub Desktop.
Save disposedtrolley/06d37e1db82b80ccf8c5d801eaa29373 to your computer and use it in GitHub Desktop.
Installing the GNU ARM Embedded Toolchain for macOS

Introduction

The ARM Embedded Toolchain is a GNU licensed cross compiler for ARM CPU architectures, allowing you to compile C/C++ code into binaries which can execute on CPUs such as the Cortex-M line of microcontrollers.

When dealing with C/C++ embedded development, you have the choice of several compilers. Keil is probably the most well-known commercial brand in the embedded toolchain space. They have their own proprietary compiler and IDE which is quite popular for commercial applications (it's pricey and only runs on Windows).

We'll be focusing on the ARM toolchain, which is open source under a GNU license and free to use for all projects.

Download

Visit the downloads page. and download the .pkg file labeled with Mac OS X 64-bit Package (Signed and notarized).

Sidenote: Prior to the 9-2020-q2-update, a notarised installer for macOS was not available which meant that macOS would display a security warning and refuse to run any tools unless you explicitly grant permission in the Security & Privacy preferences pane, or run a CLI command to whitelist all binaries in the toolchain folder.

Install

Run the .pkg installer. cd /Applications/ARM and you should see the following structure:

.
├── arm-none-eabi
│   ├── bin
│   ├── include
│   ├── lib
│   └── share
├── bin
│   ├── arm-none-eabi-addr2line
│   ├── arm-none-eabi-ar
│   ├── arm-none-eabi-as
│   ├── arm-none-eabi-c++
│   ├── arm-none-eabi-c++filt
│   ├── arm-none-eabi-cpp
│   ├── arm-none-eabi-elfedit
│   ├── arm-none-eabi-g++
│   ├── arm-none-eabi-gcc
│   ├── arm-none-eabi-gcc-9.3.1
│   ├── arm-none-eabi-gcc-ar
│   ├── arm-none-eabi-gcc-nm
│   ├── arm-none-eabi-gcc-ranlib
│   ├── arm-none-eabi-gcov
│   ├── arm-none-eabi-gcov-dump
│   ├── arm-none-eabi-gcov-tool
│   ├── arm-none-eabi-gdb
│   ├── arm-none-eabi-gdb-add-index
│   ├── arm-none-eabi-gdb-add-index-py
│   ├── arm-none-eabi-gdb-py
│   ├── arm-none-eabi-gprof
│   ├── arm-none-eabi-ld
│   ├── arm-none-eabi-ld.bfd
│   ├── arm-none-eabi-nm
│   ├── arm-none-eabi-objcopy
│   ├── arm-none-eabi-objdump
│   ├── arm-none-eabi-ranlib
│   ├── arm-none-eabi-readelf
│   ├── arm-none-eabi-size
│   ├── arm-none-eabi-strings
│   └── arm-none-eabi-strip
├── lib
│   ├── gcc
│   ├── libcc1.0.so
│   └── libcc1.so -> libcc1.0.so
└── share
    ├── doc
    └── gcc-arm-none-eabi

Most third-party tools and IDEs will try and execute various binaries in the ./bin folder (e.g. the arm-none-eabi-g++ C++ compiler), so add that to your PATH.

That's it! You should be able to run arm-none-eabi-g++ anywhere on your system to execute the C++ cross compiler. Happy hacking!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment