Skip to content

Commit 87e2d79

Browse files
committed
README: Add instructions for Mbed CLI 2
Mbed CLI 2 is now the preferred build method.
1 parent aa06423 commit 87e2d79

File tree

1 file changed

+44
-19
lines changed

1 file changed

+44
-19
lines changed

README.md

Lines changed: 44 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -12,37 +12,62 @@ The application injects a dummy root of trust (ROT) if true random number genera
1212
* An mbed-os supported development board.
1313
* A micro-USB cable.
1414

15-
**NOTE:** Currently this application defines settings only for K66F board. Please refer to [Storage Configuration](https://os.mbed.com/docs/mbed-os/latest/reference/storage.html) from Mbed OS documentation as the DeviceKey requires KVStore to be configured.
15+
## Mbed OS build tools
1616

17-
## Getting started ##
17+
### Mbed CLI 2
18+
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).
19+
1. [Install Mbed CLI 2](https://os.mbed.com/docs/mbed-os/latest/build-tools/install-or-upgrade.html).
20+
1. From the command-line, import the example: `mbed-tools import mbed-os-example-devicekey`
21+
1. Change the current directory to where the project was imported.
1822

19-
1. Import the example.
23+
### Mbed CLI 1
24+
1. [Install Mbed CLI 1](https://os.mbed.com/docs/mbed-os/latest/quick-start/offline-with-mbed-cli.html).
25+
1. From the command-line, import the example: `mbed import mbed-os-example-devicekey`
26+
1. Change the current directory to where the project was imported.
2027

21-
```
22-
mbed import mbed-os-example-devicekey
23-
cd mbed-os-example-devicekey
24-
```
28+
## Building and running
2529

26-
2. Compile and generate binary.
30+
1. Connect a USB cable between the USB port on the target and the host computer.
31+
1. Run the following command to build the example project and program the microcontroller flash memory:
2732

28-
For example, for `GCC`:
33+
* Mbed CLI 2
2934

35+
```bash
36+
$ mbed-tools compile -m <TARGET> -t <TOOLCHAIN> --flash --sterm
3037
```
31-
mbed compile -t GCC_ARM -m <your device>
38+
39+
* Mbed CLI 1
40+
41+
```bash
42+
$ mbed compile -m <TARGET> -t <TOOLCHAIN> --flash --sterm
3243
```
33-
34-
3. Open a serial console session with the target platform using the following parameters:
3544

36-
* **Baud rate:** 9600
37-
* **Data bits:** 8
38-
* **Stop bits:** 1
39-
* **Parity:** None
45+
Your PC may take a few minutes to compile your code.
46+
47+
The binary is located at:
48+
49+
* **Mbed CLI 2** -
50+
`./cmake_build/<TARGET>/develop/<TOOLCHAIN>/mbed-os-example-devicekey.bin`
4051

41-
5. Copy the application `mbed-os-example-devicekey.bin` in the folder `mbed-os-example-devicekey/BUILD/<TARGET NAME>/<PLATFORM NAME>` onto the target board.
52+
* **Mbed CLI 1** - `./BUILD/<TARGET>/<TOOLCHAIN>/mbed-os-example-devicekey.bin`.
4253

43-
6. Press the **RESET** button on the board to run the program
54+
You can manually copy the binary to the target, which gets mounted on the host
55+
computer through USB, rather than using the `--flash` option.
56+
57+
You can also open a serial terminal separately, rather than using the `--sterm`
58+
option, with the following command:
59+
60+
* Mbed CLI 2
61+
```bash
62+
$ mbed-tools sterm
63+
```
64+
65+
* Mbed CLI 1
66+
```bash
67+
$ mbed sterm
68+
```
4469

45-
7. The serial console should now display a series of results.
70+
The expected log can be found in [`tests/devicekey.log`](tests/devicekey.log).
4671

4772
## Troubleshooting
4873

0 commit comments

Comments
 (0)