Commit d1b8b20b authored by Robin Kastberg's avatar Robin Kastberg Committed by Benjamin Cabé
Browse files

Backport CMSIS_6#102 to CMSIS 5.9.0



Currently CMSIS 5 is broken with the IAR compiler, and will not be patched.
I tried lifting zephyr to CMSIS 6 but this was non-trivial.

One way to fix this without ugly kludges inside zephyr
is backporting the fix from
zephyrproject-rtos/CMSIS_6/commit/db3f1703087023f67465bbd338509e2d5322746c
fix to CMSIS 5.9.0.

Signed-off-by: default avatarRobin Kastberg <robin.kastberg@iar.com>
parent 4b96cbb1
Loading
Loading
Loading
Loading
+19 −4
Original line number Diff line number Diff line
@@ -309,13 +309,22 @@ __STATIC_FORCEINLINE void __TZ_set_STACKSEAL_S (uint32_t* stackTop) {

  #include "iccarm_builtin.h"

  #define __disable_fault_irq __iar_builtin_disable_fiq
  #define __disable_irq       __iar_builtin_disable_interrupt
  #define __enable_fault_irq  __iar_builtin_enable_fiq
  #define __enable_irq        __iar_builtin_enable_interrupt
  #define __arm_rsr           __iar_builtin_rsr
  #define __arm_wsr           __iar_builtin_wsr

  #if (defined(__ARM_ARCH_ISA_THUMB) && __ARM_ARCH_ISA_THUMB >= 2)
    __IAR_FT void __disable_fault_irq()
    {
      __ASM volatile ("CPSID F" ::: "memory");
    }

    __IAR_FT void __enable_fault_irq()
    {
      __ASM volatile ("CPSIE F" ::: "memory");
    }
  #endif

  #define __get_APSR()                (__arm_rsr("APSR"))
  #define __get_BASEPRI()             (__arm_rsr("BASEPRI"))
@@ -639,9 +648,15 @@ __STATIC_FORCEINLINE void __TZ_set_CONTROL_NS(uint32_t control)
    }


    #define __enable_fault_irq  __enable_fiq
    #define __disable_fault_irq __disable_fiq
    __IAR_FT void __disable_fault_irq()
    {
      __ASM volatile ("CPSID F" ::: "memory");
    }

    __IAR_FT void __enable_fault_irq()
    {
      __ASM volatile ("CPSIE F" ::: "memory");
    }

  #endif /* (__CORTEX_M >= 0x03) */