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.
280
+
281
+
Supported settings for toolchain paths are `ARM_PATH`, `GCC_ARM_PATH` and `IAR_PATH`
282
+
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
270
290
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.
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
273
298
274
-
<spanclass="tips">**Tips:** You can set more than one toolchain, and select between them for each build, as explained below.</span>
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
@@ -315,6 +343,7 @@ The arguments for *compile* are:
315
343
*`-t <TOOLCHAIN>` to select a toolchain (of those defined in `mbed_settings.py`, see above). The value can be either `ARM` (ARM Compiler 5), `GCC_ARM` (GNU ARM Embedded), or `IAR` (IAR Embedded Workbench for ARM).
316
344
*`--source <SOURCE>` to select the source directory. The default is `.` (the current directorty). You can specify multiple source locations, even outside the program tree.
317
345
*`--build <BUILD>` to select the build directory. Default: `.build/` inside your program.
346
+
*`--options <OPTIONS>` to select compile options. Examples: "debug-info": will generate debugging information; "small-build" will use microlib/nanolib, but limit RTOS to single thread; "save-asm": will save the asm generated by the compiler
318
347
*`--library` to compile the code as a [static .a/.ar library](#compiling-static-libraries).
319
348
*`--config` to inspect the run-time compile configuration (see below).
320
349
*`-S` or `--supported` shows a matrix of the supported targets and toolchains.
@@ -574,27 +603,14 @@ To push the changes in your local tree upstream, run `mbed publish`. `publish` w
574
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.
710
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.
711
727
* The `--unset` option allows removing of a setting.
728
+
* The `--list` option allows to list global and local configuration.
712
729
713
730
Here is a list of currently implemented configuration settings:
714
731
@@ -718,3 +735,13 @@ Here is a list of currently implemented configuration settings:
718
735
*`protocol` - defines the default protocol used for importing or cloning of programs and libraries. The possible values are `https`, `http` and `ssh`. Use `ssh` if you have generated and registered SSH keys (Public Key Authentication) with a service like GitHub, GitLab, Bitbucket, etc. Read more about SSH keys [here](https://help.github.com/articles/generating-an-ssh-key/) Default: `https`.
719
736
*`depth` - defines the *clone* depth for importing or cloning and applies only to *Git* repositories. Note that while this option may improve cloning speed, it may also prevent you from correctly checking out a dependency tree when the reference revision hash is older than the clone depth. Read more about shallow clones [here](https://git-scm.com/docs/git-clone). Default: none.
720
737
*`cache` (EXPERIMENTAL) - defines the local path that will be used to store minimalistic copies of the imported or cloned repositories, and attempts to use them to minimize traffic and speed up future importing. This feature is still under development, so this should not be used within a production environment. Default: none (disabled).
738
+
739
+
## Troubleshooting
740
+
741
+
#### Unable to import Mercurial based (mbed.org) programs or libraries.
742
+
1. Check whether you have Mercurial installed in your system path by running `hg` in command prompt. If you're receiving "command not found" or similar message, then you need to install Mercurial and add it to your system path.
743
+
744
+
2. Try to clone a Mercurial repository directly, e.g. `hg clone https://developer.mbed.org/teams/mbed/code/mbed_blinky/`. If you're receiving error similar to `abort: error: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.:590)` then your system certificates are very old. You need to update your system certificates and possibly add the host certificate fingerprint of `mbed.com` and `mbed.org`. Read more about Mercurial's certificate management [here](https://www.mercurial-scm.org/wiki/CACertificates).
745
+
746
+
#### Various issues when running mbed CLI in cygwin environment
747
+
Currently mbed CLI is not compatible with cygwin environment and cannot be executed inside it (https://github.com/ARMmbed/mbed-cli/issues/299)
0 commit comments