This is an automated email from the ASF dual-hosted git repository.

acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new 180f1f80fb7 arm/nrf54l: always attach the PendSV handler
180f1f80fb7 is described below

commit 180f1f80fb741b50edbd865e9ee390d145b21142
Author: raiden00pl <[email protected]>
AuthorDate: Wed Sep 30 19:17:39 2026 +0200

    arm/nrf54l: always attach the PendSV handler
    
    ARMv8-M arm_doirq() dispatches PendSV when ARCH_HIPRI_INTERRUPT is
    enabled (selected by the SoftDevice Controller). The handler was only
    attached with DEBUG_FEATURES, so without it the first PendSV hit
    irq_unexpected_isr and the board hung after the NSH prompt.
    
    Assisted-by: Claude:claude-opus-5-5
    Signed-off-by: raiden00pl <[email protected]>
---
 arch/arm/src/nrf54l/nrf54l_irq.c | 23 +++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)

diff --git a/arch/arm/src/nrf54l/nrf54l_irq.c b/arch/arm/src/nrf54l/nrf54l_irq.c
index d3a3567c40d..501a1f1ee11 100644
--- a/arch/arm/src/nrf54l/nrf54l_irq.c
+++ b/arch/arm/src/nrf54l/nrf54l_irq.c
@@ -135,15 +135,6 @@ static void nrf54l_dumpnvic(const char *msg, int irq)
  *
  ****************************************************************************/
 
-#ifdef CONFIG_DEBUG_FEATURES
-static int nrf54l_nmi(int irq, void *context, void *arg)
-{
-  up_irq_save();
-  _err("PANIC!!! NMI received\n");
-  PANIC();
-  return 0;
-}
-
 static int nrf54l_pendsv(int irq, void *context, void *arg)
 {
   /* ARMv8-M uses PendSV to finish a context switch requested by a direct
@@ -153,6 +144,15 @@ static int nrf54l_pendsv(int irq, void *context, void *arg)
   return 0;
 }
 
+#ifdef CONFIG_DEBUG_FEATURES
+static int nrf54l_nmi(int irq, void *context, void *arg)
+{
+  up_irq_save();
+  _err("PANIC!!! NMI received\n");
+  PANIC();
+  return 0;
+}
+
 static int nrf54l_reserved(int irq, void *context, void *arg)
 {
   up_irq_save();
@@ -336,6 +336,10 @@ void up_irqinitialize(void)
   up_enable_irq(NRF54L_IRQ_MEMFAULT);
 #endif
 
+  /* PendSV is always needed: arm_doirq() dispatches it */
+
+  irq_attach(NRF54L_IRQ_PENDSV, nrf54l_pendsv, NULL);
+
   /* Attach all other processor exceptions (except reset and sys tick) */
 
 #ifdef CONFIG_DEBUG_FEATURES
@@ -345,7 +349,6 @@ void up_irqinitialize(void)
 #endif
   irq_attach(NRF54L_IRQ_BUSFAULT, arm_busfault, NULL);
   irq_attach(NRF54L_IRQ_USAGEFAULT, arm_usagefault, NULL);
-  irq_attach(NRF54L_IRQ_PENDSV, nrf54l_pendsv, NULL);
   arm_enable_dbgmonitor();
   irq_attach(NRF54L_IRQ_DBGMONITOR, arm_dbgmonitor, NULL);
   irq_attach(NRF54L_IRQ_RESERVED, nrf54l_reserved, NULL);

Reply via email to