You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This creates a new folder "mbed-os-program", initializes a new repository and imports the latest revision of the mbed-os dependency to your program tree.
@@ -142,23 +145,8 @@ Use `mbed ls` to list all the libraries imported to your program:
<spanclass="notes">**Note**: If you want to start from an existing folder in your workspace, you can simply use `mbed new .`, which will initialize an mbed program, as well as a new Git or Mercurial repository in that folder. </span>
@@ -169,6 +157,12 @@ mbed CLI is also compatible with mbed OS 2 programs based on the [mbed library](
169
157
170
158
```
171
159
$ mbed new mbed-classic-program --mbedlib
160
+
[mbed] Creating new program "mbed-classic-program" (git)
161
+
[mbed] Adding library "mbed" from "https://mbed.org/users/mbed_official/code/mbed/builds" at latest revision in the current branch
162
+
[mbed] Downloading mbed library build "f9eeca106725" (might take a minute)
163
+
[mbed] Unpacking mbed library build "f9eeca106725" in "D:\Work\examples\mbed-classic-program\mbed"
[mbed] Importing program "mbed_blinky" from "https://mbed.org/teams/mbed/code/mbed_blinky" at latest revision in the current branch
187
+
[mbed] Adding library "mbed" from "http://mbed.org/users/mbed_official/code/mbed/builds" at rev #f9eeca106725
188
+
[mbed] Couldn't find build tools in your program. Downloading the mbed 2.0 SDK tools...
190
189
$ cd mbed-os-example-blinky
191
190
```
192
191
@@ -208,10 +207,7 @@ If you have manually cloned a git repository into your workspace and you want to
208
207
209
208
```
210
209
$ mbed deploy
211
-
[mbed] Creating new program "test-prog" (git)
212
-
[mbed] Adding library "mbed-os" from "https://github.com/ARMmbed/mbed-os/" at latest revision in the current branch
213
-
[mbed] Adding library "mbed-os/core" from "https://github.com/mbedmicro/mbed/" at rev #b4bb088876cb72bda7006e423423aba4895d380c
214
-
...
210
+
[mbed] Adding library "mbed-os" from "https://github.com/ARMmbed/mbed-os" at rev #dd36dc4228b5
215
211
```
216
212
217
213
Don't forget to set the current directory as the root of your program:
@@ -260,18 +256,50 @@ If at any point you decide that you don't need a library any more, you can use `
260
256
```
261
257
$ mbed remove text-lcd
262
258
```
259
+
263
260
## Compiling code
264
261
265
262
### Toolchain selection
266
263
267
-
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. mbed CLI gets this information from a file named `mbed_settings.py`, which is automatically created at the top of your cloned repository (if it doesn't already exist).
264
+
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.
268
265
269
-
Edit `mbed_settings.py` to set your toolchain:
266
+
There are two ways to do this:
267
+
* Through the mbed CLI configuration
268
+
* Via mbed_settings.py file in the root of your program, which is automatically created (if it doesn't already exist).
269
+
270
+
#### Through mbed CLI configuration
271
+
272
+
You can set the ARM Compiler 5 location via the command:
[mbed] C:\Program Files\ARM now set as global ARM_PATH
277
+
```
278
+
279
+
The `-G` switch tells mbed CLI to set this as a global setting, rather than local for the current program.
270
280
271
-
* 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:\software\armcc5.06). The recommended version of the ARM Compiler toolchain is 5.06.
272
-
* 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:\software\GNUToolsARMEmbedded\4.82013q4\bin). Use versions 4.8 or 4.9 of GCC ARM Embedded; version 5.0 or any version above might be incompatible with the tools.
281
+
Supported settings for toolchain paths are `ARM_PATH`, `GCC_ARM_PATH` and `IAR_PATH`
273
282
274
-
<spanclass="tips">**Tips:** You can set more than one toolchain, and select between them for each build, as explained below.</span>
283
+
You can see the active mbed CLI configuration via:
284
+
285
+
```
286
+
$ mbed config --list
287
+
[mbed] Global config:
288
+
ARM_PATH=C:\Program Files\ARM\armcc5.06
289
+
IAR_PATH=C:\Program Files\IAR Workbench 7.0\arm
290
+
291
+
[mbed] Local config (D:\temp\mbed-os-program):
292
+
No local configuration is set
293
+
```
294
+
295
+
More information about mbed CLI configuration is available in the [configuration section](#mbed-cli-configuration) of this document.
296
+
297
+
#### Through mbed_settings.py
298
+
299
+
Edit `mbed_settings.py` to set your toolchain:
300
+
301
+
* 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.
302
+
* 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.
275
303
276
304
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.
277
305
@@ -575,27 +603,14 @@ To push the changes in your local tree upstream, run `mbed publish`. `publish` w
575
603
This is best explained by an example. Let's assume that the list of dependencies of your program (obtained by running `mbed ls`) looks like this:
Furthermore, let's assume that you make changes to `mbed-mesh-api`. `publish` detects the change on the leaf `mbed-mesh-api` dependency and asks you to commit it. Then it detects that `mbed-os` depends on `mbed-mesh-api`, updates the `mbed-os` dependency on `mbed-mesh-api` to its latest version (by updating the `mbed-mesh-api.lib` file inside `mbed-os/net/`) and asks you to commit it. This propagates up to `mbed-os` and finally to your program `mbed-os-program`.
606
+
my-mbed-os-example (a5ac4bf2e468)
607
+
|- mbed-os (5fea6e69ec1a)
608
+
`- my-libs (e39199afa2da)
609
+
|- my-libs/iot-client (571cfef17dd0)
610
+
`- my-libs/test-framework (cd18b5a50df4)
611
+
```
612
+
613
+
Let's assume that you make changes to `ot-client`. `publish` detects the change on the leaf `ot-client` dependency and asks you to commit it. Then it detects that `my-libs` depends on `iot-client`, updates the `my-libs` dependency on `iot-client` to its latest version (by updating the `iot-client.lib` file) and asks you to commit it. This propagates up to `my-libs` and finally to your program `my-mbed-os-example`.
* The **local** configuration (without `--global`) is per mbed program and allows overriding of global or default mbed CLI settings within the scope of a program or library and its dependencies.
711
726
* If **no value** is specified then mbed CLI will print the currently set value for this settings from either the local or global scope.
712
727
* The `--unset` option allows removing of a setting.
728
+
* The `--list` option allows to list global and local configuration.
713
729
714
730
Here is a list of currently implemented configuration settings:
0 commit comments