Skip to content

jmailloux/embedded_workshop_2021

 
 

Repository files navigation

Tools and setup

See here.

Block A

First Block: Running on and integrating with desktop OSes.

File

  • Makefile
  • Comparison of failure scenarios of C and Rust
  • Platform agnositc APIs in C and Rust
  • Highlight of problems with glibc versions

syscall

  • Quick example showing basic usage of pointers
  • Quick-and-dirty example to show that rust is no magic sauce (but the compiler helps)
  • The same example again but with a bit more careful error handling in place.

C-Interoperability

Rust calls C

  • Showcase of how a rust application can use an external C dependency. This was already done under the hood by the syscall example.
  • We build the example with gcc

C calls Rust

  • Basic example of a C application making use of some Rust library
  • We use cbindgen to generate bindings to the Rust lib to expose a C API.

Bindgen + cc

  • Showcase of combining bindgen and cc to compile a C library and create bindigns to it for Rust.
  • These are two crates generated and generated_sys to mirror the separation found in most projects

Pi

We move to a different plattform, the RaspberryPi

blink

  • The typical Hello World example used to make an LED blink
  • We make use of a reaedy-made library rppal but encounter challenges with crosscompiling

blink_mem

  • How does the rppal library make the led blink?
  • We poke around the library to find out that we need to set some registers
  • We use /dev/mem to write our own code doing so
  • This is in preparation of a later example

Block B

Rust Java interop

  • Interoperability of Java and Rust
  • Small example of an integration between Java and Rust. This will be reused in the Android example

Rust C++ interop

  • Interoperability of C++ and Rust
  • Showcase demonstrating the use of the cxx crate.
  • Whilst this is more powerful than the plain C interoperability, we also see some of the limitations.

no_std

No_std hello world

  • After we learned where parts of the Rust ecosystem are located, we can make use of those present in the no_std world.
  • Printing Hello World with no_std but using the OS nonetheless ist ridiculous and surprisingly hard
  • We learn to get a feeling for no_std and its limitations but see some of Rusts beauty: The mighty features like the Ownership system can also be used in a no_std environment.
  • Since we ditched the standard library, our resulting executable is tiny

bare_blink

  • Remember the code from the blinkblink_mem making the LED blink by poking around the memory? We can do this without the OS with nearly the same code! Of course we need to provide a bit of glue around it, after all, we write a exceptionally simple OS-Kernel.

Block C & D

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Rust 88.4%
  • Makefile 4.9%
  • C++ 2.7%
  • C 1.8%
  • Assembly 1.2%
  • Java 0.7%
  • Other 0.3%