arm: route PendSV to spurious IRQ handler if it is unused
If the PendSV interrupt is not used by Zephyr (this is the case when we build with single-thread support) we route the interrupt to z_arm_exc_spurious, instead of assigning 0 to the vector table entry. This is because the interrupt is always enabled and always exists, so it is safer to always get the proper error report, in case we accidentally pend the PendSV, for any reason. We also add a comment in the PendSV priority setting, explaining why it has to be assigned a priority level even if it is not used. Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
This commit is contained in:
parent
41d3d38aec
commit
28a59f67b9
2 changed files with 4 additions and 1 deletions
|
@ -73,7 +73,7 @@ SECTION_SUBSEC_FUNC(exc_vector_table,_vector_table_section,_vector_table)
|
||||||
#if defined(CONFIG_MULTITHREADING)
|
#if defined(CONFIG_MULTITHREADING)
|
||||||
.word z_arm_pendsv
|
.word z_arm_pendsv
|
||||||
#else
|
#else
|
||||||
.word 0
|
.word z_arm_exc_spurious
|
||||||
#endif
|
#endif
|
||||||
#if defined(CONFIG_CPU_CORTEX_M_HAS_SYSTICK)
|
#if defined(CONFIG_CPU_CORTEX_M_HAS_SYSTICK)
|
||||||
#if defined(CONFIG_SYS_CLOCK_EXISTS)
|
#if defined(CONFIG_SYS_CLOCK_EXISTS)
|
||||||
|
|
|
@ -98,6 +98,9 @@ static ALWAYS_INLINE bool z_arm_preempted_thread_in_user_mode(const z_arch_esf_t
|
||||||
*/
|
*/
|
||||||
static ALWAYS_INLINE void z_arm_exc_setup(void)
|
static ALWAYS_INLINE void z_arm_exc_setup(void)
|
||||||
{
|
{
|
||||||
|
/* PendSV is set to lowest priority, regardless of it being used.
|
||||||
|
* This is done as the IRQ is always enabled.
|
||||||
|
*/
|
||||||
NVIC_SetPriority(PendSV_IRQn, _EXC_PENDSV_PRIO);
|
NVIC_SetPriority(PendSV_IRQn, _EXC_PENDSV_PRIO);
|
||||||
|
|
||||||
#ifdef CONFIG_CPU_CORTEX_M_HAS_BASEPRI
|
#ifdef CONFIG_CPU_CORTEX_M_HAS_BASEPRI
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue