You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by ut...@apache.org on 2018/02/28 13:30:46 UTC

[mynewt-core] branch master updated: Replace hardcoded SVC IRQ number with #define

This is an automated email from the ASF dual-hosted git repository.

utzig pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git


The following commit(s) were added to refs/heads/master by this push:
     new 3043da3  Replace hardcoded SVC IRQ number with #define
3043da3 is described below

commit 3043da300e2a69e9ff59348798b323a367e9e51f
Author: Fabio Utzig <ut...@apache.org>
AuthorDate: Mon Feb 26 19:55:41 2018 -0300

    Replace hardcoded SVC IRQ number with #define
    
    Signed-off-by: Fabio Utzig <ut...@apache.org>
---
 hw/mcu/stm/stm32f1xx/include/mcu/mcu.h     | 2 ++
 hw/mcu/stm/stm32l1xx/include/mcu/mcu.h     | 2 ++
 kernel/os/src/arch/cortex_m3/os_arch_arm.c | 7 ++++---
 3 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/hw/mcu/stm/stm32f1xx/include/mcu/mcu.h b/hw/mcu/stm/stm32f1xx/include/mcu/mcu.h
index 8975146..0458b28 100644
--- a/hw/mcu/stm/stm32f1xx/include/mcu/mcu.h
+++ b/hw/mcu/stm/stm32f1xx/include/mcu/mcu.h
@@ -24,6 +24,8 @@
 extern "C" {
 #endif
 
+#define SVC_IRQ_NUMBER SVCall_IRQn
+
 /*
  * Defines for naming GPIOs.
  */
diff --git a/hw/mcu/stm/stm32l1xx/include/mcu/mcu.h b/hw/mcu/stm/stm32l1xx/include/mcu/mcu.h
index 8975146..f468816 100644
--- a/hw/mcu/stm/stm32l1xx/include/mcu/mcu.h
+++ b/hw/mcu/stm/stm32l1xx/include/mcu/mcu.h
@@ -24,6 +24,8 @@
 extern "C" {
 #endif
 
+#define SVC_IRQ_NUMBER SVC_IRQn
+
 /*
  * Defines for naming GPIOs.
  */
diff --git a/kernel/os/src/arch/cortex_m3/os_arch_arm.c b/kernel/os/src/arch/cortex_m3/os_arch_arm.c
index ed577fe..7bb44a6 100755
--- a/kernel/os/src/arch/cortex_m3/os_arch_arm.c
+++ b/kernel/os/src/arch/cortex_m3/os_arch_arm.c
@@ -24,6 +24,8 @@
 #include <hal/hal_os_tick.h>
 #include <bsp/cmsis_nvic.h>
 
+#include "mcu/mcu.h"
+
 #include "os_priv.h"
 
 /*
@@ -210,8 +212,7 @@ os_arch_os_init(void)
             NVIC->IP[i] = -1;
         }
 
-        /* SVC_IRQn or SVCall_IRQn depending on specific model */
-        NVIC_SetVector(-5, (uint32_t)SVC_Handler);
+        NVIC_SetVector(SVC_IRQ_NUMBER, (uint32_t)SVC_Handler);
         NVIC_SetVector(PendSV_IRQn, (uint32_t)PendSV_Handler);
         NVIC_SetVector(SysTick_IRQn, (uint32_t)SysTick_Handler);
 
@@ -233,7 +234,7 @@ os_arch_os_init(void)
         NVIC_SetPriority(PendSV_IRQn, PEND_SV_PRIO);
 
         /* Set the SVC interrupt to priority 0 (highest configurable) */
-        NVIC_SetPriority(-5, SVC_PRIO);
+        NVIC_SetPriority(SVC_IRQ_NUMBER, SVC_PRIO);
 
         /* Check if privileged or not */
         if ((__get_CONTROL() & 1) == 0) {

-- 
To stop receiving notification emails like this one, please contact
utzig@apache.org.