Five EmbedDev logo Five EmbedDev

An Embedded RISC-V Blog

Baremetal Startup Code in C++ for RISC-V

April 13, 2021 (toolchain,baremetal,C++)

An example of baremetal bootstrap code for RISC-V in C++.


November 18, 2020 (registers,code,baremetal,quickref)

For baremetal programming I’ll often need to access CSRs, e.g. mstatus.mie for critical sections, mcause in interrupts handlers, etc. Defining function wrappers for accessing these registers creates easier to understand code, however writing these wrappers is pretty tedious.