Skip to content

Commit 2faf6a3

Browse files
committed
Add more options for configuring compilers
We added a few more options for configuring compilers in the mbed-os tools, so I'm adding those options to the readme here. The new options are: - Setting env variables - `PATH` detection Further, I updated the order of the subsections to reflect their priority. Things earlier in the list configure the compiler in preference to things later in the list. Finally, there is one edit for consistency. Previously we had a command line linke `blah --global blah blah` and in the text it refered to `-G`. I changed the command line to be consistant
1 parent 930cdcc commit 2faf6a3

File tree

1 file changed

+22
-9
lines changed

1 file changed

+22
-9
lines changed

README.md

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -268,16 +268,27 @@ $ 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 do this:
272+
* `mbed_settings.py` file in the root of your program, which is automatically created 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+
#### Through mbed_settings.py
278+
279+
Edit `mbed_settings.py` to set your toolchain:
280+
281+
* 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.
282+
* 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 might be incompatible with the tools.
283+
284+
As a rule, since `mbed_settings.py` contains local settings (possibly relevant only to a single OS on a single machine), it should not be versioned.
274285

275286
#### Through mbed CLI configuration
276287

277288
You can set the ARM Compiler 5 location via the command:
278289

279290
```
280-
$ mbed config --global ARM_PATH "C:\Program Files\ARM"
291+
$ mbed config -G ARM_PATH "C:\Program Files\ARM"
281292
[mbed] C:\Program Files\ARM now set as global ARM_PATH
282293
```
283294

@@ -299,14 +310,16 @@ No local configuration is set
299310

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

302-
#### Through mbed_settings.py
313+
#### Setting environment variable
303314

304-
Edit `mbed_settings.py` to set your toolchain:
315+
For each of the compilers, there is a corresponding environment variable that is checked for the path to that compiler. The environment variables are as follows:
316+
* `MBED_ARM_PATH`: The path to the *base* directory of your ARM Compiler installation. This should be one directory up the directory containing the binaries for `armcc` and friends.
317+
* `MBED_IAR_PATH`: The path to the *base* directory of your IAR EWARM Compiler installation. This should be one directory up the directory containing the binaries for `iccarm` and friends.
318+
* `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.
305319

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 might be incompatible with the tools.
320+
#### Compiler detection through the `PATH`
308321

309-
As a rule, since `mbed_settings.py` contains local settings (possibly relevant only to a single OS on a single machine), it should not be versioned.
322+
If none of the above have been 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 it finds the executable it's 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 in this case.
310323

311324
### Compiling your program
312325

0 commit comments

Comments
 (0)