Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

risc-v/bl808: Implement Timer with OpenSBI #11472

Merged
merged 1 commit into from Jan 4, 2024

Conversation

lupyuen
Copy link
Member

@lupyuen lupyuen commented Jan 4, 2024

Summary

The implementation of the RISC-V Timer for BL808 SoC is incomplete. This PR implements the BL808 RISC-V Timer by calling OpenSBI. The code is derived from NuttX for RISC-V QEMU.

The implementation of up_timer_initialize with OpenSBI is explained in this article.

Impact

With this PR, sleep and other Timer Functions will work correctly on BL808 SoC, instead of hanging indefinitely.

No impact on other SoCs.

Testing

We tested with ostest on Ox64 BL808 SBC:

$ tools/configure.sh ox64:nsh

Before PR

ostest hangs when accessing the RISC-V Timer:

nsh> ostest
...
ostest_main: Started user_main at PID=7
(Hang)

(NuttX Log)

After PR

ostest works correctly with the RISC-V Timer and terminates properly:

nsh> ostest
...
user_main: Exiting
ostest_main: Exiting with status -1
nsh> 

(NuttX Log)

arch/risc-v/src/bl808/bl808_timerisr.c Outdated Show resolved Hide resolved
arch/risc-v/src/bl808/bl808_timerisr.c Outdated Show resolved Hide resolved
The implementation of the RISC-V Timer for BL808 SoC is incomplete. This PR implements the BL808 RISC-V Timer by calling OpenSBI. The code is derived from NuttX for RISC-V QEMU.

The implementation of `up_timer_initialize` with OpenSBI is explained in this article: https://lupyuen.github.io/articles/nim#appendix-opensbi-timer-for-nuttx
Copy link
Contributor

@pkarashchenko pkarashchenko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@pkarashchenko pkarashchenko merged commit 31ef9cd into apache:master Jan 4, 2024
26 checks passed
@jerpelea jerpelea added this to To-Add in Release Notes - 12.5.0 Mar 26, 2024
@jerpelea jerpelea moved this from To-Add to Added in Release Notes - 12.5.0 Mar 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

None yet

3 participants