From 1526b55bc86eb0b80d39e4cb4f228c7e0a2d5c44 Mon Sep 17 00:00:00 2001 From: Ian Douglas Scott Date: Sun, 12 Jan 2025 20:18:55 -0800 Subject: [PATCH] arch/arm/rp23xx: Set priority for svcall exception Fixes https://github.com/apache/nuttx/issues/15503. Signed-off-by: Ian Douglas Scott --- arch/arm/src/rp23xx/rp23xx_irq.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/arch/arm/src/rp23xx/rp23xx_irq.c b/arch/arm/src/rp23xx/rp23xx_irq.c index 450e2315b97b6..2bf5e4975e3db 100644 --- a/arch/arm/src/rp23xx/rp23xx_irq.c +++ b/arch/arm/src/rp23xx/rp23xx_irq.c @@ -181,6 +181,27 @@ static int rp23xx_reserved(int irq, void *context, void *arg) } #endif +/**************************************************************************** + * Name: rp23xx_prioritize_syscall + * + * Description: + * Set the priority of an exception. This function may be needed + * internally even if support for prioritized interrupts is not enabled. + * + ****************************************************************************/ + +static inline void rp23xx_prioritize_syscall(int priority) +{ + uint32_t regval; + + /* SVCALL is system handler 11 */ + + regval = getreg32(NVIC_SYSH8_11_PRIORITY); + regval &= ~NVIC_SYSH_PRIORITY_PR11_MASK; + regval |= (priority << NVIC_SYSH_PRIORITY_PR11_SHIFT); + putreg32(regval, NVIC_SYSH8_11_PRIORITY); +} + /**************************************************************************** * Name: rp23xx_clrpend * @@ -276,6 +297,8 @@ void up_irqinitialize(void) irq_attach(RP23XX_IRQ_SVCALL, arm_svcall, NULL); irq_attach(RP23XX_IRQ_HARDFAULT, arm_hardfault, NULL); + rp23xx_prioritize_syscall(NVIC_SYSH_SVCALL_PRIORITY); + /* Attach all other processor exceptions (except reset and sys tick) */ #ifdef CONFIG_DEBUG_FEATURES