Skip to content

Commit

Permalink
arm: ensure SysTick IRQ level is set unconditionally
Browse files Browse the repository at this point in the history
When the SoC implements SysTick, but the system
does not use it as the driver for system timing
we still need to set its interrupt level. This
is because the SysTick IRQ is always enabled,
so we must ensure the interrupt priority is set
to a level lower than the kernel interrupts (for
the assert mechanism to work properly) in case
the SysTick interrupt is accidentaly raised.

Signed-off-by: Ioannis Glaropoulos <[email protected]>
  • Loading branch information
ioannisg authored and cfriedt committed Jul 29, 2021
1 parent 28a59f6 commit 6981b84
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions arch/arm/include/aarch32/cortex_m/exc.h
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,19 @@ static ALWAYS_INLINE void z_arm_exc_setup(void)
* SecureHardFault in a PE without the Main Extension.
*/
#endif /* ARM_SECURE_FIRMWARE && !ARM_SECURE_BUSFAULT_HARDFAULT_NMI */

#if defined(CONFIG_CPU_CORTEX_M_HAS_SYSTICK) && \
!defined(CONFIG_CORTEX_M_SYSTICK)
/* SoC implements SysTick, but the system does not use it
* as driver for system timing. However, the SysTick IRQ is
* always enabled, so we must ensure the interrupt priority
* is set to a level lower than the kernel interrupts (for
* the assert mechanism to work properly) in case the SysTick
* interrupt is accidentally raised.
*/
NVIC_SetPriority(SysTick_IRQn, _EXC_IRQ_DEFAULT_PRIO);
#endif /* CPU_CORTEX_M_HAS_SYSTICK && ! CORTEX_M_SYSTICK */

}

/**
Expand Down

0 comments on commit 6981b84

Please sign in to comment.