Skip to content

examples/rng90: add Microchip RNG90 example application#3529

Open
FelipeMdeO wants to merge 1 commit into
apache:masterfrom
FelipeMdeO:feature/rng90-driver
Open

examples/rng90: add Microchip RNG90 example application#3529
FelipeMdeO wants to merge 1 commit into
apache:masterfrom
FelipeMdeO:feature/rng90-driver

Conversation

@FelipeMdeO
Copy link
Copy Markdown
Contributor

@FelipeMdeO FelipeMdeO commented Jun 8, 2026

Summary

This PR adds a new RNG90 example application in apps.

Changes included:

  • New RNG90 example source: examples/rng90/rng90_main.c
  • Build integration files for Make and CMake:
    • examples/rng90/Makefile
    • examples/rng90/Make.defs
    • examples/rng90/CMakeLists.txt
  • Kconfig integration:
    • examples/rng90/Kconfig

The example opens the RNG90 character device, reads random bytes, and prints
hex output. It supports optional command-line arguments for device path and
requested byte count.

How to enable via Kconfig:

  • In nuttx (driver side), enable: Device Drivers -> Cryptographic Device Drivers -> RNG90 (CONFIG_DEV_RNG90=y)
  • In apps, enable: Application Configuration -> Examples -> Microchip RNG90 TRNG example (CONFIG_EXAMPLES_RNG90=y)
  • Optional app settings:
    • CONFIG_EXAMPLES_RNG90_PROGNAME
    • CONFIG_EXAMPLES_RNG90_DEVPATH
    • CONFIG_EXAMPLES_RNG90_PRIORITY
    • CONFIG_EXAMPLES_RNG90_STACKSIZE

Impact

  • Adds a new user-space example under apps/examples.
  • No changes to existing examples behavior.
  • Requires RNG90 driver support in nuttx (CONFIG_DEV_RNG90) to run.

Testing

Host:

  • macOS

Target:

  • esp32c3-devkit
  • RNG90 connected and enabled
  • Serial settings: 115200 8N1

Build/flash used for validation:

  • make -j4
  • make flash ESPTOOL_PORT=

Hardware validation transcript:

nsh> uname -a
NuttX 12.6.0-RC1 4423760152-dirty Jun  7 2026 23:00:02 risc-v esp32c3-devkit

nsh> ls /dev/rng0
 /dev/rng0

nsh> rng90
RNG90 example: device /dev/rng0
Read 32 random byte(s):
4f fc 96 27 91 99 95 32 90 b4 46 3c 3d a0 4c e9
ce 86 6d 41 7e a4 ab 02 4f 3a fe 34 ef c8 d0 15

nsh> rng90 /dev/rng0 16
RNG90 example: device /dev/rng0
Read 16 random byte(s):
82 6e 45 0b 1c f1 df d3 75 32 19 32 eb a5 e6 cc

nsh> rng90 /dev/rng0 64
Invalid count 64, clamping to 32
RNG90 example: device /dev/rng0
Read 32 random byte(s):
8d 8d fb 91 07 01 41 e7 54 e4 8b 77 9a 1d e9 2b
83 55 18 b9 79 0b 26 1c 52 07 56 77 f7 34 aa 77

Add a new RNG90 example application that opens the RNG90 character device, reads random bytes, and prints them in hexadecimal format.

The example supports optional command-line arguments for device path and byte count and integrates with Kconfig, Make, and CMake build flows.

Signed-off-by: Felipe Moura <moura.fmo@gmail.com>
Copy link
Copy Markdown
Contributor

@cederom cederom left a comment

Choose a reason for hiding this comment

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

Thank you @FelipeMdeO :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants