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

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


The following commit(s) were added to refs/heads/releases/13.0 by this push:
     new a28a5db9f72 arch/arm: Fix LPC2378 to work again
a28a5db9f72 is described below

commit a28a5db9f7208c370eccc3da522b7c98921c7708
Author: Alan Carvalho de Assis <[email protected]>
AuthorDate: Sun Jun 28 16:21:26 2026 -0300

    arch/arm: Fix LPC2378 to work again
    
    Olimex LPC-2378-STK was the first board I ran NuttX in 2010. Then
    in 2023 I found this board on eBay and decided to buy it to try
    NuttX on it again, but for my disappointment it was not working:
    
https://acassis.wordpress.com/2023/04/01/testing-nuttx-again-on-olimex-lpc2378-stk-board/
    
    Then I opened an Issue: https://github.com/apache/nuttx/issues/19201
    and Xiang Xiao and ldube helped me to get it working again.
    
    Signed-off-by: Alan C. Assis <[email protected]>
---
 arch/arm/include/lpc2378/irq.h           |  2 --
 arch/arm/src/lpc2378/lpc2378.h           |  2 --
 arch/arm/src/lpc2378/lpc23xx_decodeirq.c | 55 +++-----------------------------
 arch/arm/src/lpc2378/lpc23xx_irq.c       |  6 ----
 arch/arm/src/lpc2378/lpc23xx_timerisr.c  | 10 ------
 5 files changed, 4 insertions(+), 71 deletions(-)

diff --git a/arch/arm/include/lpc2378/irq.h b/arch/arm/include/lpc2378/irq.h
index 423159a533d..bf60801f5d2 100644
--- a/arch/arm/include/lpc2378/irq.h
+++ b/arch/arm/include/lpc2378/irq.h
@@ -119,10 +119,8 @@ extern "C"
 #define EXTERN extern
 #endif
 
-#ifndef CONFIG_VECTORED_INTERRUPTS
 void up_attach_vector(int irq, int priority, vic_vector_t handler);
 void up_detach_vector(int vector);
-#endif
 
 #undef EXTERN
 #ifdef __cplusplus
diff --git a/arch/arm/src/lpc2378/lpc2378.h b/arch/arm/src/lpc2378/lpc2378.h
index d9023e84fef..f1495f6601f 100644
--- a/arch/arm/src/lpc2378/lpc2378.h
+++ b/arch/arm/src/lpc2378/lpc2378.h
@@ -50,8 +50,6 @@
  * Pre-processor Definitions
  ****************************************************************************/
 
-/* #define CONFIG_VECTORED_INTERRUPTS */
-
 /****************************************************************************
  * Public Function Prototypes
  ****************************************************************************/
diff --git a/arch/arm/src/lpc2378/lpc23xx_decodeirq.c 
b/arch/arm/src/lpc2378/lpc23xx_decodeirq.c
index c8c56e250ba..5d2b10da088 100644
--- a/arch/arm/src/lpc2378/lpc23xx_decodeirq.c
+++ b/arch/arm/src/lpc2378/lpc23xx_decodeirq.c
@@ -61,7 +61,7 @@
  ****************************************************************************/
 
 /****************************************************************************
- * arm_decodeirq() and/or lpc23xx_decodeirq()
+ * arm_decodeirq()
  *
  * Description:
  *   The vectored interrupt controller (VIC) takes 32 interrupt request
@@ -84,21 +84,11 @@
  *
  ****************************************************************************/
 
-#ifndef CONFIG_VECTORED_INTERRUPTS
 uint32_t *arm_decodeirq(uint32_t *regs)
