From a6895df7b40cf0cd72676965601ed172b0f4210c Mon Sep 17 00:00:00 2001 From: EvArk Date: Wed, 3 Aug 2016 16:40:28 +0300 Subject: [PATCH 1/7] STM32F1 serial_api initialize failure message --- hal/targets/hal/TARGET_STM/TARGET_STM32F1/serial_api.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/hal/targets/hal/TARGET_STM/TARGET_STM32F1/serial_api.c b/hal/targets/hal/TARGET_STM/TARGET_STM32F1/serial_api.c index dffaf315a47..c7139beeda8 100644 --- a/hal/targets/hal/TARGET_STM/TARGET_STM32F1/serial_api.c +++ b/hal/targets/hal/TARGET_STM/TARGET_STM32F1/serial_api.c @@ -34,6 +34,7 @@ #include "cmsis.h" #include "pinmap.h" +#include "mbed_error.h" #include #include "PeripheralPins.h" @@ -67,7 +68,12 @@ static void init_uart(serial_t *obj) UartHandle.Init.Mode = UART_MODE_TX_RX; } - HAL_UART_Init(&UartHandle); + // Fix because HAL_RCC_GetHCLKFreq() don't update anymore SystemCoreClock + SystemCoreClockUpdate(); + + if (HAL_UART_Init(&UartHandle) != HAL_OK) { + error("Cannot initialize UART\n"); + } } From 4aaec8df02cc6b8661f68e649e8fbe86d6f65d80 Mon Sep 17 00:00:00 2001 From: Evangelos Arkalis Date: Thu, 4 Aug 2016 15:32:31 +0300 Subject: [PATCH 2/7] Alignment fixed --- hal/targets/hal/TARGET_STM/TARGET_STM32F1/serial_api.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hal/targets/hal/TARGET_STM/TARGET_STM32F1/serial_api.c b/hal/targets/hal/TARGET_STM/TARGET_STM32F1/serial_api.c index c7139beeda8..bfa025b96e2 100644 --- a/hal/targets/hal/TARGET_STM/TARGET_STM32F1/serial_api.c +++ b/hal/targets/hal/TARGET_STM/TARGET_STM32F1/serial_api.c @@ -68,7 +68,7 @@ static void init_uart(serial_t *obj) UartHandle.Init.Mode = UART_MODE_TX_RX; } - // Fix because HAL_RCC_GetHCLKFreq() don't update anymore SystemCoreClock + // Fix because HAL_RCC_GetHCLKFreq() don't update anymore SystemCoreClock SystemCoreClockUpdate(); if (HAL_UART_Init(&UartHandle) != HAL_OK) { From cde0575d82c718ca121db3bba6a95b60c056400f Mon Sep 17 00:00:00 2001 From: Russ Butler Date: Fri, 5 Aug 2016 16:01:45 -0500 Subject: [PATCH 3/7] Add ARDUINO to supported form factors of F429ZI Add support for the arduino form factor in targets.json for the NUCLEO_F429ZI. --- hal/targets.json | 1 + 1 file changed, 1 insertion(+) diff --git a/hal/targets.json b/hal/targets.json index 621cfd025cb..83034808a88 100644 --- a/hal/targets.json +++ b/hal/targets.json @@ -786,6 +786,7 @@ "release_versions": ["2"] }, "NUCLEO_F429ZI": { + "supported_form_factors": ["ARDUINO"], "inherits": ["Target"], "core": "Cortex-M4F", "default_toolchain": "ARM", From 9625fde66ece44d001cde01d8ccb97493e9391e0 Mon Sep 17 00:00:00 2001 From: kclin Date: Sun, 7 Aug 2016 00:01:19 +0800 Subject: [PATCH 4/7] Fix docs/BUILDING.md error command issue --- docs/BUILDING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/BUILDING.md b/docs/BUILDING.md index 8f02c1a0cfb..33e9959a180 100644 --- a/docs/BUILDING.md +++ b/docs/BUILDING.md @@ -444,7 +444,7 @@ Build successes: ``` * We can print all 'programs' (test cases) ```make.py``` can build for us: ``` -$ python make.py +$ python make.py -L . [ 0] MBED_A1: Basic [ 1] MBED_A2: Semihost file system From 88f412f6014bb2e087b9e817cf6677a476c2c6d0 Mon Sep 17 00:00:00 2001 From: Alessandro Angelino Date: Mon, 8 Aug 2016 12:39:47 +0100 Subject: [PATCH 5/7] uVisor: Update README Note: The README is auto-generated by the importer script, which copies the QUICKSTART.md guide from ARMmbed/uvisor. --- features/FEATURE_UVISOR/README.md | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/features/FEATURE_UVISOR/README.md b/features/FEATURE_UVISOR/README.md index 930b7262377..1570d871bde 100644 --- a/features/FEATURE_UVISOR/README.md +++ b/features/FEATURE_UVISOR/README.md @@ -129,15 +129,14 @@ In the code above we specified 3 elements: 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. 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. -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: +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: ```JSON { - "custom_targets": { - "K64F_SECURE": { - "inherits": ["K64F"], - "extra_labels_add":["K64F", "UVISOR_SUPPORTED"], - "features_add": ["UVISOR"] + "target_overrides": { + "K64F": { + "target.features_add": ["UVISOR"], + "target.extra_labels_add": ["UVISOR_SUPPORTED"] } } } @@ -147,16 +146,16 @@ Before compiling, we need to add a custom target that inherits all the features **Checkpoint** -Compile the application again, but this time targeting `K64F_SECURE`: +Compile the application again. This time the `K64F` target will include the new features and labels we provided in `mbed_app.json`; ```bash -$ mbed compile -m K64F_SECURE -t GCC_ARM +$ mbed compile -m K64F -t GCC_ARM ``` The binary will be located at: ```bash -~/code/uvisor-example/.build/K64F_SECURE/GCC_ARM/uvisor-example.bin +~/code/uvisor-example/.build/K64F/GCC_ARM/uvisor-example.bin ``` 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: **Checkpoint** -Compile the application again, re-flash the device, and press the reset button. The device LED should be blinking as in the previous case. +Compile the application again: + +```bash +$ mbed compile -m K64F -t GCC_ARM +``` + +Re-flash the device, and press the reset button. The device LED should be blinking as in the previous case. 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. @@ -374,7 +379,7 @@ static const UvisorBoxAclItem g_main_box_acls[] = { 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: ```bash -$ mbed compile -m K64F_SECURE -t GCC_ARM -o "debug-info" +$ mbed compile -m K64F -t GCC_ARM -o "debug-info" ``` 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. From 80b1ff1371dfc8039f96946e136fc545969b25aa Mon Sep 17 00:00:00 2001 From: Alessandro Angelino Date: Mon, 8 Aug 2016 12:43:23 +0100 Subject: [PATCH 6/7] uVisor: Update the RPC header files This follows: ARMmbed/uvisor#02ecf05 - "Remove unused TFN_RPC_Callback" ARMmbed/uvisor#483ddda - "rpc: Add `rpc_fncall_wait`" ARMmbed/uvisor#fdb7dce - "rpc: Add missing UVISOR_EXTERN to rpc_fncall_waitfor declaration" --- .../includes/uvisor/api/inc/rpc.h | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/features/FEATURE_UVISOR/includes/uvisor/api/inc/rpc.h b/features/FEATURE_UVISOR/includes/uvisor/api/inc/rpc.h index 8bee897bfff..b1a89cef5ad 100644 --- a/features/FEATURE_UVISOR/includes/uvisor/api/inc/rpc.h +++ b/features/FEATURE_UVISOR/includes/uvisor/api/inc/rpc.h @@ -33,7 +33,6 @@ typedef uint32_t uvisor_rpc_result_t; typedef uint32_t (*TFN_Ptr)(uint32_t, uint32_t, uint32_t, uint32_t); -typedef int (*TFN_RPC_Callback)(int); /** Wait for incoming RPC. * @@ -43,6 +42,21 @@ typedef int (*TFN_RPC_Callback)(int); * @param timeout_ms specifies how long to wait (in ms) for an incoming RPC * message before returning */ -int rpc_fncall_waitfor(const TFN_Ptr fn_ptr_array[], size_t fn_count, uint32_t timeout_ms); +UVISOR_EXTERN int rpc_fncall_waitfor(const TFN_Ptr fn_ptr_array[], size_t fn_count, uint32_t timeout_ms); + +/** Wait for an outgoing RPC to finish. + * + * Wait for the result of a previously started asynchronous RPC. After this + * call, ret will contain the return value of the RPC. The return value of this + * function may indicate that there was an error or a timeout with non-zero. + * + * @param result[in] The token to wait on for the result of an asynchronous RPC + * @param timeout_ms[in] How long to wait (in ms) for the asynchronous RPC + * message to finish before returning + * @param ret[out] The return value resulting from the finished RPC to + * the target function + * @returns Non-zero on error or timeout, zero on successful wait + */ +UVISOR_EXTERN int rpc_fncall_wait(uvisor_rpc_result_t result, uint32_t timeout_ms, uint32_t * ret); #endif /* __UVISOR_API_RPC_H__ */ From e32b258229de4971ccb0759888d2574363f08a12 Mon Sep 17 00:00:00 2001 From: Russ Butler Date: Mon, 8 Aug 2016 16:42:20 -0500 Subject: [PATCH 7/7] Fix joining a terminated thread When a thread is terminated signal the join semaphore so any threads joining the terminated thread wake up as expected. --- rtos/rtos/Thread.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/rtos/rtos/Thread.cpp b/rtos/rtos/Thread.cpp index bd254a56ec9..cb62d77165c 100644 --- a/rtos/rtos/Thread.cpp +++ b/rtos/rtos/Thread.cpp @@ -104,6 +104,9 @@ osStatus Thread::terminate() { ret = osThreadTerminate(_tid); _tid = (osThreadId)NULL; + // Wake threads joining the terminated thread + _join_sem.release(); + _mutex.unlock(); return ret; }