RTEMS | bsps/i386/pc386: Add the CPU counter and fix the delay (!1453)

Sebastian Huber (@sebhub) gitlab at rtems.org
Mon Aug 24 01:50:48 UTC 2026



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

Project:Branches: sebhub/rtems:up/i386-counter to rtems/rtos/rtems:main
Author:   Sebastian Huber



## Summary

Issue #5728: The CPU counter counts calls and a delay loop hangs the boot

Two commits. The first reads the time stamp counter as the CPU counter and
measures its frequency against channel 2 of the 8254 in the CPU counter step of
the system initialization, so a system without a clock driver gets the counter
as well. A processor without a time stamp counter keeps the software counter.
It also drops the `expected-fail` state of `ts-validation-timecounter-1`, which
passes with a counter that measures time.

The second takes `Wait_X_ms()` from channel 2 of the 8254 and deletes the
calibration together with its call in `bsp_start()`. `Wait_X_ms(100)` measures
100.12ms on Qemu, with and without `-icount`.

A measurement on channel 0 does not work, which is why both commits use channel
2. The clock driver programs channel 0 again for the tick period afterwards and
the write takes effect, yet the tick then arrives every 55.5ms rather than every
1ms, which is 65536 counts of the 8254.

**BSP** `i386/pc586-sse` · **Simulator** Qemu

## 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 run the test suites of the
simulator BSPs, diagnose every failure and fix the cause.  Each change was
directed and reviewed.

### AI model used

Claude Opus 5 (claude-opus-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 diagnosis and the implementation 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/1453
You're receiving this email because of your account on gitlab.rtems.org. Unsubscribe from this thread: https://gitlab.rtems.org/-/sent_notifications/5-81l59icunlu2lwfmvb9nizz8t-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/20260824/890c22ca/attachment-0001.htm>


More information about the bugs mailing list