Pen-Plotter Firmware Written Completely in Ada

[Fabian Chouteau] built a plotter out of CD-ROM parts. Yawn, you say? Besides being a beautiful physical build, this one has a twist. He wrote the software and firmware for the entire project himself, in Ada.

Ada is currently number two on our list of oddball programming languages that should be useful for embedded programming. It’s vaguely Pascal-y, but with some modern object-oriented twists. It was developed for safety-critical, real-time embedded systems (by the US Department of Defense), and is used in things like airplanes, rockets, and the French TGV trains. If that sounds like overkill for your projects, [Fabian]’s project shows that it’s still very tractable.

In his GitHub, he re-implements the GRBL G-code generator and then writes a GUI front-end for it. In his writeup, he mentions that the firmware and its simulator for the front-end use exactly the same code which is quite a nice trick, and guarantees no (firmware) surprises when moving from the modelled device to the real thing.

We looked quickly around for Ada resources and came up with: GNAT, the GNU Ada compiler, and its derivatives: GNAT for ARM (STM32-flavor), ARM-Ada (LPC21xx flavor), AVR-Ada, and MSP430-Ada.

Any of you out there use Ada in embedded work? We’d love to hear your thoughts.

Continue reading “Pen-Plotter Firmware Written Completely in Ada”

Learn Functional Reactive Programming on Your Arduino

Everyone loves learning a new programming language, right? Well, even if you don’t like it, you should do it anyway, because thinking about problems from different perspectives is great for the imagination.

Juniper is a functional reactive programming language for the Arduino platform. What that means is that you’ll be writing your code using anonymous functions, map/fold operations, recursion, and signals. It’s like taking the event-driven style that you should be programming in one step further; you write a=b+3 and when b changes, the compiler takes care of changing a automatically for you. (That’s the “reactive” part.)

functionalIf you’re used to the first-do-this-then-do-that style of Arduino (and most C/C++) programming, this is going to be mind expanding. But we do notice that a lot of microcontroller code looks for changes in the environment, and then acts (more or less asynchronously) on that data. At that level of abstraction, something like Juniper looks like a good fit.

Continue reading “Learn Functional Reactive Programming on Your Arduino”

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”

Programming in 3D with 3DPL


Here’s an interesting tool for making simple 3D games. It’s called 3DPL, the 3D programming language, and it’s a real-time interpreted language that allows you to create cubes and other primitives that respond to user input and internal logic. Not only that, but you can build 3D versions of breakout and asteroids very simply with only a few lines of code.

3DPL is based on Unity with a lot of JavaScript influences. Building a cube in 3DPL is as simple as declaring it with a name and position in 3D space. There are a few functions that can be applied to these cubes – they can be made to rotate at the press of a key, or translated in space to collide with each other.

It’s still a very early build, but looks to be pretty interesting for an ‘introduction to 3D graphics programming’ perspective. You can grab a copy of 3DPL to try out over on [amigojapan]’s github. Hopefully we’ll see a gravity method soon for a proper 3DPL Tetris implementation.

Python 3000 officially released


Python 3000 has officially been released. The final bug, Issue2306, “Update What’s new in 3.0” has been closed. Python 3000, py3k, Python 3.0, is a major release for the community. [Jeremy Hylton] pegs the earliest mention of the beast to January 2000. The new release has grown from PEP 3000, opened April 2006.

Py3k breaks backwards compatibility with previous releases in order to reduce feature duplication and promote one obvious way of getting things done. The first major change is that print is now a builtin function and not a statement. int and long have been unified, and integer division now returns a float. Py3k uses concepts of “text” and “data” instead of “Unicode strings” and “8-bit strings”. You can read about many of the changes in What’s New In Python 3.0. Some new features have been backported to Python 2.6 so you can start implementing them in your current code to ease the transition. 2.6 also has the -3 command line switch to warn you about features that are being removed or changed. Finally, the tool 2to3 is a source-to-source translator that should automate a lot of the changes.

Documentation for the new release is online. Source packages and binaries are available now.

[via johl]

Processing 1.0

Processing, the open source programming language designed for artists and other creative types, finally went 1.0. Processing inspired numerous outpourings of creativity and beauty, from interactive art installations to sound sculptures. Improvements to Processing include OpenGL anti-aliasing, an extensible Tools menu, and the XML library included by default. You can read up on the changes or download Processing and start playing with it yourself.

[via Create Digital Motion]