From e22280e6844ba585cf989c361956af4aef4a863d Mon Sep 17 00:00:00 2001 From: Alessandro Angelino Date: Tue, 28 Jun 2016 18:52:11 +0100 Subject: [PATCH] RTOS: Only set the SVC priority if uVisor is not present uVisor requires the SVCall to have priority 0, while RTX allows it to be the second lowest priority level in the system (after PendSV). This commit makes sure that the SVCall priority is not changed if uVisor is present. The PendSV priority is not affected. --- rtos/rtx/TARGET_CORTEX_M/rt_HAL_CM.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/rtos/rtx/TARGET_CORTEX_M/rt_HAL_CM.h b/rtos/rtx/TARGET_CORTEX_M/rt_HAL_CM.h index d6bac9a0db..c43a51b6af 100644 --- a/rtos/rtx/TARGET_CORTEX_M/rt_HAL_CM.h +++ b/rtos/rtx/TARGET_CORTEX_M/rt_HAL_CM.h @@ -255,7 +255,11 @@ __inline static void rt_svc_init (void) { if (prigroup >= sh) { sh = prigroup + 1U; } + +/* Only change the SVCall priority if uVisor is not present. */ +#if !(defined(FEATURE_UVISOR) && defined(TARGET_UVISOR_SUPPORTED)) NVIC_SYS_PRI2 = ((0xFEFFFFFFU << sh) & 0xFF000000U) | (NVIC_SYS_PRI2 & 0x00FFFFFFU); +#endif /* !(defined(FEATURE_UVISOR) && defined(TARGET_UVISOR_SUPPORTED)) */ #endif }