Tutorial 01 - Wait Forever
tl;dr
- The project skeleton is set up.
- A small piece of assembly code runs that just halts all CPU cores executing the kernel code.
Building
Makefiletargets:doc: Generate documentation.qemu: Run thekernelin QEMUclippycleanreadelf: Inspect theELFoutput.objdump: Inspect the assembly.nm: Inspect the symbols.
Code to look at
BSP-specifickernel.ldlinker script.- Load address at
0x8_0000 - Only
.textsection.
- Load address at
main.rs: Important inner attributes:#![no_std],#![no_main]
boot.s: Assembly_start()function that executeswfe(Wait For Event), halting all cores that are executing_start().- We (have to) define a
#[panic_handler]function to make the compiler happy.- Make it
unimplemented!()because it will be stripped out since it is not used.
- Make it
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