Skip to content

Commit a4fb649

Browse files
authored
Merge pull request #2228 from AlessandroA/update_uvisor
Update uVisor to v0.20.0-alpha
2 parents db99e72 + bb12868 commit a4fb649

File tree

17 files changed

+389
-13
lines changed

17 files changed

+389
-13
lines changed

features/FEATURE_UVISOR/README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22

33
This guide will help you get started with uVisor on mbed OS by walking you through creating a sample application for the NXP FRDM-K64F board.
44

5-
The uVisor provides sandboxed environments and resources protection for applications built for ARM Cortex-M3 and Cortex-M4 devices. Here we will show you how to enable the uVisor and configure a secure box to get hold of some exclusive resources (memory, peripherals, interrupts). For more information on the uVisor design philosophy, please check out our the uVisor [introductory document](../README.md).
5+
The uVisor provides sandboxed environments and resources protection for applications built for ARM Cortex-M3 and Cortex-M4 devices. Here we will show you how to enable the uVisor and configure a secure box to get hold of some exclusive resources (memory, peripherals, interrupts). For more information on the uVisor design philosophy, please check out our the uVisor [introductory document](../../README.md).
66

77
## Overview
88

99
To get a basic `blinky` application running on mbed OS with uVisor enabled, you will need the following:
1010

