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
[mbed] Importing program "mbed_blinky" from "https://mbed.org/teams/mbed/code/mbed_blinky" at latest revision in the current branch
20
-
[mbed] Adding library "mbed" from "http://mbed.org/users/mbed_official/code/mbed/builds" at rev #f9eeca106725
21
-
[mbed] Couldn't find build tools in your program. Downloading the mbed 2.0 SDK tools...
22
-
$ cd mbed-os-example-blinky
23
-
```
24
-
25
-
You can use the "import" command without specifying a full URL; Mbed CLI adds a [prefix](https://github.com/ARMmbed) to the URL if one is not present. For example, this command:
If you have manually cloned a Git repository into your workspace and you want to add all missing libraries, then you can use the `deploy` command:
40
7
@@ -49,87 +16,6 @@ Don't forget to set the current directory as the root of your program:
49
16
$ mbed new .
50
17
```
51
18
52
-
### Adding and removing libraries
53
-
54
-
While working on your code, you may need to add another library to your application or remove existing libraries.
55
-
56
-
Adding a new library to your program is not the same as cloning the repository. Don't clone a library using `hg` or `git`; use `mbed add` to add the library. This ensures that all libraries and sublibraries are populated as well.
57
-
58
-
Removing a library from your program is not the same as deleting the library directory. Mbed CLI updates and removes library reference files. Use `mbed remove` to remove the library; don't remove its directory with `rm`.
59
-
60
-
#### Adding a library
61
-
62
-
Use `mbed add` to add the latest revision of a library:
If you want to specify a directory to which to add your library, you can give an additional argument to ``add``, which names that directory. For example, If you'd rather add the previous library in a directory called "text-lcd" (instead of TextLCD):
Although Mbed CLI supports this functionality, we don't encourage it. Adding a library with a name that differs from its source repository can lead to confusion.
83
-
84
-
#### Removing a library
85
-
86
-
If at any point you decide that you don't need a library any more, you can use `mbed remove` with the path of the library:
87
-
88
-
```
89
-
$ mbed remove text-lcd
90
-
```
91
-
92
-
### Exporting to desktop IDEs
93
-
94
-
If you need to debug your code, you can export your source tree to an IDE project file to use the IDE's debugging facilities. Mbed CLI supports exporting to Keil uVision, IAR Workbench, a Makefile using GCC Arm, Eclipse using GCC Arm and other IDEs.
95
-
96
-
For example, to export to uVision, run:
97
-
98
-
```
99
-
$ mbed export -i uvision -m K64F
100
-
```
101
-
102
-
Mbed CLI creates a `.uvprojx` file in the root project directory. You can open the project file with uVision.
103
-
104
-
#### Serial terminal
105
-
106
-
You can open a serial terminal to the serial port of a connected Mbed target (usually board) using the `mbed sterm` command. If no serial port is specified, Mbed CLI will attempt to detect the connected Mbed targets and their serial ports.
107
-
108
-
There are various options to `mbed sterm`:
109
-
110
-
-`--port <serial port>` to specify system serial port to connect to.
111
-
-`--baudrate <numeric>` to select the communication baudrate, where the default value is 9600.
112
-
-`--echo <on|off>` to switch local echo (default is `on`).
113
-
-`--reset` to reset the connected target by sending Break before opening the serial terminal.
114
-
115
-
You can also set default port, baudrate and echo mode using the `TERM_PORT`, `TERM_BAUDRATE` and `TERM_ECHO` Mbed CLI configuration options.
116
-
117
-
The following shortcuts are available within the serial terminal:
118
-
119
-
- Ctrl+b - Send Break (reset target)
120
-
- Ctrl+c - Exit terminal
121
-
- Ctrl+e - Toggle local echo
122
-
- Ctrl+h - Help
123
-
- Ctrl+t - Menu escape key
124
-
125
-
More shortcuts can be viewed within the serial terminal's help menu (Ctrl+h).
126
-
127
-
You can also add the `--sterm` option to `mbed compile -f` to compile a new program, flash the program/firmware image to the connected target and then open the serial terminal to its serial port:
128
-
129
-
```
130
-
$ mbed compile -t GCC_ARM -m K64F -f --sterm
131
-
```
132
-
133
19
### Publishing changes
134
20
135
21
#### Checking status
@@ -182,15 +68,15 @@ When you create a new (local) version control managed program or library, its re
182
68
1. Copy the URL/location of the new repository in your clipboard.
183
69
1. Open command-line in the local repository directory (for example, change directory to `mbed-os-example/local-lib`).
184
70
1. To associate the local repository:
185
-
71
+
186
72
- For Git, run `git remote add origin <url-or-path-to-your-remote-repo>`.
187
73
- For Mercurial, edit .hg/hgrc and add (or replace if exists):
188
-
74
+
189
75
```
190
76
[paths]
191
77
default = <url-or-path-to-your-remote-repo>
192
78
```
193
-
79
+
194
80
1. Run `mbed publish` to publish your changes.
195
81
196
82
In a scenario with nested local repositories, start with the leaf repositories first.
You can specify which version to import using `#` followed by a commit hash, a branch name, or a tag name. If you do not provide any of these (nor the `#` character), the latest commit on the `master` branch will be imported.
123
123
124
-
A project's default name is the last part of the URL (excluding `#` and its value). In the example above, the imported program's project folder is `mbed-os-example-blinky`. To specify a different name, supply it as an extra positional argument in the import command. For example, to name your project `my-blinky`, run:
124
+
A project's default name is the last part of the URL (excluding `#` and its value). In the example above, the imported program's project folder is `mbed-os-example-blinky`. To specify a different name, supply it as an extra positional argument in the `mbed import` command. For example, to name your project `my-blinky`, run:
<spanclass="tips">**Tip**: Running `mbed import` within an existing program will result in an error. To add a library to an existing project, use the `mbed add` command.</span>
131
131
132
+
### Adding libraries to programs
133
+
134
+
You can use the `mbed add` command to add a library to a program. Run the following command within your project directory:
Like the `mbed import` command, you can specify which version to use by using `#` at the end of the URL followed by a commit hash, a branch name, or a tag name. If you do not provide any of these (nor the `#` character), the latest commit on the `master` branch will be used.
144
+
145
+
The `mbed add` command will clone the repository specified, checkout to the correct version, and write the URL and _commit hash_ to a `.lib` file. Branches and tags can point to different commits over the lifetime of a repository, so to ensure the project's state is always reproducible, the commit hash is written to the `.lib` file. This `.lib` file should be committed to the project repository to track the dependency.
146
+
147
+
A library's default name is the last part of the URL (excluding `#` and its value). In the example above, the cloned library's folder is `mbed-cloud-client`. To specify a different name, supply it as an extra positional argument in the `mbed add` command. For example, to name your library `my-mcc`, run:
Remove a library (and it's `.lib` file) from your project by supplying the path to the library to the `mbed remove` command. Continuing the example from above, run the following from your project directory to remove the library that was added previously:
156
+
157
+
```
158
+
$ mbed remove mbed-cloud-client
159
+
```
160
+
161
+
Commit the removal of the `.lib` file from your project to remove the dependency.
162
+
132
163
### Updating programs and libraries
133
164
134
165
You can update programs and libraries on your local machine, so they update to the latest released version from the remote sources (Git or Mercurial).
Copy file name to clipboardExpand all lines: docs/tools/CLI/cli-test-debug.md
+29Lines changed: 29 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -271,6 +271,35 @@ All unit tests are under the `mbed-os/UNITTESTS` directory. You can **generate**
271
271
$ mbed test --unittests --new rtos/Semaphore.cpp
272
272
```
273
273
274
+
### Serial terminal
275
+
276
+
You can open a serial terminal to the serial port of a connected Mbed target (usually board) using the `mbed sterm` command. If no serial port is specified, Mbed CLI will attempt to detect the connected Mbed targets and their serial ports.
277
+
278
+
There are various options to `mbed sterm`:
279
+
280
+
-`--port <serial port>` to specify system serial port to connect to.
281
+
-`--baudrate <numeric>` to select the communication baudrate, where the default value is 9600.
282
+
-`--echo <on|off>` to switch local echo (default is `on`).
283
+
-`--reset` to reset the connected target by sending Break before opening the serial terminal.
284
+
285
+
You can also set default port, baudrate and echo mode using the `TERM_PORT`, `TERM_BAUDRATE` and `TERM_ECHO` Mbed CLI configuration options.
286
+
287
+
The following shortcuts are available within the serial terminal:
288
+
289
+
- Ctrl+b - Send Break (reset target)
290
+
- Ctrl+c - Exit terminal
291
+
- Ctrl+e - Toggle local echo
292
+
- Ctrl+h - Help
293
+
- Ctrl+t - Menu escape key
294
+
295
+
More shortcuts can be viewed within the serial terminal's help menu (Ctrl+h).
296
+
297
+
You can also add the `--sterm` option to `mbed compile -f` to compile a new program, flash the program/firmware image to the connected target and then open the serial terminal to its serial port:
298
+
299
+
```
300
+
$ mbed compile -t GCC_ARM -m K64F -f --sterm
301
+
```
302
+
274
303
### Troubleshooting
275
304
276
305
#### Import Mercurial (mbed.org) programs or libraries
0 commit comments