Skip to content

Commit 0d2507f

Browse files
committed
Updates to the documentation regarding mbed-os structure, setting up toolchains via mbed CLI and also mbed config --list
1 parent dbccb3c commit 0d2507f

File tree

1 file changed

+64
-48
lines changed

1 file changed

+64
-48
lines changed

README.md

Lines changed: 64 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,9 @@ With this in mind, let's create a new program (we'll call it `mbed-os-program`):
131131

132132
```
133133
$ mbed new mbed-os-program
134+
[mbed] Creating new program "mbed-os-program" (git)
135+
[mbed] Adding library "mbed-os" from "https://github.com/ARMmbed/mbed-os" at latest revision in the current branch
136+
[mbed] Updating reference "mbed-os" -> "https://github.com/ARMmbed/mbed-os/#89962277c20729504d1d6c95250fbd36ea5f4a2d"
134137
```
135138

136139
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:
142145
```
143146
$ cd mbed-os-program
144147
$ mbed ls -a
145-
mbed-os-program (mbed-os-program#189949915b9c)
146-
`- mbed-os (0d5eb2b8cee8)
147-
|- core (737a7809f9e7)
148-
|- features\FEATURE_CLIENT\coap-service (7a11be1ccb07)
149-
|- features\FEATURE_CLIENT\mbed-client (a6a46726f027)
150-
|- features\FEATURE_CLIENT\mbed-client-c (086b9c97f65b)
151-
|- features\FEATURE_CLIENT\mbed-client-classic (c8ccada6b9ff)
152-
|- features\FEATURE_CLIENT\mbed-client-mbed-tls (b14e7b3303c8)
153-
|- features\FEATURE_CLIENT\mbed-client-randlib (80f5c491dd4d)
154-
|- features\FEATURE_IPV6\mbed-mesh-api (0e92921f3dce)
155-
|- features\FEATURE_IPV6\mbed-trace (e419c488f4f8)
156-
|- features\FEATURE_IPV6\nanostack-hal-mbed-cmsis-rtos (36968fc133c7)
157-
|- features\FEATURE_IPV6\nanostack-libservice (f61c845e0c59)
158-
|- features\FEATURE_IPV6\sal-stack-nanostack-eventloop (c163be9183b0)
159-
|- features\FEATURE_IPV6\sal-stack-nanostack-private (5d3365ce7df3)
160-
|- frameworks\greentea-client (d0cbb41ae793)
161-
`- frameworks\unity (14fd303f30f9)
148+
mbed-os-program (mbed-os-program)
149+
`- mbed-os (https://github.com/ARMmbed/mbed-os#89962277c207)
162150
```
163151

164152
<span class="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](
169157

170158
```
171159
$ 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"
164+
[mbed] Updating reference "mbed" -> "https://mbed.org/users/mbed_official/code/mbed/builds/f9eeca106725"
165+
[mbed] Couldn't find build tools in your program. Downloading the mbed 2.0 SDK tools...
172166
```
173167
### Creating a new program without OS version selection
174168

@@ -180,13 +174,18 @@ Use `mbed import` to clone an existing program and all its dependencies to your
180174

181175
```
182176
$ mbed import https://github.com/ARMmbed/mbed-os-example-blinky
177+
[mbed] Importing program "mbed-os-example-blinky" from "https://github.com/ARMmbed/mbed-os-example-blinky" at latest revision in the current branch
178+
[mbed] Adding library "mbed-os" from "https://github.com/ARMmbed/mbed-os" at rev #dd36dc4228b5
183179
$ cd mbed-os-example-blinky
184180
```
185181

186182
mbed CLI also supports programs based on mbed OS 2, which are automatically detected and do not require additional options:
187183

188184
```
189-
$ mbed import https://developer.mbed.org/teams/mbed-os-examples/code/mbed-os-example-blinky/
185+
$ mbed import https://mbed.org/teams/mbed/code/mbed_blinky/
186+
[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...
190189
$ cd mbed-os-example-blinky
191190
```
192191

@@ -208,10 +207,7 @@ If you have manually cloned a git repository into your workspace and you want to
208207

209208
```
210209
$ 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
215211
```
216212

217213
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 `
260256
```
261257
$ mbed remove text-lcd
262258
```
259+
263260
## Compiling code
264261

265262
### Toolchain selection
266263

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.
268265

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:
273+
274+
```
275+
$ mbed config --global ARM_PATH "C:\Program Files\ARM"
276+
[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.
270280

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`
273282

274-
<span class="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.
275303

276304
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.
277305

@@ -575,27 +603,14 @@ To push the changes in your local tree upstream, run `mbed publish`. `publish` w
575603
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:
576604

577605
```
578-
mbed-os-program (189949915b9c)
579-
`- mbed-os (e39199afa2da)
580-
|- frameworks/greentea-client (571cfef17dd0)
581-
|- frameworks/unity (7483099b9df1)
582-
|- core (d1ec4beabef3)
583-
|- mbedtls (bef26f687287)
584-
|- net/coap-service (eae41d1df943)
585-
|- net/mbed-client (5dc62d168aa4)
586-
|- net/mbed-client-c (ce64d6a0bdef)
587-
|- net/mbed-client-classic (abda3cef87f0)
588-
|- net/mbed-client-mbed-tls (8c436e5d1109)
589-
|- net/mbed-client-randlib (80f5c491dd4d)
590-
|- net/mbed-mesh-api (8187d3d275cc)
591-
|- net/mbed-trace (07ce2714915d)
592-
|- net/nanostack-hal-mbed-cmsis-rtos (023fd8906ce7)
593-
|- net/nanostack-libservice (f61c845e0c59)
594-
|- net/sal-stack-nanostack-eventloop (c163be9183b0)
595-
`- net/sal-stack-nanostack (cd18b5a50df4)
596-
```
597-
598-
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`.
599614

600615
### Forking workflow
601616

@@ -710,6 +725,7 @@ mbed config [--global] <var> [value] [--unset]
710725
* 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.
711726
* If **no value** is specified then mbed CLI will print the currently set value for this settings from either the local or global scope.
712727
* The `--unset` option allows removing of a setting.
728+
* The `--list` option allows to list global and local configuration.
713729

714730
Here is a list of currently implemented configuration settings:
715731

0 commit comments

Comments
 (0)