The rust language logo being branded onto a microcontroller housing

Programming With Rust

Do hardware hackers need a new programming language? Your first answer might be no, but hold off a bit until you hear about a new language called Rust before you decide for sure.

We all know real hackers use assembly language to program CPUs directly, right? Well, most of us don’t do as much assembly language as we used to do. Languages like C can generate tight, predictable code and are easier to manage.

Although some people use more abstract languages in some embedded systems, it is no secret that for real-time systems, device driver development, and other similar tasks, you want a language that doesn’t obscure underlying details or generate code that’s difficult to reason about (like, for example, garbage collection). It is possible to use special techniques (like the Real-Time Java Specification) to help languages, but in the general case a lean language is still what most programmers reach for when you have to program bare metal.

Even C++, which is very popular, obscures some details if you use things like virtual functions (a controversial subject) although it is workable. It is attractive to get the benefit of modern programming tools even if it does conceal some of the underlying code more than straight C.

About Rust

That’s where Rust comes in. I could describe what Rust attempts to achieve, but it is probably easier to just quote the first part of the Rust documentation:

Rust is a systems programming language focused on three goals: safety, speed, and concurrency. It maintains these goals without having a garbage collector, making it a useful language for a number of use cases other languages aren’t good at: embedding in other languages, programs with specific space and time requirements, and writing low-level code, like device drivers and operating systems. It improves on current languages targeting this space by having a number of compile-time safety checks that produce no runtime overhead, while eliminating all data races. Rust also aims to achieve ‘zero-cost abstractions’ even though some of these abstractions feel like those of a high-level language. Even then, Rust still allows precise control like a low-level language would.

Continue reading “Programming With Rust”

Rusty Old Table Saw Turned Into A Workstation Worthy Of A Master Craftsman

rusty-old-table-saw-turned-pro-workstation

Okay, first of all: holy crap! Even if you didn’t know this started as a rusty table saw, the workstation that came out of this project is just phenomenal. It really makes us wish we had looked around for a used model with a cast iron top instead of going for the cheap stamped metal one that was ready to use.

[Simon Leblanc] started with a Delta contractor’s saw that was rusty inside and out. The refurbishment began by removing the table and everything from the inside. The rods and gears were all cleaned up before he began to sand away the rust on the table itself. But obviously he didn’t stop with getting the saw to be functional again. He built a small set of cabinets to serve as the base for the saw. They went inside of this larger assembly that combines an MDF table top with an Accusquare rip fence to greatly increase the working surface of the tool.

Now he needs to start in on an extra fancy CNC jig for the thing.

[via Reddit]