Cross Compile Rust Code for Raspberry Pi

Use Pi as a headless data logger

circuit4u
4 min readMar 24, 2023

1. Goal

A piece of Rust code was developed on the Windows PC. Its goal is to collect and collect and visualize real-time data from the external hardware (another embedded system, such as RP2040 MCU for example) in an experiment setup.

Data from the external hardware is sent over the USB connection (or USB/serial: FTDI 232H cable) to the PC. Now it’s time to deploy the hardware in the field for “long-term” continuous data collection.

In this case, PC (due to its cost and bulkiness) will be replaced with many instances of Raspberry Pi computers. So the Rust code needs to be cross compiled to run on Pi instead, while keeping the USB interfacing with the external hardware the same.

Here is a collection of notes on how to set up the Pi, and cross compile code on Windows to run on the Pi. Things are changing both in the realms of Pi software, as well as Rust toolset. This is the learning as of December, 2023.

2. Setup Headless Raspberry Pi

Since Pi is only used as a data logger to stream serial data into a local file for storage, we don’t need to attach monitor or keyboard to it.

--

--

circuit4u

memento of electronics and fun exploration for my future self