-
Notifications
You must be signed in to change notification settings - Fork 178
Mbed CLI Collaborate section cleanup #1031
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
5eb44d3
f3b067f
47c1e22
a965077
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -121,14 +121,45 @@ $ mbed import https://github.com/ARMmbed/mbed-os-example-blinky#mbed-os-5.11.0 | |||||
|
||||||
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. | ||||||
|
||||||
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: | ||||||
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: | ||||||
|
||||||
``` | ||||||
$ mbed import https://github.com/ARMmbed/mbed-os-example-blinky#mbed-os-5.11.0 my-blinky | ||||||
``` | ||||||
|
||||||
<span class="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> | ||||||
|
||||||
### Adding libraries to programs | ||||||
|
||||||
You can use the `mbed add` command to add a library to a program. Run the following command within your project directory: | ||||||
|
||||||
``` | ||||||
$ mbed add https://github.com/ARMmbed/mbed-cloud-client | ||||||
[mbed] Working path "C:\dev\mbed-os-example-blinky" (program) | ||||||
[mbed] Adding library "mbed-cloud-client" from "https://github.com/ARMmbed/mbed-cloud-client" at latest revision in the current branch | ||||||
[mbed] Updating reference "mbed-cloud-client" -> "https://github.com/ARMmbed/mbed-cloud-client/#377c6b8fb0f8b66be03408a438ff0cd96be0c454" | ||||||
``` | ||||||
|
||||||
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. | ||||||
|
||||||
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. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
||||||
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: | ||||||
|
||||||
``` | ||||||
$ mbed add https://github.com/ARMmbed/mbed-cloud-client my-mcc | ||||||
``` | ||||||
|
||||||
### Removing libraries | ||||||
|
||||||
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: | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
||||||
``` | ||||||
$ mbed remove mbed-cloud-client | ||||||
``` | ||||||
|
||||||
Commit the removal of the `.lib` file from your project to remove the dependency. | ||||||
|
||||||
### Updating programs and libraries | ||||||
|
||||||
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). | ||||||
|
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** | |||||
$ mbed test --unittests --new rtos/Semaphore.cpp | ||||||
``` | ||||||
|
||||||
### Serial terminal | ||||||
|
||||||
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. | ||||||
|
||||||
There are various options to `mbed sterm`: | ||||||
|
||||||
- `--port <serial port>` to specify system serial port to connect to. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
- `--baudrate <numeric>` to select the communication baudrate, where the default value is 9600. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
- `--echo <on|off>` to switch local echo (default is `on`). | ||||||
- `--reset` to reset the connected target by sending Break before opening the serial terminal. | ||||||
|
||||||
You can also set default port, baudrate and echo mode using the `TERM_PORT`, `TERM_BAUDRATE` and `TERM_ECHO` Mbed CLI configuration options. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
||||||
The following shortcuts are available within the serial terminal: | ||||||
|
||||||
- Ctrl+b - Send Break (reset target) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
- Ctrl+c - Exit terminal | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
- Ctrl+e - Toggle local echo | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
- Ctrl+h - Help | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
- Ctrl+t - Menu escape key | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
||||||
More shortcuts can be viewed within the serial terminal's help menu (Ctrl+h). | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
||||||
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: | ||||||
|
||||||
``` | ||||||
$ mbed compile -t GCC_ARM -m K64F -f --sterm | ||||||
``` | ||||||
|
||||||
### Troubleshooting | ||||||
|
||||||
#### Import Mercurial (mbed.org) programs or libraries | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.