Installing Rust on C.H.I.P.
Step 1: Connect to C.H.I.P.
My C.H.I.P. is running the Headless v4.4 Debian image. I connected to it using a serial console over USB, as described in the documentation.
To do this, connect your C.H.I.P. to a computer (I’m using macOS in these examples) via a USB cable. Give C.H.I.P. a moment to boot up, then look for it’s
tty device on your computer:
$ ls /dev/tty.* /dev/tty.Bluetooth-Incoming-Port /dev/tty.usbmodem1423
Here we can see the
/dev/tty.usbmodem1423 device has appeared.
Connect to C.H.I.P. using
screen. You will be prompted for a username and password. Login as the
chip user (the password is also
chip by default — you should change this):
$ screen /dev/tty.usbmodem1423 115200 Debian GNU/Linux 8 chip ttyGS0 chip login: chip Password: Last login: Mon Jul 18 05:32:52 UTC 2016 on ttyGS0 Linux chip 4.4.11-ntc #1 SMP Sat May 28 00:27:07 UTC 2016 armv7l The programs included with the Debian GNU/Linux system are free software; the exact distribution terms for each program are described in the individual files in /usr/share/doc/*/copyright. Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law. chip@chip:~$
Step 2: Get Online
To download packages and installation files your C.H.I.P. will need to be connected to the internet. If you haven’t already done so, set up a WiFi connection using the instructions on the C.H.I.P. website.
Note: You’ll need to prefix the
nmcli commands with
Step 3: Install Prerequisites
To compile Rust programs you will need a linker installed. I installed clang to satisfy this dependency. It’s also likely you’ll want clone git repos, so let’s install git too:
sudo apt install clang git-core
Step 4: Install Rust
To install Rust, we’ll use [rustup]. rustup makes it easy to manage multiple versions of Rust and keep them up to date. The usual caveats about piping curl into a shell aside, follow the instructions on the rustup website:
curl https://sh.rustup.rs -sSf | sh
After the installer has finished, source the env file as it suggests. Then test out your handiwork:
$ source ~/.cargo/env $ rustc --version rustc 1.10.0 (cfcb716cf 2016-07-03)
Optional Hello World Example:
$ cargo new --bin hello $ cd hello $ cargo run Compiling hello v0.1.0 (file:///home/chip/hello) Running `target/debug/hello` Hello, world!
You’re now ready to build Rust programs on your C.H.I.P!