Skip to content

Commit 98aab16

Browse files
authored
Merge pull request #453 from theotherjimmy/docs-compiler-conf
Add more options for configuring compilers
2 parents edc7e83 + 6bf5efc commit 98aab16

File tree

1 file changed

+25
-9
lines changed

1 file changed

+25
-9
lines changed

README.md

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -268,16 +268,30 @@ $ mbed remove text-lcd
268268

269269
After importing a program or creating a new one, you need to tell mbed CLI where to find the toolchains that you want to use for compiling your source tree.
270270

271-
There are two ways to do this:
272-
* Through the mbed CLI configuration.
273-
* Via mbed_settings.py file in the root of your program, which is automatically created (if it doesn't already exist).
271+
There are multiple ways to configure toolchain locations:
272+
* `mbed_settings.py` file in the root of your program. The tools will automatically create this file if it doesn't already exist.
273+
* The mbed CLI configuration.
274+
* Setting an environment variable.
275+
* Adding directory of the compiler binary to your PATH.
276+
277+
Methods for configuring toolchains that appear earlier in the above list override methods that appear later.
278+
279+
#### Through mbed_settings.py
280+
281+
Edit `mbed_settings.py` to set your toolchain:
282+
283+
* To use the [ARM Compiler toolchain](https://developer.arm.com/products/software-development-tools/compilers/arm-compiler-5/downloads), set `ARM_PATH` to the *base* directory of your ARM Compiler installation (example: C:\Program Files\ARM\armcc5.06). The recommended version of the ARM Compiler toolchain is 5.06.
284+
* To use the [GCC ARM Embedded toolchain](https://launchpad.net/gcc-arm-embedded), set `GCC_ARM_PATH` to the *binary* directory of your GCC ARM installation (example: C:\Program Files\GNU Tools ARM Embedded\4.9 2015q2\bin). Use version 4.9 of GCC ARM Embedded; version 5.0 or any more recent version might be incompatible with the tools.
285+
* To use the [IAR EWARM toolhain](https://www.iar.com/iar-embedded-workbench/#!?architecture=ARM), set `IAR_PATH` to the *base* directory of your IAR installation. Use versions 7.80 of IAR EWARM; prior versions might be incompatible with the tools.
286+
287+
Because `mbed_settings.py` contains local settings (possibly relevant only to a single OS on a single machine), you should not check it into version control.
274288

275289
#### Through mbed CLI configuration
276290

277291
You can set the ARM Compiler 5 location via the command:
278292

279293
```
280-
$ mbed config --global ARM_PATH "C:\Program Files\ARM"
294+
$ mbed config -G ARM_PATH "C:\Program Files\ARM"
281295
[mbed] C:\Program Files\ARM now set as global ARM_PATH
282296
```
283297

@@ -299,14 +313,16 @@ No local configuration is set
299313

300314
More information about mbed CLI configuration is available in the [configuration section](#mbed-cli-configuration) of this document.
301315

302-
#### Through mbed_settings.py
316+
#### Setting environment variable
303317

304-
Edit `mbed_settings.py` to set your toolchain:
318+
For each of the compilers, `mbed compile` checks a corresponding environment variable for the compiler's location. The environment variables are as follows:
319+
* `MBED_ARM_PATH`: The path to the *base* directory of your ARM Compiler installation. This should be the directory containing the directory containing the binaries for `armcc` and friends.
320+
* `MBED_IAR_PATH`: The path to the *base* directory of your IAR EWARM Compiler installation. This should be one directory containing the directory containing the binaries for `iccarm` and friends.
321+
* `MBED_GCC_ARM_PATH`: The path to the *binary* directory of your GCC ARM Embedded Compiler installation. This should be the directory containing the binaries for `arm-none-eabi-gcc` and friends.
305322

306-
* If you want to use the [ARM Compiler toolchain](https://developer.arm.com/products/software-development-tools/compilers/arm-compiler-5/downloads), set `ARM_PATH` to the *base* directory of your ARM Compiler installation (example: C:\Program Files\ARM\armcc5.06). The recommended version of the ARM Compiler toolchain is 5.06.
307-
* If you want to use the [GCC ARM Embedded toolchain](https://launchpad.net/gcc-arm-embedded), set `GCC_ARM_PATH` to the *binary* directory of your GCC ARM installation (example: C:\Program Files\GNU Tools ARM Embedded\4.9 2015q2\bin). Use versions 4.9 of GCC ARM Embedded; version 5.0 or any version above may be incompatible with the tools.
323+
#### Compiler detection through the `PATH`
308324

309-
As a rule, because `mbed_settings.py` contains local settings (possibly relevant only to a single OS on a single machine), it should not be versioned.
325+
If none of the above are configured, the `mbed compile` command will fall back to checking your `PATH` for an executable that is part of the compiler suite in question. This check is the same as a shell would perform to find the executable on the command-line. When `mbed compile` finds the executable it is looking for, it uses the location of that executable as the appropriate path except in the case of GCC, which will not use a path.
310326

311327
### Compiling your program
312328

0 commit comments

Comments
 (0)