-
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 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!
- Reboot your machine so that the changes to your PATH are applied.
- 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!
- Install the Python packages "intelhex" and "prettytable":
python -m pip install intelhex prettytable
.
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.
- Download the GNU ARM toolchain from ARM's website (get the Mac OS 64 Bit version), 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 ~/Downloads/gcc-armXXXX /usr/local/gcc-arm
(replace "gcc-armXXXX" with the full name of the folder you extracted). - Now we need to add the toolchain to your PATH. Navigate to your home directory by typing
cd ~
. Then, create a bash profile if you don't already have one by typingvim .bash_profile
- If you use zsh, use .zshrc instead of .bash_profile in these steps
- Add the following line to the end of your .bash_profile file:
export PATH=/usr/local/gcc-arm/bin:$PATH
- Save the file by hitting the escape key 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. 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
The toolchain should now be set up!
- Install CMake >= 3.9.
- If your distro doesn't have a version this recent, you may have to build it from source.
- For Ubuntu 14.04 and 16.04, use this PPA.
- Many distros can also utilize the CMake snap package.
- 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 ~/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. 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
The toolchain should now be set up!