Join us at the new Whole Foods in Tempe this month for lightning talks / show and tell / crates you should know.
Recognizing "Hand-Drawn" Numbers on PyGamer via @DanielPBank
I'm working on making an example app for the PyGamer which allows the user to draw numbers and the app infers what number is drawn. I want to use a model that was trained on the MNIST dataset, load it in the app, and use it to run inference. I found a crate called tch, which is Rust bindings for the PyTorch C++ API. There is some example code in a GitHub Issue for saving / loading models. Now I just need to build it for an embedded system. Is it possible? I can add the
#![no_std] pragma and it still builds. When I add the
#![no_main] pragma, the build fails with an error:
error: linking with `cc` failed: exit code: 1 | ... = note: ld: entry point (_main) undefined. for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)
It may be possible to build this for an embedded system, but I need to inspect the source code thoroughly for things like usage of Vec or HashMap (or any kind of std::collections).
Jacob mentioned that he was working on a tensorflow-lite-sys, Rust bindings of the TensorFlow Lite for Microcontrollers. This would support embedded systems and may be an easier avenue to go.
Intro to Embedded via @craig_jbishop
Craig takes us through an Intro to Embedded Rust. Some highlights:
The various layers of the Rust embedded ecosystem: low-level cortex-m support, minimal cortex-m startup and runtime (cortex-m-rt), panic handlers, peripheral access crates (PACs), hardware access layers (HALs), peripheral and device drivers, board support crates, real time operating systems (RTOS), and finally application code.
The benefits of owning and using a debugger over using the bootloader mode.
Automating task running with a Makefile.toml and cargo-make
More Rust Embedded via @jacobrosenthal
Jacob expands upon Craig's talk with a few more points:
cortex-m-quickstart, a template for building apps for ARM Cortex-M microcontrollers
Using cargo-expand to expand the macro code of a Hello World Rust application (the app template resulting from running
cargo new foo). There is still a lot of underlying code that depends on std libraries, none of which will work in an embedded application.
A Crate You Should Know via @PhilGebhardt
How To Write Fast Rust Code via @likebike
Christopher shows off his extremely fast crate for evaluating algebraic expressions and explains some of the techniques he used to make it fast. He wrote a blog post about writing fast rust code and goes through the points, such as taking noise-free measurements, profiling with
perf, compiling with
RUSTFLAGS="--emit=asm", and reducing redundant computations.
Some Rust buzz related to Fuschia, Google's New OS: Rust is approved for use throughout the Fuchsia Platform Source Tree
Gremlin, Failure as a Service. This company is using Rust. Woot!