Skip to content

Commit bb12868

Browse files
committed
uVisor: Update to v0.20.0-alpha
This release brings the support of Keil RTX with uVisor on mbed OS, plus several other improvements. **New features** * Integration in Keil RTX in mbed OS. * Secure dynamic allocation APIs. * Box initialization routines. * Register gateway. * vMPU recovery generalized for both Kinetis and ARMv7-M MPUs. * APIs for per-box interrupts disablement and re-enablement. **Work in progress** * Remote Procedure Call (RPC). New API signatures have been published. * The alpha-level implementation will follow soon. **Deprecated features** * Secure gateway. Cross-box communication will be implemented with RPC * gateways. **Bugfixes** * Several ARMv7-M-specific bug fixes. * Fixed a bug that sent the device into lock-up after a hard fault. * Fixed checks on revision numbers for Cortex-M devices. **Miscellaneous improvements** * Optimized memory protection for ARMv7-M devices with shared SRAM. * Build artifacts are grouped into the target/build * option/configuration-specific folder. * Documents have been grouped into API vs. core documents. * Improved style and consistency.
1 parent 99ea8a3 commit bb12868

File tree

13 files changed

+40
-11
lines changed

13 files changed

+40
-11
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/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

features/FEATURE_UVISOR/includes/uvisor/api/inc/uvisor-lib.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@
3232
#include "api/inc/error.h"
3333
#include "api/inc/interrupts.h"
3434
#include "api/inc/register_gateway.h"
35+
#include "api/inc/rpc.h"
36+
#include "api/inc/rpc_gateway.h"
3537
#include "api/inc/secure_access.h"
3638

3739
#else /* defined(UVISOR_PRESENT) && UVISOR_PRESENT == 1 */
@@ -55,6 +57,7 @@ UVISOR_EXTERN int uvisor_lib_init(void);
5557
#include "api/inc/export_table_exports.h"
5658
#include "api/inc/halt_exports.h"
5759
#include "api/inc/register_gateway_exports.h"
60+
#include "api/inc/rpc_gateway_exports.h"
5861
#include "api/inc/svc_exports.h"
5962
#include "api/inc/priv_sys_irq_hook_exports.h"
6063
#include "api/inc/unvic_exports.h"

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

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,19 +29,36 @@
2929
#define UVISOR_EXTERN extern
3030
#endif/*__CPP__*/
3131

32+
/** Extern C block macros
33+
*
34+
* Use these macros to disable name mangling in C++. Use these macros instead
35+
* of UVISOR_EXTERN when you also need to initialize the object. C++ compilers
36+
* warn when initializing an object declared as `extern`. Use of these macros
37+
* enables the defining of global non-name-mangled symbols in C++ without
38+
* affecting C code (which doesn't ever name mangle). */
39+
#ifdef __cplusplus
40+
#define UVISOR_EXTERN_C_BEGIN extern "C" {
41+
#define UVISOR_EXTERN_C_END }
42+
#else
43+
#define UVISOR_EXTERN_C_BEGIN
44+
#define UVISOR_EXTERN_C_END
45+
#endif
46+
3247
/* asm keyword */
3348
#ifndef asm
3449
#define asm __asm__
3550
#endif
3651

3752
/* Shared compiler attributes */
3853
#if defined(__ICCARM__)
54+
#define UVISOR_ALIGN(x) __align(x)
3955
#define UVISOR_FORCEINLINE inline
4056
#define UVISOR_PACKED __packed
4157
#define UVISOR_WEAK __weak
4258
#define UVISOR_NORETURN __noreturn
4359
#define UVISOR_RAMFUNC __ramfunc
4460
#else
61+
#define UVISOR_ALIGN(x) __attribute__((aligned(x)))
4562
#define UVISOR_FORCEINLINE inline __attribute__((always_inline))
4663
#define UVISOR_PACKED __attribute__((packed))
4764
#define UVISOR_WEAK __attribute__((weak))
@@ -52,6 +69,15 @@
5269
/* array count macro */
5370
#define UVISOR_ARRAY_COUNT(x) (sizeof(x)/sizeof(x[0]))
5471

72+
/** Static Assertion Macro
73+
*
74+
* This macro works from both inside and outside function scope.
75+
*
76+
* FIXME This is currently not implemented. This issue is tracked at
77+
* https://github.com/ARMmbed/uvisor/issues/288
78+
*/
79+
#define UVISOR_STATIC_ASSERT(cond, msg)
80+
5581
/* convert macro argument to string */
5682
/* note: this needs one level of indirection, accomplished with the helper macro
5783
* __UVISOR_TO_STRING */

0 commit comments

Comments
 (0)