RTEMS | RISC-V S-mode BSP can trigger spurious interrupts (#5522)
Matteo Concas (@matteo.concas)
gitlab at rtems.org
Fri Mar 13 12:40:53 UTC 2026
Matteo Concas created an issue: https://gitlab.rtems.org/rtems/rtos/rtems/-/issues/5522
## Summary
<!--
Please provide as much information as possible such as error messages or attaching logs
-->
In applications where `CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER` is not defined and the previous boot stage did not set `stimecmp` to its maximum value, RTEMS might exit with fatal source `RTEMS_FATAL_SOURCE_SPURIOUS_INTERRUPT`.
This is due to a supervisor timer interrupt happening while no interrupt entry had been installed for this vector (since the clock driver is not used).
Normally the supervisor timer interrupt should not be enabled in that case but in `bsps/riscv/riscv/irq/irq.c:674` it is enabled when the supervisor software interrupt should be enabled instead:
```c
rtems_status_code bsp_interrupt_vector_enable(rtems_vector_number vector)
{
...
_Assert(vector == RISCV_INTERRUPT_VECTOR_SOFTWARE);
#ifdef RISCV_USE_S_MODE
set_csr(sie, SIP_STIP);
#else
set_csr(mie, MIP_MSIP);
#endif
```
The same error is also present in `bsp_interrupt_vector_disable()`
<!-- Pre-set options
- milestone
-->
--
View it on GitLab: https://gitlab.rtems.org/rtems/rtos/rtems/-/issues/5522
You're receiving this email because of your account on gitlab.rtems.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/bugs/attachments/20260313/443e8678/attachment.htm>
More information about the bugs
mailing list