Posts

Showing posts from 2016

Robot progress

Image
Well, best not let perfect be the enemy of good. While the Freescale board is clearly better, it doesn't actually work. So here is my new Dagu controller board being run from an Arduino. The speed sensor seems to work too - much less jitter than before.Also, top tip. Don't try to run your DCC railway with this board - it will catch fire. I don't think it like 10,000 direction changes a second.

Target practice

Now, as we know, the original Raspberry Pi uses an ARM11 core, which is based on the ARMv6 architecture. The Raspberry Pi 2 uses quad Cortex-A7 cores (although it's actually just been updated to have the same chip as the Pi 3 for volume reasons) which are based on the ARMv7-A architecture while the Pi 3 uses quad Cortex-A53s which are based on the ARMv8-A architecture.

So what do this have to do with Rust?

Well, in two ways really. One is that the compiler is downloaded as a binary, and it the instructions encoded into the machine code need to be ones that that processor core can understand and execute. Helpfully, the ARM architectures are backwards compatible, so the Pi 3 can run code compiled for an original Pi 2 and both can run code compiled for an original Pi.

The second is in the choice of instructions the compiler chooses to emit. Now, by default, you would expect this to be the same as the compiler itself was compiled to - after all, 9 times out of 10 you're going to r…

Bug in Rust 1.13 for ARM and how to work around it

There's a nasty code generation bug in Rust 1.13 stable. Because ARM isn't considered a 'tier-1' platform for Rust at this time, the team have decided to put the fix into 1.14 beta (and 1.15 nightly) but not up-issue 1.13. Unfortunately this means if you follow my last post, you'll get a compiler that doesn't work properly when using floating point functions.

The best fix is probably switch to 1.14 beta until 1.14 stable comes out (around 22 December). You can do this as follows:

pi@boron:~ $ rustup toolchain install beta info: syncing channel updates for 'beta-armv7-unknown-linux-gnueabihf' info: downloading component 'rustc' 47.0 MiB / 47.0 MiB (100 %) 6.2 MiB/s ETA: 0 s info: downloading component 'rust-std' 60.3 MiB / 60.3 MiB (100 %) 6.2 MiB/s ETA: 0 s info: downloading component 'cargo' 4.2 MiB / 4.2 MiB (100 %) 737.2 KiB/s ETA: 0 s info: installing component …

Raspberry Rust

I'm a big fan of Rust, the new systems programming language from Mozilla, and I'm a big fan of the Raspberry Pi, so I thought I'd write a few notes on running Rust on the Raspberry Pi!

Once upon a time installing Rust was a little but messy, but now there's rustup-rs - a Rust install tool written in Rust!

Step 1. Get a Raspberry Pi, boot it up, and get yourself a terminal window.

Step 2. Run this command:

curl https://sh.rustup.rs -sSf | sh
The installer will check out your architecture (armv7l for a Pi 2 or Pi 3, or armv6 for an original Pi) and download a pre-compiled copy of Rust, ready to run.

pi@boron:~ $ curl https://sh.rustup.rs -sSf | sh info: downloading installer Welcome to Rust! This will download and install the official compiler for the Rust programming language, and its package manager, Cargo. It will add the cargo, rustc, rustup and other commands to Cargo's bin directory, located at: /home/pi/.cargo/bin This path will then be added to your P…

Freescale Kinetis

Image
It appears some of Freescale's Kinetis line of ARM microcontrollers are available in 5V variants. Specifically, the KE02, the KE04 and the KE06.