The rust language logo being branded onto a microcontroller housing

Will 2020 Be The Year Of Rust In The Linux Kernel?

One problem with modern programming languages is the reach their overly enthusiastic early adopters have nowadays thanks to the internet. As a result, everyone else’s first encounter with them are oftentimes some crude, fanboyish endeavors to rewrite every single established software project in that shiny new language — just because — which may leave an off-putting taste behind. However, Rust certainly seems to have outgrown this state by now, and with its rising popularity within the general developer population, it’s safe to say it will stick around. Will it fully replace C one day? Probably not, but there’s a big chance for coexistence, and [Nick Desaulniers] got the ball rolling for that within the Linux kernel.

Now, before you storm off pledging your allegiance to C by finding a new operating system: nothing is happening yet. [Nick] simply tested the waters for a possible future of Rust within the Linux kernel code base, which is something he’s planning to bring up for discussion in this year’s Linux Plumbers Conference — the annual kernel developer gathering. The interesting part is [Linus Torvalds]’s respone on the LKML thread, which leaves everyone hoping for a hearty signature Rust rant akin to his C++ one disappointed. Instead, his main concern is that a soft and optional introduction of the support in the build system would leave possible bugs hidden, and therefore should be automatically enabled if a Rust compiler is present — essentially implying that he seems otherwise on board.

We’ll see what comes of it, but with Rust language team lead [Josh Triplett] stating that enhancements benefiting and advancing a kernel integration are certainly imaginable for Rust itself, we might see interesting collaborations coming up in the near future. If you don’t want to wait for that and use Rust already today in a user-land driver, check out this 35c3 talk. And if that doesn’t go far enough for you, here’s a whole (non-Linux) kernel written in Rust.

Debugging For Sed — No Kidding

If you do much Linux shell scripting, you’ve probably encountered sed — the stream editor — in an example. Maybe you’ve even used it yourself. If all you want to do is substitute text, it is easy and efficient. But if you try to do really elaborate editing, it is often difficult to get things right. The syntax is cryptic and the documentation is lacking. But thanks to [SoptikHa2] you can now debug sed scripts with a text-based GUI debugger. Seriously.

According to the author, the program has several notable features:

  • Preview variable values, both of them!
  • See how will a substitute command affect pattern space before it runs
  • Step through sed script – both forward and backward!
  • Place breakpoints and examine program state
  • Hot reload and see what changes as you edit source code
  • Its name is a palindrome

There’s only one word for that last feature: wow.

Continue reading “Debugging For Sed — No Kidding”

Program Guesses Your Regular Expression

We aren’t sure how we feel about [pemistahl’s] grex program. On the one hand, we applaud a program that can take some input samples and produce a regular expression. On the other hand, it might be just as hard to gather example data that produces the correct regular expression. Still, it is an interesting piece of code.

Even the author suggests not to use this as an excuse to not learn regular expressions, since you’ll need to check the program’s output. It is certain that the results will match your test cases, but it isn’t certain that it won’t accept things you didn’t expect. Bad regular expressions have been the source of some deeply buried bugs.

Continue reading “Program Guesses Your Regular Expression”

Audio Processing In Rust

[Michael] volunteers with emergency services, and sometimes has to monitor radio traffic. Sometimes there’s a lot to review, and to make it easier he wrote a noise gate — think of it as a squelch — to break apart recorded audio into parts. Rust has been gaining popularity for writing low level software, and that’s the language he uses. However, you’ll see even if you don’t know Rust, it is pretty easy to figure out.

For test data, [Michael] took some publicly-available recordings of air traffic control. Using some ready-made audio processing functions and a simple state machine makes the code easy to write.

Continue reading “Audio Processing In Rust”

A DIY Retrocomputer Programmed In Pure Rust

Can you generate VGA and handle a PS/2 keyboard with a Cortex-M4 in Rust? That’s precisely what [theJPster] wanted to find out with Monotron, a 1980s style home computer programmed in pure Rust.

In order to run embedded Rust without a working operating system, some tools are necessary: an LLVM back-end for generating machine code, a target file for specifying memory sizes and other configs, and a pre-compiled libcore as a substitute for a compiler when running an operating system. Rust takes the place of C running on top of the board support package (BSP) and hardware abstraction layer (HAL), and peripheral access crates (PACs) that specify the hardware and allow the code to be portable across different chips.

The implementation generates a 800 x 600 VGA video signal at 60 Hz, displays text on a 48 character by 36 line display, displays color graphics using color lookup (stored in flash memory), and runs applications that take less than 24 KiB for all data. Monotron also generates 8-bit audio with PWM and sports a synthesizer that uses a three-channel wavetable allowing it to make sounds with square waves, sine waves, sawtooth waves, and create white noise.

So far, the Monotron has been able to work with an Atari joystick, a PS/2 keyboard, and has outputs to VGA, MIDI, SD card, and audio. Next up for the Monotron: writing a programming language (tentatively named Monotronian), adding support for Sega Megadrive pads, displaying sprites, and many more exciting developments.

Continue reading “A DIY Retrocomputer Programmed In Pure Rust”

Extreme Refurbishing: Amiga Edition

The last Amiga personal computer rolled off the assembly line in 1996, well over 20 years ago. Of course, they had their real heyday in the late 80s, so obviously if you have any around now they’ll be in need of a little bit of attention. [Drygol] recently received what looks like a pallet of old Amiga parts and set about building this special one: The Vampiric Amiga A500.

The foundation of this project was a plain A500 with quite a bit of damage. Corrosion and rust abounded inside the case, as well as at least one animal. To start the refurbishment, the first step was to remove the rust from the case and shields by an electrochemical method. From there, he turned his attention to the motherboard and removed all of the chips and started cleaning. Some of the connectors had to be desoldered and bathed in phosphoric acid to remove rust and corrosion, and once everything was put back together it looks almost brand new.

Of course, some other repairs had to be made to the keyboard and [Drygol] put a unique paint job on the exterior of this build (and gave it a name to match), but it’s a perfect working Amiga with original hardware, ready to go for any retrocomputing enthusiast. He’s no stranger around here, either; he did another extreme restoration of an Atari 800 XL about a year ago.

The Monotron, A Rusty Retrocomputer

For many people, a retrocomputer is a classic machine from the past lovingly brought back to working order. But for some, the idea of a retrocomputer is wider than that, encompassing modern hardware that delivers to feel like a device from the past.

The Monotron from [Jonathan Pallant] is one such computer. It’s definitely a retrocomputer such as you might have found in the 1980s, but it’s running on a much more modern Tiva-C TI Launchpad dev board sporting an ARM Cortex M4.

The platform has been created entirely in Rust, and emulates what would have been a rather desirable machine in the early 1980s. With an 800×600 pixel 8-colour VGA display interface, 32k of RAM, and mono 8-bit audio, it already has a few simple demos and games running upon it. [Jonathan Pallant] has given more than one talk on its design and capabilities, we’ve placed one of them as a video below the break. There is even a PCB available which adds all the ports as well as a micro SD card slot for program storage.

We like the Monotron, and we look forward to seeing it develop. It’s an exciting time for retrocomputig with projects such as the RC2014 Z80 machine and the Gigatron TTL RISC processor, but is there space for an emulated one such as this? We hope so.

Continue reading “The Monotron, A Rusty Retrocomputer”