You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Andre Richter b30bc518c4
Switch to GCC objdump and nm
The GCC versions of `objdump` and `nm` seem to have better out-of-the-box
support (for AArch64). Demangling works better, and instructions in objdump are
presented as 4 bytes instead of 4 * 1 bytes, which helps a lot.

Hence, switch to the GCC versions for now until LLVM has caught up.
4 years ago
..
.vscode Run of prettier over whole repo 4 years ago
src Switch to new Rust inline asm! syntax 4 years ago
Cargo.lock Add code for tutorial 01 5 years ago
Cargo.toml Make cortex-a platform specific dep 4 years ago
Makefile Switch to GCC objdump and nm 4 years ago
README.CN.md Remove xbuild. Use upstream aarch64 rust-std 🎉 🦀 4 years ago
README.md Streamline READMEs 4 years ago
build.rs Let cargo track changed files 4 years ago

README.md

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

  • Makefile targets:
    • doc: Generate documentation.
    • qemu: Run the kernel in QEMU
    • clippy
    • clean
    • readelf: Inspect the ELF output.
    • objdump: Inspect the assembly.
    • nm: Inspect the symbols.

Code to look at

  • Custom link.ld linker script.
    • Load address at 0x8_0000
    • Only .text section.
  • main.rs: Important inner attributes:
    • #![no_std], #![no_main]
  • cpu.S: Assembly _start() function that executes wfe (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