-
Notifications
You must be signed in to change notification settings - Fork 9
Toolchain Setup
This page explains how to set up ARM GCC on your computer so that you can compile mbed-cmake projects. Note: If you are setting up an mbed-cmake project for the first time, then you will need to follow the Project Configuration instructions after this guide to set up mbed-cmake for your processor target.
- Get CMake by downloading the installer from here. If you already have CMake installed, make sure it's at least version 3.9. Make sure to select "Add CMake to the system PATH for all users"!
- Download the GNU ARM toolchain from ARM's website (get the Windows 32-bit Installer), and install it. Make sure to check "Add path to environment variable" in the installer!
- Install Python 3 so that you can run python from the command line. Don't forget to click the "add to path" checkbox when installing Python!
- Reboot your machine so that the changes to your PATH are applied.
- Install the Python packages "intelhex", "prettytable", and "future":
python -m pip install intelhex prettytable future
.
The toolchain should now be set up!
You will of course need a make tool to use with CMake, and unlike other OSs Windows doesn't come with one out of the box. I tend to use mingw32-make, with the CMake argument "-GMinGW Makefiles"
. mingw32-make is included with MinGW and MSYS2, or if you don't have those installed you can download a standalone version of it here. You can also use Ninja (with -GNinja
) for faster builds with better parallization and decreased scanning time.
- Install cmake with
brew install cmake
in the terminal. - Add a Brew remote for the ARM toolchain:
brew tap osx-cross/arm
- Install the toolchain:
brew install arm-gcc-bin
- Next, make sure Pip is installed to your system python. In a terminal, run
sudo -H python3 -m easy_install pip
- Now, install the needed packages for the build system:
sudo -H python3 -m pip install intelhex prettytable future
The toolchain should now be set up!
- Install CMake >= 3.12.
- For most recent distros, e.g. Ubuntu 18.04 and newer, you can just use the package manager CMake package.
- For Ubuntu 14.04 and 16.04, use this PPA.
- Many distros can also utilize the CMake snap package.
- Otherwise, if your distro doesn't have a version recent enough, you may have to build it from source.
- Download the GNU ARM toolchain from ARM's website (get the Linux x86_64 Tarball) and extract it to your downloads folder.
- Using the terminal, copy the entire folder to /usr/local on your machine by running this command:
sudo cp -r ~/Downloads/gcc-armXXXX /usr/local/gcc-arm
(replace "gcc-armXXXX" with the full name of the folder you extracted). - Navigate to your home directory by typing cd ~. Then, create a bash profile if you don't already have one by typing
vim .bash_profile
- If you use zsh, use .zshrc instead of .bash_profile in these steps
- Add the following line to your .bash_profile file:
export PATH=/usr/local/gcc-arm/bin:$PATH
- Save the file by hitting escape followed by ":wq"
- Restart all terminal windows or run
source ~/.bash_profile
in all open terminal windows. - Next, make sure Pip is installed to your system python. This depends on your specific distro, but on Ubuntu you should be able to run
sudo apt-get install python3-pip python3-setuptools python3-wheel
. - Now, install the needed packages for the build system:
sudo -H python3 -m pip install intelhex prettytable future
note: We do not recommend using the official Debian/Ubuntu gcc-arm-none-eabi
package due to an as-yet-unfixed bug that prevents proper compilation of Mbed OS. As far as we can tell, the zip files downloaded from ARM do not have this bug.
The toolchain should now be set up!