Manual installation
1. Install dependencies
Instructions for Windows
- Download and install Python 2.7.x (which includes
pip
). - Download and install Git (versions 1.9.5 or later are supported).
- Download and install Mercurial (versions 2.2.2 or later are supported).
Instructions for macOS
-
macOS 10.8 and later comes with Python 2.7 preinstalled.
-
If you are using the preinstalled version but need to install
pip
, you can run the following command (taken from the pip installation guide):curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py python get-pip.py
-
If you are running an earlier version of macOS, download and install Python from the official website. This package includes
pip
.
-
-
Download and install Git (versions 1.9.5 or later are supported).
-
Download and install Mercurial (versions 2.2.2 or later are supported).
Instructions for Linux
Linux distributions typically manage software through package managers. The specific commands to install the dependencies will vary depending on your distribution. Please see your distribution's documentation for more information.
As an example, the following is a command to install all dependencies on Ubuntu:
sudo apt install python2.7 python-pip git mercurial
2. Install Mbed CLI
Note: We suggest you install Mbed CLI from within a virtual environment and run all commands from within your virtual environment. This will ensure that changes made by the Mbed CLI installation do not propagate to the rest of your system and cause unexpected changes in behavior in any existing Python installation.
To install Mbed CLI with pip:
pip install mbed-cli
To verify Mbed CLI installed correctly, run mbed --help
.
To update Mbed CLI, run:
pip install -U mbed-cli
3. Install a compiler
Download and install one of the following compilers: GCC Arm, Arm Compiler 5, Arm Compiler 6 or IAR.
Note: When installing the Arm Compiler 5 on a 64-bit Linux system, you may also need to install the i386 architecture package. As as example on Ubuntu:
$ sudo dpkg --add-architecture i386
$ sudo apt-get update
$ sudo apt-get install libc6:i386 libncurses5:i386 libstdc++6:i386
4. Configure the compiler location
To build project, Mbed CLI needs to know where the compiler is installed. It checks three configuration options in the following order:
- Mbed CLI config (local first, then global).
- Environment variables.
- System path.
Configure compiler location with Mbed CLI
If you cannot place the compiler in the system PATH, or if you have to use a different version of the compiler than the one in your system path, you must configure the location of the compiler with Mbed CLI. Use the mbed config
command to set the compiler's location:
$ mbed config -G ARM_PATH "C:\Program Files\ARM"
[mbed] C:\Program Files\ARM now set as global ARM_PATH
The -G
argument sets the location globally, so that it applies to all projects. You can omit the argument if you are configuring a compiler location for a specific project.
Mbed CLI supports a setting for each toolchain path:
Toolchain | Setting name | Example binary location | Example path |
---|---|---|---|
Arm Compiler 5.06u6 | ARM_PATH |
C:\Program Files\ARM_Compiler_5.06u6\bin\armcc |
C:\Program Files\ARM_Compiler_5.06u6 |
Arm Compiler 6.11 | ARMC6_PATH |
C:\Program Files\ARMCompiler6.11\bin\armclang |
C:\Program Files\ARMCompiler6.11\bin |
IAR EWARM Compiler 8.32.1 | IAR_PATH |
C:\Program Files\IAR Systems\Embedded Workbench 8.2\arm\bin\iccarm.exe |
C:\Program Files\IAR Systems\Embedded Workbench 8.2\arm |
GCC Arm Embedded Compiler | GCC_ARM_PATH |
/usr/bin/arm-none-eabi-gcc |
/usr/bin |
Configure compiler location with environment variables
You can set the location of the compiler with environment variables. Use the path listed in the previous section Configuring compiler location with Mbed CLI.
Toolchain | Environment variable |
---|---|
Arm Compiler 5 | MBED_ARM_PATH |
Arm Compiler 6 | MBED_ARMC6_PATH |
IAR EWARM Compiler | MBED_IAR_PATH |
GCC Arm Embedded Compiler | MBED_GCC_ARM_PATH |
Install compilers in the system PATH
Installing the compilers in the system PATH will allow the tools to automatically discover the compilers without further configuration. Most compiler installers have an option to add the compiler to the system PATH for you.
Optional configuration
Bash completion
To install mbed-cli
bash completion:
- Clone the Mbed CLI repository:
git clone https://github.com/ARMmbed/mbed-cli
. - Navigate to the
mbed-cli/tools/bash_completion
directory. - Copy the
mbed
script into the~/.bash_completion.d
directory (you may need to create this directory first). - Restart the terminal.