Skip to content

Commit c9a7f73

Browse files
authored
Merge pull request #2413 from 0xc0170/fix_5.1.1
Fixes from master
2 parents 0712b8a + e32b258 commit c9a7f73

File tree

6 files changed

+44
-15
lines changed

6 files changed

+44
-15
lines changed

docs/BUILDING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,7 @@ Build successes:
444444
```
445445
* We can print all 'programs' (test cases) ```make.py``` can build for us:
446446
```
447-
$ python make.py
447+
$ python make.py -L
448448
.
449449
[ 0] MBED_A1: Basic
450450
[ 1] MBED_A2: Semihost file system

features/FEATURE_UVISOR/README.md

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -129,15 +129,14 @@ In the code above we specified 3 elements:
129129
1. Main box Access Control Lists (ACLs). Since with uVisor enabled everything runs in unprivileged mode, we need to make sure that peripherals that are accessed by the OS and the main box are allowed. These peripherals are specified using a list like the one in the snippet above. For the purpose of this example we provide you the list of all the ACLs that we know you will need. For other platforms or other applications you need to determine those ACLs following a process that is described in a [section](#the-main-box-acls) below.
130130
1. App-specific uVisor configurations: `UVISOR_SET_MODE_ACL`. This macro sets the uVisor mode (enabled) and associates the list of ACLs we just created with the main box.
131131
132-
Before compiling, we need to add a custom target that inherits all the features of the original `K64F` target, and enables the uVisor feature. To do so, add the file `~/code/uvisor-example/mbed_app.json` with the following content:
132+
Before compiling, we need to override the original `K64F` target to enable the uVisor feature. To do so, add the file `~/code/uvisor-example/mbed_app.json` with the following content:
133133
134134
```JSON
135135
{
136-
"custom_targets": {
137-
"K64F_SECURE": {
138-
"inherits": ["K64F"],
139-
"extra_labels_add":["K64F", "UVISOR_SUPPORTED"],
140-
"features_add": ["UVISOR"]
136+
"target_overrides": {
137+
"K64F": {
138+
"target.features_add": ["UVISOR"],
139+
"target.extra_labels_add": ["UVISOR_SUPPORTED"]
141140
}
142141
}
143142
}
@@ -147,16 +146,16 @@ Before compiling, we need to add a custom target that inherits all the features
147146

148147
**Checkpoint**
149148

150-
Compile the application again, but this time targeting `K64F_SECURE`:
149+
Compile the application again. This time the `K64F` target will include the new features and labels we provided in `mbed_app.json`;
151150

152151
```bash
153-
$ mbed compile -m K64F_SECURE -t GCC_ARM
152+
$ mbed compile -m K64F -t GCC_ARM
154153
```
155154

156155
The binary will be located at:
157156

158157
```bash
159-
~/code/uvisor-example/.build/K64F_SECURE/GCC_ARM/uvisor-example.bin
158+
~/code/uvisor-example/.build/K64F/GCC_ARM/uvisor-example.bin
160159
```
161160

162161
Re-flash the device and press the reset button. The device LED should be blinking as in the previous case.
@@ -290,7 +289,13 @@ A few things to note in the code above:
290289

291290
**Checkpoint**
292291

293-
Compile the application again, re-flash the device, and press the reset button. The device LED should be blinking as in the previous case.
292+
Compile the application again:
293+
294+
```bash
295+
$ mbed compile -m K64F -t GCC_ARM
296+
```
297+
298+
Re-flash the device, and press the reset button. The device LED should be blinking as in the previous case.
294299

295300
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.
296301

@@ -374,7 +379,7 @@ static const UvisorBoxAclItem g_main_box_acls[] = {
374379
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:
375380

376381
```bash
377-
$ mbed compile -m K64F_SECURE -t GCC_ARM -o "debug-info"
382+
$ mbed compile -m K64F -t GCC_ARM -o "debug-info"
378383
```
379384

380385
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.

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

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
typedef uint32_t uvisor_rpc_result_t;
3434

3535
typedef uint32_t (*TFN_Ptr)(uint32_t, uint32_t, uint32_t, uint32_t);
36-
typedef int (*TFN_RPC_Callback)(int);
3736

3837
/** Wait for incoming RPC.
3938
*
@@ -43,6 +42,21 @@ typedef int (*TFN_RPC_Callback)(int);
4342
* @param timeout_ms specifies how long to wait (in ms) for an incoming RPC
4443
* message before returning
4544
*/
46-
int rpc_fncall_waitfor(const TFN_Ptr fn_ptr_array[], size_t fn_count, uint32_t timeout_ms);
45+
UVISOR_EXTERN int rpc_fncall_waitfor(const TFN_Ptr fn_ptr_array[], size_t fn_count, uint32_t timeout_ms);
46+
47+
/** Wait for an outgoing RPC to finish.
48+
*
49+
* Wait for the result of a previously started asynchronous RPC. After this
50+
* call, ret will contain the return value of the RPC. The return value of this
51+
* function may indicate that there was an error or a timeout with non-zero.
52+
*
53+
* @param result[in] The token to wait on for the result of an asynchronous RPC
54+
* @param timeout_ms[in] How long to wait (in ms) for the asynchronous RPC
55+
* message to finish before returning
56+
* @param ret[out] The return value resulting from the finished RPC to
57+
* the target function
58+
* @returns Non-zero on error or timeout, zero on successful wait
59+
*/
60+
UVISOR_EXTERN int rpc_fncall_wait(uvisor_rpc_result_t result, uint32_t timeout_ms, uint32_t * ret);
4761

4862
#endif /* __UVISOR_API_RPC_H__ */

hal/targets.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -786,6 +786,7 @@
786786
"release_versions": ["2"]
787787
},
788788
"NUCLEO_F429ZI": {
789+
"supported_form_factors": ["ARDUINO"],
789790
"inherits": ["Target"],
790791
"core": "Cortex-M4F",
791792
"default_toolchain": "ARM",

hal/targets/hal/TARGET_STM/TARGET_STM32F1/serial_api.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434

3535
#include "cmsis.h"
3636
#include "pinmap.h"
37+
#include "mbed_error.h"
3738
#include <string.h>
3839
#include "PeripheralPins.h"
3940

@@ -67,7 +68,12 @@ static void init_uart(serial_t *obj)
6768
UartHandle.Init.Mode = UART_MODE_TX_RX;
6869
}
6970

70-
HAL_UART_Init(&UartHandle);
71+
// Fix because HAL_RCC_GetHCLKFreq() don't update anymore SystemCoreClock
72+
SystemCoreClockUpdate();
73+
74+
if (HAL_UART_Init(&UartHandle) != HAL_OK) {
75+
error("Cannot initialize UART\n");
76+
}
7177

7278
}
7379

rtos/rtos/Thread.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,9 @@ osStatus Thread::terminate() {
104104
ret = osThreadTerminate(_tid);
105105
_tid = (osThreadId)NULL;
106106

107+
// Wake threads joining the terminated thread
108+
_join_sem.release();
109+
107110
_mutex.unlock();
108111
return ret;
109112
}

0 commit comments

Comments
 (0)