Skip to content

Commit 8a52342

Browse files
committed
README: Add instructions for Mbed CLI 2
Mbed CLI 2 is the recommended build tool moving forward. Add directions on how to build this example with Mbed CLI 2.
1 parent 6e55841 commit 8a52342

File tree

1 file changed

+43
-10
lines changed

1 file changed

+43
-10
lines changed

README.md

Lines changed: 43 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,22 @@ This example demonstrates how Mbed OS crash reporting works on an Mbed OS Enable
55

66
You can find more information about the crash reporting APIs in the [documentation](https://os.mbed.com/docs/mbed-os/latest/apis/error-handling.html#crash-reporting-and-auto-reboot).
77

8-
You can build this project with all supported [Mbed OS build tools](https://os.mbed.com/docs/mbed-os/latest/tools/index.html). However, this example project specifically refers to the command-line interface tool [Arm Mbed CLI](https://github.com/ARMmbed/mbed-cli#installing-mbed-cli).
8+
You can build the project with all supported [Mbed OS build tools](https://os.mbed.com/docs/mbed-os/latest/tools/index.html). However, this example project specifically refers to the command-line interface tools, [Arm Mbed CLI 1](https://github.com/ARMmbed/mbed-cli#installing-mbed-cli) and [Mbed CLI 2](https://github.com/ARMmbed/mbed-tools#installation).
99

10-
1. Install Mbed CLI.
10+
## Mbed OS build tools
11+
12+
### Mbed CLI 2
13+
Starting with version 6.5, Mbed OS uses Mbed CLI 2. It uses Ninja as a build system, and CMake to generate the build environment and manage the build process in a compiler-independent manner. If you are working with Mbed OS version prior to 6.5 then check the section [Mbed CLI 1](#mbed-cli-1).
14+
1. [Install Mbed CLI 2](https://os.mbed.com/docs/mbed-os/latest/build-tools/install-or-upgrade.html).
15+
1. From the command-line, import the example: `mbed-tools import mbed-os-example-crash-reporting`
16+
1. Change the current directory to where the project was imported.
17+
18+
### Mbed CLI 1
19+
1. [Install Mbed CLI 1](https://os.mbed.com/docs/mbed-os/latest/quick-start/offline-with-mbed-cli.html).
1120
1. From the command-line, import the example: `mbed import mbed-os-example-crash-reporting`
1221
1. Change the current directory to where the project was imported.
1322

23+
1424
## Application functionality
1525

1626
This example demonstrates the Mbed OS crash reporting feature and the APIs associated with it. In the first run, the application generates a fault that causes the system to reboot. In the second run, the application detects that the reboot was caused by an error and prints the fault context information in the console.
@@ -45,23 +55,46 @@ Second run:
4555
1. Connect a USB cable between the USB port on the target and the host computer.
4656
1. Run this command to build the example project and program the microcontroller flash memory:
4757

58+
* Mbed CLI 2
59+
60+
```bash
61+
$ mbed-tools compile -m <TARGET> -t <TOOLCHAIN> --flash
62+
```
63+
64+
* Mbed CLI 1
65+
4866
```bash
49-
$ mbed compile -m <TARGET> -t <TOOLCHAIN> --flash --sterm
67+
$ mbed compile -m <TARGET> -t <TOOLCHAIN> --flash
5068
```
5169

52-
(Note: You can use the Mbed CLI command-line option "--sterm" to open a serial terminal after flashing.)
70+
(Note: You can use the Mbed CLI command-line option `--sterm` to open a serial terminal after flashing.)
5371

5472
Your PC may take a few minutes to compile your code.
5573

56-
The binary is located at `./BUILD/<TARGET>/<TOOLCHAIN>/mbed-os-example-crash-reporting.bin`.
74+
The binary is located at:
5775

58-
Alternatively, you can manually copy the binary to the target, which gets mounted on the host computer through USB.
76+
* **Mbed CLI 2** -
77+
`./cmake_build/<TARGET>/develop/<TOOLCHAIN>/mbed-os-example-crash-reporting.bin`
5978

60-
Depending on the target, you can build the example project with the `GCC_ARM`, `ARM` or `IAR` toolchain. After installing Arm Mbed CLI, run the command below to determine which toolchain supports your target:
79+
* **Mbed CLI 1** - `./BUILD/<TARGET>/<TOOLCHAIN>/mbed-os-example-crash-reporting.bin`.
6180

62-
```bash
63-
$ mbed compile -S
64-
```
81+
You can manually copy the binary to the target, which gets mounted on the host
82+
computer through USB, rather than using the `--flash` option.
83+
84+
You can also open a serial terminal separately, rather than using the `--sterm`
85+
option, with the following command:
86+
87+
* Mbed CLI 2
88+
```bash
89+
$ mbed-tools sterm
90+
```
91+
92+
* Mbed CLI 1
93+
```bash
94+
$ mbed sterm
95+
```
96+
97+
Depending on the target, you can build the example project with the `GCC_ARM` or `ARM` toolchain.
6598

6699
## Expected output
67100

0 commit comments

Comments
 (0)