All Projects β†’ rust-embedded β†’ Rust Raspberrypi Os Tutorials

rust-embedded / Rust Raspberrypi Os Tutorials

Licence: other
πŸ“š Learn to write an embedded OS in Rust πŸ¦€

Programming Languages

rust
11053 projects
Makefile
30231 projects
ruby
36898 projects - #4 most used programming language
assembly
5116 projects

Projects that are alternatives of or similar to Rust Raspberrypi Os Tutorials

Debian Pi Aarch64
This is the first 64-bit system in the world to support all Raspberry Pi 64-bit hardware!!! (Include: PI400,4B,3B+,3B,3A+,Zero2W)
Stars: ✭ 2,505 (-65.57%)
Mutual labels:  arm64, raspberry-pi, aarch64, raspberry, raspberry-pi-3, armv8, raspberry-pi-4
Raspberry Pi Os
Learning operating system development using Linux kernel and Raspberry Pi
Stars: ✭ 11,000 (+51.2%)
Mutual labels:  raspberry-pi, raspberry-pi-3, armv8, tutorial, kernel, operating-system
Ubuntu64 Rpi
ι€‚η”¨δΊŽζ ‘θŽ“ζ΄Ύ3b/3b+ηš„64位系统.
Stars: ✭ 652 (-91.04%)
Mutual labels:  arm64, raspberry-pi, aarch64, raspberry-pi-3, armv8, os
GENADEV OS
An AArch64 hobbyist OS for the Raspberry Pi 3 B+
Stars: ✭ 14 (-99.81%)
Mutual labels:  kernel, os, operating-system, aarch64
XNU
Research into porting the XNU kernel to ARM devices.
Stars: ✭ 76 (-98.96%)
Mutual labels:  kernel, arm64, aarch64, raspberry-pi-3
Raspberrypipkg
DEPRECATED - DO NOT USE | Go here instead ->
Stars: ✭ 758 (-89.58%)
Mutual labels:  arm64, aarch64, raspberry-pi-3, armv8
Synestiaos
The Synestia Operating System
Stars: ✭ 159 (-97.81%)
Mutual labels:  arm64, armv8, kernel, operating-system
warpi
"GUI" script running on a Raspberry Pi 4
Stars: ✭ 29 (-99.6%)
Mutual labels:  raspberry, raspberry-pi-3, rpi4, raspberry-pi-4
Rcore Tutorial
Tutorial for rCore OS step by step (3rd edition)
Stars: ✭ 272 (-96.26%)
Mutual labels:  tutorial, kernel, os
YoloV3-ncnn-Raspberry-Pi-4
MobileNetV2_YOLOV3 for ncnn framework
Stars: ✭ 20 (-99.73%)
Mutual labels:  raspberry, raspberry-pi-3, raspberry-pi-4
Raspberry Pi Cross Compilers
Latest GCC Cross Compiler & Native (ARM & ARM64) CI generated precompiled standalone toolchains for all Raspberry Pis. πŸ‡
Stars: ✭ 261 (-96.41%)
Mutual labels:  arm64, raspberry-pi, aarch64
novusk
A kernel written in Rust
Stars: ✭ 61 (-99.16%)
Mutual labels:  kernel, os, aarch64
RocketOS
RocketOS is a Unix based OS that uses legacy BIOS and GRUB and is written in C17. It is being developed for educational purposes primarily, but it still is a serious project. It is currently in its infancy.
Stars: ✭ 23 (-99.68%)
Mutual labels:  kernel, os, operating-system
nightingale
A small operating system where I experiment and learn osdev.
Stars: ✭ 86 (-98.82%)
Mutual labels:  kernel, os, operating-system
TensorFlow-Raspberry-Pi 64-bit
TensorFlow installation wheels for Raspberry Pi 64 OS
Stars: ✭ 27 (-99.63%)
Mutual labels:  aarch64, armv8, raspberry-pi-4
KnutOS
An x86_64 hobbyist OS written in C and Assembly
Stars: ✭ 16 (-99.78%)
Mutual labels:  kernel, os, operating-system
MandelbrotOS
A community driven OS by the youth
Stars: ✭ 172 (-97.64%)
Mutual labels:  kernel, os, operating-system
Harmonyos
A curated list of awesome things related to HarmonyOS. εŽδΈΊιΈΏθ’™ζ“δ½œη³»η»Ÿγ€‚
Stars: ✭ 18,385 (+152.71%)
Mutual labels:  kernel, operating-system, os
LudOS
A toy monolithic kernel written in C++
Stars: ✭ 38 (-99.48%)
Mutual labels:  kernel, os, operating-system
oneiric
A small kernel + OS based on how dreams work
Stars: ✭ 11 (-99.85%)
Mutual labels:  kernel, os, operating-system

Operating System development tutorials in Rust on the Raspberry Pi


ℹ️ Introduction