11-
* A platform and a toolchain supported by uVisor on mbed OS. You can verify this on [the official list](../README.md#supported-platforms). Please note that uVisor might support some platform internally, but not on mbed OS. Generally this means that the porting process has only been partially completed. If you want to port your platform to uVisor and enable it on mbed OS, please follow the [uVisor porting guide](PORTING.md).
11+
* A platform and a toolchain supported by uVisor on mbed OS. You can verify this on [the official list](../../README.md#supported-platforms). Please note that uVisor might support some platform internally, but not on mbed OS. Generally this means that the porting process has only been partially completed. If you want to port your platform to uVisor and enable it on mbed OS, please follow the [uVisor Porting Guide for mbed OS](../core/PORTING.md).
1212
* git. It will be used to download the mbed codebase.
1313
* The mbed command-line tools, mbed-cli. You can run `pip install mbed-cli` to install them.
1414

@@ -292,7 +292,7 @@ A few things to note in the code above:
292292

293293
Compile the application again, re-flash the device, and press the reset button. The device LED should be blinking as in the previous case.
294294

295-
If you don't see the LED blinking, it means that the application halted somewhere, probably because uVisor captured a fault. You can setup the uVisor debug messages to see if there is any problem. Follow the [Debugging uVisor](DEBUGGING.md) document for a step-by-step guide.
295+
If you don't see the LED blinking, it means that the application halted somewhere, probably because uVisor captured a fault. You can setup the uVisor debug messages to see if there is any problem. Follow the [Debugging uVisor on mbed OS](DEBUGGING.md) document for a step-by-step guide.
296296

297297
If the LED is blinking, it means that the app is running fine. If you now press the `SW2` button on the NXP FRDM-K64F board, the `private_timer_button_on_press` function will be executed, printing the values in the timer buffer. You can observe these values by opening a serial port connection to the device, with a baud rate of 9600. When the print is completed, you should see the LED blinking again.
298298

@@ -313,8 +313,8 @@ In this guide we showed you how to:
313313

314314
You can now modify the example or create a new one to protect your resources into a secure box. You might find the following resources useful:
315315

316-
* [The uVisor API documentation](API.md)
317-
* [Debugging uVisor](DEBUGGING.md)
316+
* [uVisor API documentation](API.md)
317+
* [Debugging uVisor on mbed OS](DEBUGGING.md)
318318

319319
If you found any bug or inconsistency in this guide, please [raise an issue](https://github.com/ARMmbed/uvisor/issues/new).
320320

@@ -354,7 +354,7 @@ NVIC_EnableIRQ(MY_IRQ);
354354
355355
> **Note**: In this model a call to `NVIC_SetVector` must always happen before an IRQ state is changed. In platforms that don't relocate the interrupt vector table such a call might be originally absent and must be added to work with uVisor.
356356
357-
For more information on the uVisor APIs, checkout the [uVisor APIs documentation](API.md).
357+
For more information on the uVisor APIs, checkout the [uVisor API documentation](API.md) document.
358358
359359
### The *main box* ACLs
360360
@@ -371,13 +371,13 @@ static const UvisorBoxAclItem g_main_box_acls[] = {
371371
}
372372
```
373373

374-
You now need to compile your application using uVisor in debug mode. This operation requires some more advanced steps, which are described in detail in the [Debugging uVisor](DEBUGGING.md) document. The main idea is that you compile the application in debug mode:
374+
You now need to compile your application using uVisor in debug mode. This operation requires some more advanced steps, which are described in detail in the [Debugging uVisor on mbed OS](DEBUGGING.md) document. The main idea is that you compile the application in debug mode:
375375

376376
```bash
377377
$ mbed compile -m K64F_SECURE -t GCC_ARM -o "debug-info"
378378
```
379379

380-
and then use a GDB-compatible interface to flash the device, enable semihosting, and access the uVisor debug messages. Please read the [Debugging uVisor](DEBUGGING.md) document for the detailed instructions.
380+
and then use a GDB-compatible interface to flash the device, enable semihosting, and access the uVisor debug messages. Please read the [Debugging uVisor on mbed OS](DEBUGGING.md) document for the detailed instructions.
381381

382382
Once the uVisor debug messages are enabled, you will see you application fail. The failure is due to the first missing ACL being hit by the main box code. The message will look like:
383383

features/FEATURE_UVISOR/importer/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ TARGET_LIB_INC:=$(TARGET_PREFIX)includes/uvisor-lib
3333

3434
# uVisor source directory - hidden from mbed via TARGET_IGNORE
3535
UVISOR_GIT_URL:=https://github.com/ARMmbed/uvisor
36-
UVISOR_GIT_BRANCH:=dev
36+
UVISOR_GIT_BRANCH:=master
3737
UVISOR_DIR:=TARGET_IGNORE/uvisor
3838
UVISOR_API:=$(UVISOR_DIR)/api
3939
UVISOR_GIT_CFG=$(UVISOR_DIR)/.git/config
@@ -76,7 +76,7 @@ rsync:
7676
rsync -a --delete $(UVISOR_API)/rtx/src/ $(TARGET_LIB_SRC)/rtx
7777
#
7878
# Copying the documentation...
79-
cp $(UVISOR_DIR)/docs/QUICKSTART.md $(TARGET_PREFIX)/README.md
79+
cp $(UVISOR_DIR)/docs/api/QUICKSTART.md $(TARGET_PREFIX)/README.md
8080
#
8181
# Copying licenses
8282
cp $(UVISOR_DIR)/LICENSE* $(TARGET_SUPPORTED)

features/FEATURE_UVISOR/includes/uvisor/api/inc/register_gateway.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
#define uvisor_read(box_name, shared, addr, op, msk) \
7474
({ \
7575
/* Instanstiate the gateway. This gets resolved at link-time. */ \
76-
__attribute__((aligned(4))) static TRegisterGateway const register_gateway = { \
76+
UVISOR_ALIGN(4) static TRegisterGateway const register_gateway = { \
7777
.svc_opcode = UVISOR_SVC_OPCODE(UVISOR_SVC_ID_REGISTER_GATEWAY), \
7878
.branch = BRANCH_OPCODE(__UVISOR_OFFSETOF(TRegisterGateway, branch), \
7979
__UVISOR_OFFSETOF(TRegisterGateway, bxlr)), \
@@ -119,7 +119,7 @@
119119
#define uvisor_write(box_name, shared, addr, val, op, msk) \
120120
{ \
121121
/* Instanstiate the gateway. This gets resolved at link-time. */ \
122-
__attribute__((aligned(4))) static TRegisterGateway const register_gateway = { \
122+
UVISOR_ALIGN(4) static TRegisterGateway const register_gateway = { \
123123
.svc_opcode = UVISOR_SVC_OPCODE(UVISOR_SVC_ID_REGISTER_GATEWAY), \
124124
.branch = BRANCH_OPCODE(__UVISOR_OFFSETOF(TRegisterGateway, branch), \
125125
__UVISOR_OFFSETOF(TRegisterGateway, bxlr)), \

features/FEATURE_UVISOR/includes/uvisor/api/inc/register_gateway_exports.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ typedef struct {
4747
uint32_t mask;
4848
uint16_t operation;
4949
uint16_t bxlr;
50-
} UVISOR_PACKED __attribute__((aligned(4))) TRegisterGateway;
50+
} UVISOR_PACKED UVISOR_ALIGN(4) TRegisterGateway;
5151

5252
/** Register gateway operation - Masks
5353
* @internal
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/*
2+
* Copyright (c) 2016, ARM Limited, All Rights Reserved
3+
* SPDX-License-Identifier: Apache-2.0
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License"); you may
6+
* not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
#ifndef __UVISOR_API_RPC_H__
18+
#define __UVISOR_API_RPC_H__
19+
20+
#include "api/inc/uvisor_exports.h"
21+
#include <stdint.h>
22+
#include <stddef.h>
23+
24+
/** Specify the maximum number of incoming RPC messages for a box
25+
*
26+
* @param max_num_incoming_rpc The maximum number of incoming RPC messages for
27+
* a box
28+
*/
29+
/* FIXME This is a dummy implementation. */
30+
#define UVISOR_BOX_RPC_MAX_INCOMING(max_num_incoming_rpc)
31+
32+
/* This is the token to wait on for the result of an asynchronous RPC. */
33+
typedef uint32_t uvisor_rpc_result_t;
34+
35+
typedef uint32_t (*TFN_Ptr)(uint32_t, uint32_t, uint32_t, uint32_t);
36+
typedef int (*TFN_RPC_Callback)(int);
37+
38+
/** Wait for incoming RPC.
39+
*
40+
* @param fn_ptr_array an array of RPC function targets that this call to
41+
* `rpc_fncall_waitfor` should handle RPC to
42+
* @param fn_count the number of function targets in this array
43+
* @param timeout_ms specifies how long to wait (in ms) for an incoming RPC
44+
* message before returning
45+
*/
46+
int rpc_fncall_waitfor(const TFN_Ptr fn_ptr_array[], size_t fn_count, uint32_t timeout_ms);
47+
48+
#endif /* __UVISOR_API_RPC_H__ */

0 commit comments

Comments
 (0)