Bare Metal Programming on a RISC-V SBC sounds difficult. Thankfully we can get help from the OpenSBI Supervisor Binary Interface! (A little like BIOS, but for RISC-V)
In this article, we boot Apache NuttX RTOS on a JH7110 RISC-V SBC (VisionFive2 / Star64) to experiment with OpenSBI:
(1) Print to the Serial Console
(2) Set a System Timer
(3) Query the RISC-V CPUs
(4) Fetch the System Information
(5) And Shutdown / Reboot our SBC
Check out the article:
JH7110 RISC-V SBC: Experiments with OpenSBI (Supervisor Binary Interface)
Lup