mirror of
https://github.com/rust-embedded/rust-raspberrypi-OS-tutorials.git
synced 2024-11-11 07:10:59 +00:00
bb78c779ca
Gets rid of compiled C++, uses Ruby 💎
1.4 KiB
1.4 KiB
Tutorial 01 - Wait Forever
tl;dr
Project skeleton is set up; Code just halts all CPU cores executing the kernel code.
- Toolchain:
cargo xbuild
tools (xrustc
,xclippy
) and theaarch64-unknown-none-softfloat
target are used for buildingAArch64
bare-metal code. Makefile
targets:doc
: Generate documentation.qemu
: Run thekernel
in QEMUclippy
clean
readelf
: Inspect theELF
output.objdump
: Inspect the assembly.nm
: Inspect the symbols.
- Code is organized into
kernel
,arch
andBSP
(Board Support Package) parts.- Conditional compilation includes respective
arch
andBSP
according to user-supplied arguments.
- Conditional compilation includes respective
- Custom
link.ld
linker script.- Load address at
0x80_000
- Only
.text
section.
- Load address at
main.rs
: Important inner attributes:#![no_std]
,#![no_main]
- Assembly
_start()
function that executeswfe
(Wait For Event), halting all cores that are executing_start()
. - We (have to) define a
#[panic_handler]
function.- Just waits infinitely for a cpu event.
Test it
In the project folder, invoke QEMU and observe the CPU core spinning on wfe
:
» make qemu
[...]
IN:
0x00080000: d503205f wfe
0x00080004: 17ffffff b #0x80000