Skip to content

Commit

Permalink
arch: riscv: add an option for empty spurious interrupt handler
Browse files Browse the repository at this point in the history
Add the possibility to disable fault handling in spurious
interrupt handler on RISCs and replacce it with an infinite loop.

Signed-off-by: Magdalena Pastula <magdalena.pastula@nordicsemi.no>
  • Loading branch information
magp-nordic authored and masz-nordic committed Jul 8, 2024
1 parent 243eb36 commit 7034cc4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
7 changes: 7 additions & 0 deletions arch/riscv/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,13 @@ config RISCV_RESERVED_IRQ_ISR_TABLES_OFFSET
properly sized to take into account this offset. This is a hidden
option which needs to be set per architecture and left alone.

config RISCV_EMPTY_IRQ_SPURIOUS
bool "Create empty spurious interrupt handler"
help
This option changes body of spurious interrupt handler. When enabled,
handler contains only an infinite while loop, when disabled, handler
contains the whole Zephyr fault handling procedure.

config NUM_IRQS
int

Expand Down
7 changes: 7 additions & 0 deletions arch/riscv/core/irq_manage.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ LOG_MODULE_DECLARE(os, CONFIG_KERNEL_LOG_LEVEL);

FUNC_NORETURN void z_irq_spurious(const void *unused)
{
#ifdef CONFIG_RISCV_EMPTY_IRQ_SPURIOUS
while (1) {
}

CODE_UNREACHABLE;
#else
unsigned long mcause;

ARG_UNUSED(unused);
Expand All @@ -37,6 +43,7 @@ FUNC_NORETURN void z_irq_spurious(const void *unused)
}
#endif
z_riscv_fatal_error(K_ERR_SPURIOUS_IRQ, NULL);
#endif
}

#ifdef CONFIG_DYNAMIC_INTERRUPTS
Expand Down

0 comments on commit 7034cc4

Please sign in to comment.