Mistake on this page?
Report an issue in GitHub or email us

After installation - configuring Mbed CLI

Mbed CLI may not work properly without some manual configuration.

Mandatory: setting PATH variables

Add the following to the system PATH:

  • The paths for the Git and Mercurial executables (git and hg).

Mandatory: setting compiler location

You must inform Mbed CLI about the location of your compiler using one of the following methods:

  • The Mbed CLI configuration command.
  • Setting an environment variable.
  • Adding the compiler's directory to your PATH.

Tip: You may configure more than one toolchain. However, you may only use one toolchain at a time. For more information, see the multiple toolchains section below

Method 1: Mbed CLI configuration

Mbed CLI stores its own configuration about compiler locations in both project local settings and user wide global settings. You may set and view these settings with the mbed config command. For example, set the Arm Compiler 5 location with the command:

$ mbed config -G ARM_PATH "C:\Program Files\ARM"
[mbed] C:\Program Files\ARM now set as global ARM_PATH

The -G switch tells Mbed CLI to set this as a global setting, allowing all projects your user owns to compile with Arm Compiler 5. If you want only a local setting for ARM_PATH, omit the -G switch.

Mbed CLI supports a setting for each toolchain path:

Toolchain Example binary location Setting name Example path
Arm Compiler 5.06u6 C:\Program Files\ARM_Compiler_5.06u6\bin\armcc ARM_PATH C:\Program Files\ARM_Compiler_5.06u6
Arm Compiler 6.11 C:\Program Files\ARMCompiler6.11\bin\armclang ARMC6_PATH C:\Program Files\ARMCompiler6.11\bin
IAR EWARM Compiler 8.32.1 C:\Program Files\IAR Systems\Embedded Workbench 8.2\arm\bin\iccarm.exe IAR_PATH C:\Program Files\IAR Systems\Embedded Workbench 8.2\arm
GCC Arm Embedded Compiler /usr/bin/arm-none-eabi-gcc GCC_ARM_PATH /usr/bin

Method 2: environment variable

In addition to the manually configured compiler locations, Mbed CLI detects executables that are in paths specified by toolchain-specific environment variables.

Toolchain Environment variable
Arm Compiler 5 MBED_ARM_PATH
Arm Compiler 6 MBED_ARMC6_PATH
GCC Arm Embedded Compiler MBED_GCC_ARM_PATH

Method 3: system PATH

In addition to toolchain-specific environment variables, Mbed CLI detects executables that are in your system PATH. This means that if you install a toolchain in the system PATH (different for each OS), Mbed CLI will automatically find the toolchain.

Optional: configuring multiple toolchains

All the settings described in the previous sections can configure a different version of the same toolchain, and Mbed CLI has a set of rules to seamlessly switch between these versions for an individual mbed compile or mbed test invocation. Mbed CLI picks the most specific version, from most specific to least specific, in this order:

  1. mbed_settings.py
  2. Mbed CLI local configuration
  3. Mbed CLI global configuration
  4. Environment variables
  5. The PATH environment variable

To use a standard toolchain for general purpose development, you may use any method from 3 to 5. To override a toolchain version for a specific project, you may use methods 1 and 2. All of these methods may coexist.

Optional: add bash tab completion

To install mbed-cli bash tab completion:

  1. Navigate to the tools/bash_completion directory.
  2. Copy the mbed script into your /etc/bash_completion.d/ or /usr/local/etc/bash_completion.d directory.
  3. Reload your terminal.

For more information, see the full documentation.

Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.