-#else
-static uint32_t *lpc23xx_decodeirq(uint32_t *regs)
-#endif
 {
-  struct tcb_s *tcb = this_task();
-
 #ifdef CONFIG_SUPPRESS_INTERRUPTS
   err("ERROR: Unexpected IRQ\n");
-
-  tcb->xcp.regs = regs;
-  up_set_interrupt_context(true);
   PANIC();
-  return NULL;
 #else
 
   /* Check which IRQ fires */
@@ -116,50 +106,13 @@ static uint32_t *lpc23xx_decodeirq(uint32_t *regs)
 
   /* Verify that the resulting IRQ number is valid */
 
-  if (irq < NR_IRQS)            /* redundant check ?? */
+  if (irq < NR_IRQS)
     {
-      uint32_t *saveregs;
-      bool savestate;
-
-      savestate = up_interrupt_context();
-      saveregs = tcb->xcp.regs;
-      up_set_interrupt_context(true);
-      tcb->xcp.regs = regs;
-
-      /* Acknowledge the interrupt */
-
-      arm_ack_irq(irq);
-
       /* Deliver the IRQ */
 
-      irq_dispatch(irq, regs);
-
-      /* Restore the previous value of saveregs. */
-
-      up_set_interrupt_context(savestate);
-      tcb->xcp.regs = saveregs;
+      regs = arm_doirq(irq, regs);
     }
-
-  return NULL;  /* Return not used in this architecture */
 #endif
-}
-
-#ifdef CONFIG_VECTORED_INTERRUPTS
-uint32_t *arm_decodeirq(uint32_t *regs)
-{
-  vic_vector_t vector = (vic_vector_t) vic_getreg(VIC_ADDRESS_OFFSET);
-
-  /* Acknowledge the interrupt */
-
-  arm_ack_irq(irq);
 
-  /* Valid Interrupt */
-
-  if (vector != NULL)
-    {
-      (vector)(regs);
-    }
-
-  return NULL;  /* Return not used in this architecture */
+  return regs;
 }
-#endif
diff --git a/arch/arm/src/lpc2378/lpc23xx_irq.c 
b/arch/arm/src/lpc2378/lpc23xx_irq.c
index 9b05374a4b4..1febde9c636 100644
--- a/arch/arm/src/lpc2378/lpc23xx_irq.c
+++ b/arch/arm/src/lpc2378/lpc23xx_irq.c
@@ -193,9 +193,7 @@ void arm_ack_irq(int irq)
   /* Clear interrupt */
 
   vic_putreg((1 << irq), VIC_SOFTINTCLEAR_OFFSET);
-#ifdef CONFIG_VECTORED_INTERRUPTS
   vic_putreg(0, VIC_ADDRESS_OFFSET);    /* dummy write to clear VICADDRESS */
-#endif
 }
 
 /****************************************************************************
@@ -230,7 +228,6 @@ int up_prioritize_irq(int irq, int priority)
  *
  ****************************************************************************/
 
-#ifndef CONFIG_VECTORED_INTERRUPTS
 void up_attach_vector(int irq, int vector, vic_vector_t handler)
 {
   /* Verify that the IRQ number and vector number are within range */
@@ -255,7 +252,6 @@ void up_attach_vector(int irq, int vector, vic_vector_t 
handler)
       leave_critical_section(flags);
     }
 }
-#endif
 
 /****************************************************************************
  * Name: up_detach_vector
@@ -265,7 +261,6 @@ void up_attach_vector(int irq, int vector, vic_vector_t 
handler)
  *
  ****************************************************************************/
 
-#ifdef CONFIG_VECTORED_INTERRUPTS
 void up_detach_vector(int vector)
 {
   /* Verify that the vector number is within range */
@@ -278,4 +273,3 @@ void up_detach_vector(int vector)
       vic_putreg(0, (VIC_VECTADDR0_OFFSET + offset));
     }
 }
-#endif
diff --git a/arch/arm/src/lpc2378/lpc23xx_timerisr.c 
b/arch/arm/src/lpc2378/lpc23xx_timerisr.c
index 46f04cfd9e6..23d3d0b6573 100644
--- a/arch/arm/src/lpc2378/lpc23xx_timerisr.c
+++ b/arch/arm/src/lpc2378/lpc23xx_timerisr.c
@@ -91,11 +91,7 @@
  *
  ****************************************************************************/
 
-#ifdef CONFIG_VECTORED_INTERRUPTS
-static int lpc23xx_timerisr(uint32_t * regs)
-#else
 static int lpc23xx_timerisr(int irq, uint32_t * regs, void *arg)
-#endif
 {
   static uint32_t tick;
 
@@ -109,11 +105,9 @@ static int lpc23xx_timerisr(int irq, uint32_t * regs, void 
*arg)
 
   /* Reset the VIC as well */
 
-#ifdef CONFIG_VECTORED_INTERRUPTS
   /* write any value to VICAddress to acknowledge the interrupt */
 
   vic_putreg(0, VIC_ADDRESS_OFFSET);
-#endif
 
   if (tick++ > 100)
     {
@@ -186,11 +180,7 @@ void up_timer_initialize(void)
 
   /* Attach the timer interrupt vector */
 
-#ifdef CONFIG_VECTORED_INTERRUPTS
-  up_attach_vector(IRQ_SYSTIMER, ???, (vic_vector_t) lpc23xx_timerisr);
-#else
   irq_attach(IRQ_SYSTIMER, (xcpt_t)lpc23xx_timerisr, NULL);
-#endif
 
   /* And enable the system timer interrupt */
 

Reply via email to