Skip to content

Commit be7f33d

Browse files
authored
Merge pull request #10 from ARMmbed/mbed-os-5.3.0-rc
Update mbed OS to 5.3.0
2 parents d72b18b + 6f0bc61 commit be7f33d

File tree

5 files changed

+60
-18
lines changed

5 files changed

+60
-18
lines changed

README.md

Lines changed: 44 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,70 @@
1-
# Threaded RPC with uVisor Example
1+
# Threaded RPC with uVisor example
22

33
This is a simple example to show how to use several uVisor APIs to build a box that securely stores a number.
44
This number can only be written by one box, but read by all boxes.
55

6-
- Create and run secure boxes.
7-
- Secure static and dynamic memory inside secure boxes.
8-
- Run threads inside secure boxes.
9-
- Issue RPC requests to other secure boxes and wait for their completion.
10-
- Receive and process incoming RPC requests from other secure boxes.
11-
- Get box id and namespace of the RPC caller.
6+
* Create and run secure boxes.
7+
* Secure static and dynamic memory inside secure boxes.
8+
* Run threads inside secure boxes.
9+
* Issue RPC requests to other secure boxes and wait for their completion.
10+
* Receive and process incoming RPC requests from other secure boxes.
11+
* Get box id and namespace of the RPC caller.
1212

1313
This demo contains three secure boxes:
1414

1515
1. The secure number vault. This box stores one number that can only be written to by client A, but read by everyone.
16-
2. Client A, which attempts to write (and succeeds) and read the secure number.
17-
3. Client B, which attempts to write (but fails) and read the secure number.
16+
1. Client A, which attempts to write (and succeeds) and read the secure number.
17+
1. Client B, which attempts to write (but fails) and read the secure number.
1818

1919
The insecure box 0 also attempts to write (but fails) and read the secure number.
2020

21-
## Building
21+
Supported devices:
2222

23-
The example currently only works on K64F with the GCC_ARM toolchain.
23+
| Target | Toolchain | Baud rate |
24+
|--------|-----------|-----------|
25+
| `K64F` | `GCC_ARM` | 9600 |
2426

25-
### Release
27+
Latest release: [mbed-os-5.3.0](https://github.com/ARMmbed/mbed-os-example-uvisor/releases/tag/mbed-os-5.3.0). Tested with [mbed-cli v1.0.0](https://github.com/ARMmbed/mbed-cli/releases/tag/1.0.0).
28+
29+
## Quickstart
2630

2731
For a release build, please enter:
2832

2933
```bash
30-
$ mbed compile -m K64F -t GCC_ARM
34+
$ mbed compile -m K64F -t GCC_ARM -c
3135
```
3236

3337
You will find the resulting binary in `BUILD/K64F/GCC_ARM/mbed-os-example-uvisor-number-store.bin`. You can drag and drop it onto your board USB drive.
3438

39+
Press the reset button. The `box_number_store` secure box will use 3 LEDs on your target to signal the execution of the `get_caller_id`, `get_number` and `set_number` APIs. You can observe the example output on the serial port:
40+
41+
```bash
42+
$ screen /dev/tty.usbmodem1422 9600
43+
```
44+
45+
You will see an output similar to the following one:
46+
47+
```
48+
**** uVisor secure number store example *****
49+
Trusted client a has box id 2
50+
2: Wrote '0xfffffed4'
51+
1: Read '0xfffffed4'
52+
1: Permission denied. This client cannot write the secure number '0xfffffe0c'
53+
0: Read '0xfffffed4'
54+
0: Permission denied. This client cannot write the secure number '0x00000019'
55+
2: Read '0xfffffed4'
56+
2: Wrote '0xfffffda8'
57+
2: Read '0xfffffda8'
58+
1: Permission denied. This client cannot write the secure number '0xfffffc18'
59+
2: Wrote '0xfffffc7c'
60+
...
61+
```
62+
63+
> **Note**: If your target does not have 3 different LEDs or LED colours, you will see the same LED blink multiple times. The example use the general mbed OS naming structure `LED1`, `LED2`, `LED3`.
64+
3565
### Debug
3666

37-
When a debugger is connected, you can observe debug output from uVisor. Please note that these messages are sent through semihosting, which halts the program execution if a debugger is not connected. For more information please read the [Debugging uVisor on mbed OS](https://github.com/ARMmbed/uvisor/blob/master/docs/api/DEBUGGING.md) guide. To build a debug version of the program:
67+
When a debugger is connected, you can observe debug output from uVisor. Please note that these messages are sent through semihosting, which halts the program execution if a debugger is not connected. For more information please read the [Debugging uVisor on mbed OS](https://github.com/ARMmbed/uvisor/blob/master/docs/api/DEBUGGING.md) guide. To build a debug version of this example, please enter:
3868

3969
```bash
4070
$ mbed compile -m K64F -t GCC_ARM --profile mbed-os/tools/profiles/debug.json -c

mbed-os.lib

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
https://github.com/ARMmbed/mbed-os/#d5de476f74dd4de27012eb74ede078f6330dfc3f
1+
https://github.com/ARMmbed/mbed-os/#c3b9436e12610acaab723f730ab15b48a539a5ac

source/client_a.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,11 @@ static void box_async_runner(const void *)
5656
while (1) {
5757
uint32_t ret;
5858
int status = rpc_fncall_wait(result, UVISOR_WAIT_FOREVER, &ret);
59-
uvisor_ctx->pc->printf("%c: %s '0x%08x'\r\n", (char) uvisor_box_id_self() + '0', (ret == 0) ? "Wrote" : "Failed to write", (unsigned int) number);
59+
uvisor_ctx->pc->printf("%c: %s '0x%08x'\r\n",
60+
(char) uvisor_box_id_self() + '0',
61+
(ret == 0) ? "Wrote" :
62+
"Permission denied. This client cannot write the secure number",
63+
(unsigned int) number);
6064
/* FIXME: Add better error handling. */
6165
if (!status) {
6266
break;

source/client_b.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,11 @@ static void client_b_main(const void *)
6565
while (1) {
6666
uint32_t ret;
6767
int status = rpc_fncall_wait(result, UVISOR_WAIT_FOREVER, &ret);
68-
uvisor_ctx->pc->printf("%c: %s '0x%08x'\r\n", (char) uvisor_box_id_self() + '0', (ret == 0) ? "Wrote" : "Failed to write", (unsigned int) number);
68+
uvisor_ctx->pc->printf("%c: %s '0x%08x'\r\n",
69+
(char) uvisor_box_id_self() + '0',
70+
(ret == 0) ? "Wrote" :
71+
"Permission denied. This client cannot write the secure number",
72+
(unsigned int) number);
6973
if (!status) {
7074
break;
7175
}

source/main.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,11 @@ static void main_async_runner(const void *)
6161
/* TODO typesafe return codes */
6262
uint32_t ret;
6363
status = rpc_fncall_wait(result, UVISOR_WAIT_FOREVER, &ret);
64-
printf("%c: %s '0x%08x'\r\n", (char) uvisor_box_id_self() + '0', (ret == 0) ? "Wrote" : "Failed to write", (unsigned int) number);
64+
printf("%c: %s '0x%08x'\r\n",
65+
(char) uvisor_box_id_self() + '0',
66+
(ret == 0) ? "Wrote" :
67+
"Permission denied. This client cannot write the secure number",
68+
(unsigned int) number);
6569
if (!status) {
6670
break;
6771
}

0 commit comments

Comments
 (0)