This is a tutorial series for hobby OS developers who are new to ARM's 64 bit ARMv8-A architecture. The tutorials will give a guided, step-by-step tour of how to write a monolithic Operating System kernel for an embedded system from scratch. They cover implementation of common Operating Systems tasks, like writing to the serial console, setting up virtual memory and handling HW exceptions. All while leveraging Rust's unique features to provide for safety and speed.

Have fun!

Best regards,
Andre (@andre-richter)

P.S.: Chinese πŸ‡¨πŸ‡³ versions of the tutorials were started by @colachg and @readlnh. You can find them as README.CN.md in the respective folders. They are a bit out-of-date at the moment though.

πŸ“‘ Organization

  • Each tutorial contains a stand-alone, bootable kernel binary.
  • Each new tutorial extends the previous one.
  • Each tutorial README will have a short tl;dr section giving a brief overview of the additions, and show the source code diff to the previous tutorial, so that you can conveniently inspect the changes/additions.
    • Some tutorials have a full-fledged, detailed text in addition to the tl;dr section. The long-term plan is that all tutorials get a full text, but for now this is exclusive to tutorials where I think that tl;dr and diff are not enough to get the idea.
  • The code written in these tutorials supports and runs on the Raspberry Pi 3 and the Raspberry Pi 4.
    • Tutorials 1 till 5 are groundwork code which only makes sense to run in QEMU.
    • Starting with tutorial 5, you can load and run the kernel on the real Raspberrys and observe output over UART.
  • Although the Raspberry Pi 3 and 4 are the main target boards, the code is written in a modular fashion which allows for easy porting to other CPU architectures and/or boards.
    • I would really love if someone takes a shot at a RISC-V implementation!
  • For editing, I recommend Visual Studio Code with Rust Analyzer.
  • In addition to the tutorial text, also check out the make doc command in each tutorial. It lets you browse the extensively documented code in a convenient way.

Output of make doc

make doc

πŸ›  System Requirements

The tutorials are primarily targeted at Linux-based distributions. Most stuff will also work on macOS, but this is only experimental.

πŸš€ The tl;dr Version

  1. Install Docker Desktop.

  2. (Linux only) Ensure your user account is in the docker group.

  3. Prepare the Rust toolchain. Most of it will be handled on first use through the rust-toolchain file. What's left for us to do is:

    1. If you already have a version of Rust installed:

      cargo install cargo-binutils rustfilt
    2. If you need to install Rust from scratch:

      curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
      
      source $HOME/.cargo/env
      cargo install cargo-binutils rustfilt
  4. In case you use Visual Studio Code, I strongly recommend installing the Rust Analyzer extension.

  5. (macOS only) Install a few Ruby gems.

    Run this in the repository root folder:

    bundle install --path .vendor/bundle --without development

🧰 More Details: Eliminating Toolchain Hassle

This series tries to put a strong focus on user friendliness. Therefore, efforts were made to eliminate the biggest painpoint in embedded development as much as possible: Toolchain hassle.

Rust itself is already helping a lot in that regard, because it has built-in support for cross-compilation. All that we need for cross-compiling from an x86 host to the Raspberry Pi's AArch64 architecture will be automatically installed by rustup. However, besides the Rust compiler, we will use some more tools. Among others:

  • QEMU to emulate our kernel on the host system.
  • A self-made tool called Minipush to load a kernel onto the Raspberry Pi on-demand over UART.
  • OpenOCD and GDB for debugging on the target.

There is a lot that can go wrong while installing and/or compiling the correct version of each tool on your host machine. For example, your distribution might not provide the latest version that is needed. Or you are missing some hard-to-get dependencies for the compilation of one of these tools.

This is why we will make use of Docker whenever possible. We are providing an accompanying container that has all the needed tools or dependencies pre-installed, and it gets pulled in automagically once it is needed. If you want to know more about Docker and peek at the provided container, please refer to the repository's docker folder.

πŸ“Ÿ USB Serial Output

Since the kernel developed in the tutorials runs on the real hardware, it is highly recommended to get a USB serial cable to get the full experience.

  • You can find USB-to-serial cables that should work right away at [1] [2], but many others will work too. Ideally, your cable is based on the CP2102 chip.
  • You connect it to GND and GPIO pins 14/15 as shown below.
  • Tutorial 5 is the first where you can use it. Check it out for instructions on how to prepare the SD card to boot your self-made kernel from it.
  • Starting with tutorial 6, booting kernels on your Raspberry is getting really comfortable. In this tutorial, a so-called chainloader is developed, which will be the last file you need to manually copy on the SD card for a while. It will enable you to load the tutorial kernels during boot on demand over UART.

UART wiring diagram

πŸ™Œ Acknowledgements

The original version of the tutorials started out as a fork of Zoltan Baldaszti's awesome tutorials on bare metal programming on RPi3 in C. Thanks for giving me a head start!

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].