RTEMS | bsps/riscv: Share the CLINT, PLIC and clock drivers (!1520)

Sebastian Huber (@sebhub) gitlab at rtems.org
Thu Oct 1 11:22:20 UTC 2026



Sebastian Huber created a merge request: https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/1520

Project:Branches: sebhub/rtems:up/riscv-shared-drivers to rtems/rtos/rtems:main
Author: Sebastian Huber

## Summary

Issue #5790: The CLINT, PLIC and clock drivers require a device tree

The first commit lets each BSP provide `<bsp/irqimpl.h>`. The header
defines the CLINT, the PLIC, the timebase frequency and the Sstc extension
as static inline functions. The riscv and noel BSPs implement it through
the device tree. `riscv_fdt_irq_initialize()` holds the device tree lookup
and runs in `bsp_start()`.

The lookups of the CLINT index and of the PLIC context return `bool`. A
BSP with constants returns `true`, and the compiler removes the branch.

The second commit moves `irq.c` and `clockdrv.c` to `bsps/riscv/shared/`.
The objects are byte-identical before and after the move.

## Test

The base is `main` at 32595811b30.

| Check | Result |
| --- | --- |
| Build of 11 RISC-V BSP variants | no warning |
| Test suites on Qemu: `rv64imafdc` uni, SMP, S-mode, S-mode SMP and `rv32imafdc` | the same results as `main` |
| CLINT and PLIC pointers of each processor, PLIC priority, enable and threshold registers after the start, read through GDB | identical to `main` in all five variants |

The failures which remain occur on `main` as well:
`ts-fatal-extension`, `ts-validation-intr` in S-mode,
`ts-validation-no-clock-0`, `ts-validation-smp-only-0` and
`ts-validation-smp-only-2`. `smpthreadlife01` hangs in two of three runs
on both trees.

## AI Details
<!-- Make sure you have read our statement at https://www.rtems.org/generative-ai/ -->

### Prompt used

None as a single prompt. The work was done in an interactive Claude Code
session on the RTEMS tree. The task was to share the CLINT, PLIC and clock
drivers of the RISC-V BSPs, as agreed in !1471. Each change was directed
and reviewed.

### AI model used

Claude Opus 5.5 (claude-opus-5-5), through Claude Code.

### How AI was used for the contribution

- ( ) Formatting
- ( ) Test creation.
- (x) Code comments.
- ( ) The entire contribution was generated using AI
- ( ) AI code completion such as Copilot in VSCode.

The implementation and the verification were produced in that session
under my direction, and the commit messages were drafted there.

### Access

I have not used a product which claims copyright in its output, and I have
legitimate access to the one I used.

-- 
View it on GitLab: https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/1520
You're receiving this email because of your account on gitlab.rtems.org. Unsubscribe from this thread: https://gitlab.rtems.org/-/namespace/49/sent_notifications/5-3p8lcb3gd0jx5x1giqahh0a1z-1d/unsubscribe | Manage all notifications: https://gitlab.rtems.org/-/profile/notifications | Help: https://gitlab.rtems.org/help


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/bugs/attachments/20261001/dd63cac6/attachment.htm>


More information about the bugs mailing list