rushabhvg opened a new pull request, #12762: URL: https://github.com/apache/nuttx/pull/12762
## Summary - This PR adds the LED Driver for QEMU RISC-V 32-bit and 64-bit (User LEDs and Auto LEDs) - QEMU RISC-V LED Driver will be used by the Rust Blinky App for Google Summer of Code - Blinking the LED is probably the most common Embedded Demo, and now it's supported by QEMU RISC-V - We added NuttX Configs `rv-virt:leds` and `rv-virt:leds64` to support User LEDs for 32-bit and 64-bit RISC-V - Turning on/off a Simulated User LED will print a log message: "LED 1 set to 1" - The code is derived from NuttX PinePhone LED Driver ### Modified Files in boards: - `Kconfig`: Added ARCH_HAVE_LEDS for QEMU RISC-V ### Modified Files in boards/risc-v/qemu-rv/rv-virt: - `include/board.h`: Added LED Definitions - `src/qemu_rv_appinit.c`: Init User LEDs at startup - `src/Makefile`: Added source files for User LEDs and Auto LEDs ### New Files in boards/risc-v/qemu-rv/rv-virt: - `src/qemu_rv_autoleds.c`: QEMU RISC-V driver for Auto LEDs - `src/qemu_rv_userleds.c`: QEMU RISC-V driver for User LEDs - `configs/leds/defconfig`: NuttX Config for 32-bit RISC-V with User LEDs (`rv-virt:leds`) - `configs/leds64/defconfig`: NuttX Config for 64-bit RISC-V with User LEDs (`rv-virt:leds64`) ### Updated Documentation: - `platforms/risc-v/qemu-rv/boards/rv-virt/index.rst`: Added `rv-virt:leds` and `rv-virt:leds64` ## Impact - With this PR, NuttX for QEMU RISC-V (32-bit and 64-bit) will be able to control the Simulated User LEDs (for `rv-virt:leds` and `rv-virt:leds64` only) - Auto LED Driver will be called by all QEMU RISC-V Boards at Startup, even when `CONFIG_USERLED` is disabled. We provided Empty Stub Functions for the Auto LED Driver, to minimise the impact on all QEMU RISC-V Boards. ## Testing We tested [Rust Blinky App](https://github.com/lupyuen2/wip-nuttx-apps/blob/gpio7/examples/hello_rust/hello_rust_main.rs) and the `leds` Example App on `rv-virt:leds` and `rv-virt:leds64`: - [rv-virt:leds Log](https://gist.github.com/lupyuen/e6e278d266cb828ac8ab4435844f8ee3#file-rv-virt-leds-log) - [rv-virt:leds64 Log](https://gist.github.com/lupyuen/a5830a48761540dcdf22f9aada9c0f01#file-rv-virt-leds64-log) ```text $ tools/configure.sh rv-virt:leds / leds64 ... nsh> uname -a NuttX 0.0.0 e0ad35542b0 Jul 24 2024 08:27:18 risc-v rv-virt nsh> hello_rust Hello, Rust!! Opening /dev/userleds Set LED 1 to 1 board_userled: LED 1 set to 1 board_userled: LED 2 set to 0 board_userled: LED 3 set to 0 Sleeping... Set LED 1 to 0 board_userled: LED 1 set to 0 board_userled: LED 2 set to 0 board_userled: LED 3 set to 0 nsh> leds board_userled: LED 1 set to 1 board_userled: LED 2 set to 0 board_userled: LED 3 set to 0 ... nsh> ostest ostest_main: Exiting with status 0 ``` ### Regression Testing For Regression Testing, we tested QEMU RISC-V Flat Build and Kernel Build, 32-bit and 64-bit: - [rv-virt:nsh Log](https://github.com/lupyuen/nuttx-riscv64/actions/runs/10068583958/job/27834196098) - [rv-virt:nsh64 Log](https://github.com/lupyuen/nuttx-riscv64/actions/runs/10068583963/job/27834196119) - [rv-virt:knsh32 Log](https://github.com/lupyuen/nuttx-riscv64/actions/runs/10068583960/job/27834196104) - [rv-virt:knsh64 Log](https://gist.github.com/lupyuen/8ea3a54dfcf04dc57a52eb59d167c8a9#file-special-qemu-riscv-knsh64-log) ```text $ tools/configure.sh rv-virt:nsh / nsh64 / knsh32 / knsh64 ... nsh> uname -a NuttX 0.0.0 e0ad35542b0 Jul 24 2024 08:27:18 risc-v rv-virt nsh> ostest ostest_main: Exiting with status 0 ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
