Kit Rhett Aultman [Mon, 24 Jun 2024 04:06:17 +0000 (00:06 -0400)]
Hello world for qemu serial
This commit establishes the overall project structure needed for doing a bare
metal executive on RISC-V. This currently supports the qemu risc64 emulator
because that is a target I can develop across multiple environments as I have
the free time.
This contains:
* Basic project structure
* rustc cross-compilation to riscv64-unknown-none-elf target
* Cargo integration for running qemu
* linking scripts for the qemu riscv64 virt "board" memory layout
* do-nothing panic handler
* _start function that contains the minimal RISC-V initialization: setting up
the global pointer (gp), reserving a stack, and clearing the bss region
* Very simple use of the uart_16550 crate to print a "Hello world" message
This all came together mostly in an afternoon's work and wouldn't have been
possible without these exceptional resources:
"Running Rust code on RISC-V in Qemu"
https://meyerzinn.tech/posts/2023/03/05/running-rust-code-on-risc-v-in-qemu/
"RISC-V from scratch 2: Hardware layouts, linker scripts, and C runtimes"
https://twilco.github.io/riscv-from-scratch/2019/04/27/riscv-from-scratch-2.html