Blinking of an Arduino LED, in Julia
The Julia programming language is a horrible fit for a no-frills microcontroller like the ATMega328p found in the classic Arduino, but it didn’t stop [Sukera] to try and succeed.
All the features that make Julia a cool programming language for your big computer makes it a terrible choice for the Arduino. It is designed for interactivity, is dynamically typed, and relies heavily on its garbage collector; each of these features alone would tax the Mega to breaking point. But in its favor it is a compiled language based on LLVM, and LLVM has an AVR backend for C. It should only be to remove some of the overhead, recompile LLVM to add target AVR for Julia, and then fix all the other details, right?
Well, it turns out it almost was. Leaning heavily on the flexibility of LLVM, [Sukera] manages to disable all unnecessary language features, and after a few small hurdles like the usual issues with volatile and atomic variables, manages to slowly blink an LED. Huzah. We like [Sukera’s] ironic “Now that’s what I call two days well spent!” once that’s all done, but seriously, this is the first time we’ve seen even super rudimentary Julia code running on an 8-bit microcontroller, so there’s definitely some kudos to be had here.
By the time Julia is stuck in the AVR, a lot of what makes it appealing on big computers is missing on the mic, so we don’t really see people picking it over the straight C, which has a much more ecosystem developed. But still, it’s great to see what it takes to get a language designed around a runtime and garbage collector working on our favorite mini mic.
Thanks [Joel] for the tip!