rushabhvg opened a new pull request, #2437: URL: https://github.com/apache/nuttx-apps/pull/2437
## Summary - The existing Rust Demo App `hello_rust` only prints a message, it might be simplistic for a NuttX App. This PR extends `hello_rust` to call NuttX POSIX APIs like `open()` and `ioctl()`, so that it blinks an LED. - If the LED Driver is not available, the app terminates gracefully. - The updated `hello_rust` app is also used for testing the GPIO and LED Drivers for Ox64 BL808 SBC in Google Summer of Code. - The code is based on `examples/leds` in C. ## Modified file examples/hello_rust: - `hello_rust_main.rs`: Call LED and GPIO drivers to turn the LED on and off ## Impact - With this PR, NuttX for Ox64 will be able to test and verify the operation of LED through GPIO pins. - No impact on existing code, since we are extending the functionality of a Rust Demo App. - [Build Instructions for QEMU RISC-V 32-bit](https://lupyuen.github.io/articles/rust4#build-the-rust-core-library) - [Build Instructions for QEMU RISC-V 64-bit](https://lupyuen.github.io/articles/rust5#appendix-build-nuttx-for-qemu) - [Build Instructions for Ox64](https://lupyuen.github.io/articles/rust5#appendix-build-nuttx-for-ox64-sbc) ## Testing We tested the updated `hello_rust` app on Ox64 Emulator. The app blinks the Simulated LED correctly: - [Build Instructions for Ox64](https://lupyuen.github.io/articles/rust5#appendix-build-nuttx-for-ox64-sbc) - [Ox64 Demo Video](https://drive.google.com/file/d/1GEJfIoIvFmWuE_TQJImONJBsgV9onVpw/view?usp=drive_link) - [Ox64 Test Log](https://gist.github.com/lupyuen/84d9bf8071980a52b558072505430435) - [Test Log for Ox64 Emulator](https://github.com/rushabhvg/rushabhvg.github.io/blob/master/nuttx/LED%20Blinky%20App/build_log%20b8c1ce45e6%20Jul%20%208%202024%2013_30_17.txt) ``` rushabhvg@rushabhvg-laptop:~/Desktop/nuttx$ ./temu nuttx.cfg TinyEMU Emulator for Ox64 BL808 RISC-V SBC NuttShell (NSH) nsh> nx_start: CPU0: Beginning Idle Loop nsh> uname -a nxposix_spawn_exec: ERROR: exec failed: 2 NuttX 0.0.0 b8c1ce45e6 Jul 8 2024 13:30:17 risc-v ox64 nsh> hello_rust nxtask_activate: hello_rust pid=4,TCB=0x5040b290 nxsig_tcbdispatch: TCB=0x5040b290 pid=4 signo=0 code=0 value=0 masked=NO Hello, Rust!! Opening /dev/userleds Set LED 1 to 1 {"nuttxemu":{"gpio29":1}} Sleeping... Set LED 1 to 0 {"nuttxemu":{"gpio29":0}} nxsig_tcbdispatch: TCB=0x5040af80 pid=3 signo=17 code=5 value=0 masked=NO nxtask_exit: hello_rust pid=4,TCB=0x5040b290 nxsig_tcbdispatch: TCB=0x5040af80 pid=3 signo=17 code=5 value=0 masked=NO ``` -- 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]
