summary |
shortlog | log |
commit |
commitdiff |
tree
first ⋅ prev ⋅ next
Kit Rhett Aultman [Sun, 30 Jun 2024 16:38:01 +0000 (12:38 -0400)]
heap/linker/main: set up a heap allocator
This commit sets up a heap allocator. Again, I cannot sufficiently
stress the usefulness of Meyer Zinn for getting things this far, and
much of what I needed to know about getting linker symbols propagated
into Rust code comes from:
https://meyerzinn.tech/posts/2023/03/08/p1-printing-and-allocating/
Meyer steps through the process of setting up the linked list allocator.
However, there's a buddy list allocator that can be used as a drop-in
replacement, and since this is a more common allocator scheme, and since
doing my own thing means writing my own code and getting more familiar
with Rust, it seemed a divergence worth taking.
Kit Rhett Aultman [Sun, 30 Jun 2024 05:26:12 +0000 (01:26 -0400)]
README.md: created README
Basic statement of goals, current requirements to run, and some notes.
Kit Rhett Aultman [Sun, 30 Jun 2024 05:00:43 +0000 (01:00 -0400)]
main/console: console abstraction and print macros
This commit does a bit of a cleanup and re-org of the UART code so that
code doesn't need to create and carry around a reference to the UART to
print to the console. This is now available through print!() and
println!()
As with the prior commit, this was heavily informed by Meyer Zinn's
excellent blog posts on bare-metal Rust, specifically this one:
https://meyerzinn.tech/posts/2023/03/08/p1-printing-and-allocating/
The idea here is to basically create a singleton Console object and then
only access it behind the print!() and println!() macros. Since the
macros are designed to be used anywhere, they hide the interactions with
a global singleton which performs the debug outputs.
Even though I likely shouldn't have, I also did a rustfmt to clean up
syntax here. Ah, well.
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