uVisor: Re-import RTX5-capable uVisor

Use a newer version of uVisor that doesn't change the box main thread
function type. Previously, we required all box main thread definitions
to change from taking a `const void *` to a `void *` when moving to
RTX5. We now are backwards compatibile.
pull/4294/head
Jaeden Amero 2017-05-11 14:59:57 +01:00 committed by Martin Kojtal
parent 6be9e47a07
commit 0016bd4639
15 changed files with 15 additions and 15 deletions

View File

@ -1,16 +1,16 @@
592 Milosch Meriac
547 Alessandro Angelino
554 Alessandro Angelino
105 Jaeden Amero
65 Niklas Hauser
5 Irit Arkin
3 JaredCJR
3 AnotherButler
3 Hugo Vincent
3 Jim Huang
3 JaredCJR
2 tonyyanxuan
2 Amanda Butler
2 Jan Jongboom
2 Nathan Chong
2 Vincenzo Frascino
1 Amanda Butler
1 Aksel Skauge Mellbye
1 AnotherButler
1 ccli8
1 Aksel Skauge Mellbye

View File

@ -310,13 +310,13 @@ If the LED is blinking, the app is running correctly. If you press the `SW2` but
## Expose public secure entry points to the secure box
[Go to top](#overview)
So far the code in the secure box cannot communicate to other boxes. To let other boxes call functions in our secure box you can define public secure entry points. These entry points can map to private functions within the context of a secure box, and the arguments and return values are automatically serialized using an RPC protocol to ensure no private memory can be leaked to external boxes.
So far, the code in the secure box cannot communicate to other boxes. To let other boxes call functions in our secure box, you can define public secure entry points. These entry points can map to private functions within the context of a secure box, and an RPC protocol automatically serializes the arguments and return values to ensure no private memory can leak to external boxes.
You can define a public secure entry point to retrieve the index value from the secure box. This index value is increased every time the `SW2` button is pressed.
You can define a public secure entry point to retrieve the index value from the secure box. This index value increases every time you press the `SW2` button.
### Defining a secure entry point
Create a new source file, `~/code/uvisor-example/source/secure_box.h`. In here we will define the functions that can be called through RPC.
Create a new source file, `~/code/uvisor-example/source/secure_box.h`, where you will define the functions that you can call through RPC.
```cpp
/* ~/code/uvisor-example/source/secure_box.h */
@ -333,7 +333,7 @@ UVISOR_EXTERN int (*secure_get_index)(void);
### Implementing a secure entry point
Now that you have defined the secure entry point, you can map the entry point to a function running in the secure box. This is done through the `UVISOR_BOX_RPC_GATEWAY_SYNC` macro. Open `~/code/uvisor-example/source/secure_box.cpp`, and replace the line with `#define PRIVATE_BUTTON_BUFFER_COUNT 8` by:
Now that you have defined the secure entry point, you can map the entry point to a function running in the secure box. You can do this through the `UVISOR_BOX_RPC_GATEWAY_SYNC` macro. Open `~/code/uvisor-example/source/secure_box.cpp`, and replace the line with `#define PRIVATE_BUTTON_BUFFER_COUNT 8` by:
```cpp
/* ~/code/uvisor-example/source/secure_box.cpp */
@ -351,7 +351,7 @@ UVISOR_BOX_RPC_GATEWAY_SYNC (private_button, secure_get_index, get_index, int, v
### Listening for RPC messages
To receive RPC messages you will need to spin up a new thread, running in the secure box context. You can do this in the main thread of the secure box. In `~/code/uvisor-example/source/secure_box.cpp`, replace the first five lines of `private_button_main_thread` with:
To receive RPC messages, you need to spin up a new thread, running in the secure box context. You can do this in the main thread of the secure box. In `~/code/uvisor-example/source/secure_box.cpp`, replace the first five lines of `private_button_main_thread` with:
```cpp
/* ~/code/uvisor-example/source/secure_box.cpp */
@ -397,7 +397,7 @@ To call the public secure entry point from any other box, you can use the `secur
#include "secure-box.h"
```
And then replace the `main` function with:
Then replace the `main` function with:
```cpp
/* ~/code/uvisor-example/source/main.cpp */
@ -412,7 +412,7 @@ int main(void)
}
```
You can observe the secure index by opening a serial port connection to the device, with a baud rate of 9600. When you press the `SW2` button the index will be increased.
You can observe the secure index by opening a serial port connection to the device with a baud rate of 9600. When you press the `SW2` button, the index will increase.
## The NVIC APIs

View File

@ -1 +1 @@
20170407_v7-M
v0.27.0-23-g8231ae897dadbb1c3eeb79ae2103d308d28c7e14

View File

@ -27,7 +27,7 @@ UVISOR_EXTERN const uint32_t __uvisor_mode;
UVISOR_EXTERN void const * const public_box_cfg_ptr;
typedef struct {
void (*function)(void *);
void (*function)(const void *);
size_t priority;
size_t stack_size;
} uvisor_box_main_t;

View File

@ -137,7 +137,7 @@ void __uvisor_lib_box_init(void * lib_config)
uvisor_error(USER_NOT_ALLOWED);
}
thread_id = osThreadNew(box_main->function, NULL, &thread_attr);
thread_id = osThreadNew((osThreadFunc_t) box_main->function, NULL, &thread_attr);
if (thread_id == NULL) {
/* Failed to create thread */