Hello world for qemu serial
authorKit Rhett Aultman <kit@kitaultman.com>
Mon, 24 Jun 2024 04:06:17 +0000 (00:06 -0400)
committerKit Rhett Aultman <kit@kitaultman.com>
Mon, 24 Jun 2024 04:06:17 +0000 (00:06 -0400)
commit773fc4902041bbcffeed31459b45d58ba544b84a
treebe12de6c7156d1e1df1a8c9a06d05f4e9930a0f5
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
.cargo/config.toml [new file with mode: 0644]
.gitignore [new file with mode: 0644]
Cargo.lock [new file with mode: 0644]
Cargo.toml [new file with mode: 0644]
rust-toolchain.toml [new file with mode: 0644]
src/linker.ld [new file with mode: 0644]
src/main.rs [new file with mode: 0644]