Skip to content

Commit d1b8b20

Browse files
RobinKastbergkartben
authored andcommitted
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: Robin Kastberg <[email protected]>
1 parent 4b96cbb commit d1b8b20

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

CMSIS/Core/Include/cmsis_iccarm.h

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -309,13 +309,22 @@ __STATIC_FORCEINLINE void __TZ_set_STACKSEAL_S (uint32_t* stackTop) {
309309

310310
#include "iccarm_builtin.h"
311311

312-
#define __disable_fault_irq __iar_builtin_disable_fiq
313312
#define __disable_irq __iar_builtin_disable_interrupt
314-
#define __enable_fault_irq __iar_builtin_enable_fiq
315313
#define __enable_irq __iar_builtin_enable_interrupt
316314
#define __arm_rsr __iar_builtin_rsr
317315
#define __arm_wsr __iar_builtin_wsr
318316

317+
#if (defined(__ARM_ARCH_ISA_THUMB) && __ARM_ARCH_ISA_THUMB >= 2)
318+
__IAR_FT void __disable_fault_irq()
319+
{
320+
__ASM volatile ("CPSID F" ::: "memory");
321+
}
322+
323+
__IAR_FT void __enable_fault_irq()
324+
{
325+
__ASM volatile ("CPSIE F" ::: "memory");
326+
}
327+
#endif
319328

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

641650

642-
#define __enable_fault_irq __enable_fiq
643-
#define __disable_fault_irq __disable_fiq
651+
__IAR_FT void __disable_fault_irq()
652+
{
653+
__ASM volatile ("CPSID F" ::: "memory");
654+
}
644655

656+
__IAR_FT void __enable_fault_irq()
657+
{
658+
__ASM volatile ("CPSIE F" ::: "memory");
659+
}
645660

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

0 commit comments

Comments
 (0)