|
1 | 1 |  |
2 | 2 | # Running Mbed Crypto examples on Mbed OS |
3 | | -This repository contains a set of examples demonstrating the compilation and use of Mbed Crypto on Mbed OS. |
4 | | - |
5 | | -List of examples contained within this repository: |
6 | | -* Example code snippets for using the library, with [documentation](https://github.com/ARMmbed/mbed-crypto/blob/development/docs/getting_started.md). |
| 3 | +This repository contains an example demonstrating the compilation and use of Mbed Crypto on Mbed OS. |
7 | 4 |
|
8 | 5 | ## Prerequisites |
9 | | -* Install <a href='https://github.com/ARMmbed/mbed-cli#installing-mbed-cli'>Mbed CLI</a> |
| 6 | +This example enables Mbed OS PSA. It is compatible with **non-TF-M** targets, as TF-M has its own PSA implementation |
| 7 | +(e.g. Arm TrustZone on Arm v8-M) which cannot coexist with Mbed OS PSA. |
| 8 | + |
| 9 | +## Mbed OS build tools |
| 10 | + |
| 11 | +### Mbed CLI 2 |
| 12 | +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). |
| 13 | +1. [Install Mbed CLI 2](https://os.mbed.com/docs/mbed-os/latest/build-tools/install-or-upgrade.html). |
| 14 | +1. From the command-line, import the example: `mbed-tools import mbed-os-example-mbed-crypto` |
| 15 | + |
| 16 | +### Mbed CLI 1 |
| 17 | +1. [Install Mbed CLI 1](https://os.mbed.com/docs/mbed-os/latest/quick-start/offline-with-mbed-cli.html). |
| 18 | +1. From the command-line, import the example: `mbed import mbed-os-example-mbed-crypto` |
| 19 | + |
| 20 | +## Building and running |
| 21 | + |
| 22 | +1. Change the current directory to `mbed-os-example-mbed-crypto/getting-started`. |
| 23 | +1. Connect a USB cable between the USB port on the board and the host computer. |
| 24 | +1. Run the following command to build the example project, program the microcontroller flash memory and open a serial monitor: |
10 | 25 |
|
11 | | -## Import |
12 | | -The following are the steps required to install the application: |
13 | | -1. Clone the repository: `git clone https://github.com/ARMmbed/mbed-os-example-mbed-crypto.git` |
14 | | -1. Navigate to the "getting-started" example: `cd mbed-os-example-mbed-crypto/getting-started` |
15 | | -1. Deploy the Mbed OS project: `mbed deploy` |
| 26 | + * Mbed CLI 2 |
16 | 27 |
|
17 | | -## Compile |
18 | | -To compile the example program use `mbed compile` while specifying the target platform and the compiler. |
19 | | -For example, in order to compile using the ARM GCC compiler and a K64F target platform use: `mbed compile -m K64F -t GCC_ARM`. |
| 28 | + ```bash |
| 29 | + $ mbed-tools compile -m <TARGET> -t <TOOLCHAIN> --flash --sterm |
| 30 | + ``` |
20 | 31 |
|
21 | | -Once the compilation is completed successfully a binary file will be created: `./BUILD/K64F/GCC_ARM/getting-started.bin` |
| 32 | + * Mbed CLI 1 |
22 | 33 |
|
23 | | -## Program your board |
24 | | -1. Connect your Mbed device to the computer over USB. |
25 | | -1. Copy the binary file (`getting-started.bin`) to the Mbed device. |
| 34 | + ```bash |
| 35 | + $ mbed compile -m <TARGET> -t <TOOLCHAIN> --flash --sterm |
| 36 | + ``` |
26 | 37 |
|
27 | | -## Run |
28 | | -1. Connect to the Mbed Device using a serial client application of your choice. |
29 | | -1. Press the reset button on the Mbed device to run the program. |
| 38 | +Your PC may take a few minutes to compile your code. |
30 | 39 |
|
31 | | -The expected output from the first successful execution of the example program should be as follows: |
| 40 | +## Expected output |
32 | 41 | ``` |
33 | 42 | -- Begin Mbed Crypto Getting Started -- |
34 | 43 |
|
|
0 commit comments