An embedded micro RustOS for baremetal
Set up your minimal bare-metal Rust development environment for an ARM Cortex-M core using QEMU and no_std
.
sudo apt-get install binutils-arm-none-eabi gdb-multiarch
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
Follow options for default install. Then reload your shell or run:
source $HOME/.cargo/env
Verify installation:
rustc --version
cargo --version
rustup intsall nightly
rustup default nightly
rustup component add rust-src
rustup component add rust-std
rustup target add thumbv7em-none-eabihf
This target supports Cortex-M4 with hardware floating point.
sudo apt update
sudo apt install qemu-system-arm
Verify installation:
qemu-system-arm --version
You're now ready to move on to building your Rust kernel and running it in QEMU!
Switch into the rustos
directory
cd rustos
Run the rust build command:
cargo build --release # Debug build not working yet
Once you've built µRustOS, you can run it on QEMU with GDB debugging server:
qemu-system-arm \
-machine lm3s6965evb \
-kernel target/thumbv7em-none-eabihf/release/rustos \
-S -gdb tcp::1234
You can then connect the debugger with target extended-remote
to see hello-world
gdb-multiarch target/thumbv7em-none-eabihf/release/rustos -ex "target extended-remote :1234"
To see where the "Hello World!" message was printed:
c
x/s 0x20000000
> Hello World!
Resources used: