This is part of a series on the blog where we explore RISC-V by breaking down real programs and explaining how they work. You can view all posts in this series on the RISC-V Bytes page.
Today we are going to take a brief detour from our previous posts in this series and look at Rust Cross-Compilation for RISC-V. This will be a shorter post focused on providing useful information about how
rustc works, as well as offering exact steps and configuration to target RISC-V when compiling your Rust programs. There are a number of existing references for building Rust programs for RISC-V, but I have found that many of them are targeting a bare metal (i.e.
no_std) use case, such as running embedded code on a microcontroller, or they don’t provide much background context on why various configuration is being used and how required tooling is being managed. I’ll attempt to be more comprehensive here, and will also do my best to post any updates as the ecosystem continues to evolve. Let’s get started!