Code Craft: Subtle Interrupt Problems Stack Up

[Elliot Williams’] column, Embed with Elliot, just did a great series on interrupts. It came in three parts, illustrating the Good, the Bad, and the Ugly of using interrupts on embedded systems. More than a few memories floated by while reading it. Some pretty painful because debugging interrupt problems can be a nightmare.

One of the things I’ve learned to watch out for over the years is the subtlety of stack based languages, like C/C++, which can ensnare the unwary. This problem has to do with the corruption of arrays of values on a stack during interrupt handling. The fix for this problem points up another one often used by black hats to gain access to systems.

Continue reading “Code Craft: Subtle Interrupt Problems Stack Up”

Giving The Arduino Deques, Vectors And Streams With The Standard Template Library

The Arduino IDE is extremely similar to C++, but judging from the sketches you can find on the Internet, you’d never know it. Simpler Arduino projects can make do with just toggling IO pins, reading values, and sending serial data between two points. More complex builds fall into the category of real software development, and this is where the standard Arduino IDE falls miserably short.

[Andy] saw this lack of proper libraries for more complicated pieces of software as a terrible situation and decided to do something about it. He ported the SGI Standard Template Library to bring all those fun algorithms and data structures to any AVR chip, including the Arduino.

Going over what’s included in [Andy]’s port reads just like a syllabus for an object-oriented programming class. Stacks, queues, and lists make the cut, as do strings and vectors. Also included is just about everything in the   and headers along with a few Arduino-oriented additions like a hardware serial and liquid crystal streams.

With all these objects floating around, [Andy] says it will make an impact on Flash and SRAM usage in an AVR. Still, with all the hullabaloo over faster and larger ARM micros, it’s nice to see the classic 8-bit microcontroller becoming a bit more refined.

Raspberry Pi - rpi

Operating Systems Development With The Raspberry Pi

Even though the Raspberry Pi has, from the very beginning, been touted as an educational computer, we’ve seen neither hide nor hare of coursework, lesson plans, or even computer sciencey tutorials using the Raspi. We’re guessing academia works at a much slower pace than the average hardware hacker, but [Alex Chadwick] at Cambridge University has managed to put together an online tutorial on developing an operating system from scratch for the Raspi.

The goal of this tutorial is to throw a budding Raspi tinkerer into the strange and confusing world of registers, hexadecimal, and ARMv6 assembly. After going through the necessary toolchain, [Alex]’s tutorials cover blinking the ‘OK’ LED on the Raspberry Pi using only assembly.

The OS development guide goes on from there to include drawing graphics on the screen and even accepting input from a USB keyboard.

It’s important to point out what [Alex]’s tutorial isn’t; even though this series of tutorials goes through manipulating the bare metal of the Raspberry Pi, don’t expect to be porting UNIX to the Raspi after going through these guides. That being said, after completing these tutorials, you’ll be in a fabulous position for building your own homebrew OS on the Raspberry Pi.

Monitoring Software Builds With A Traffic Light

[JD] at isotope11 was looking for a way to get instant feedback whenever a developer broke a piece of software they were working on. After finding a 48 inch tall traffic light, he knew what he had to do. Now, the entire development team knows the status of their code from a traffic light hanging in the corner.

isotope11 runs a continuous integration server to do the quality assurance on their software projects. It’s a lot more flexible than the ‘compile and pray’ setup we’re used to, but then again C isn’t very well suited to test-driven development. When one of [JD]’s developers breaks a piece of code, the CI server will send a warning to an Arduino where all the electronic magic happens.

To light the traffic light, [JD] used a few relays to drive the 120 volt bulbs in the traffic light. The traffic light is very easy to read – red means something is broken, green means everything is alright, and yellow means a test suite is being run.

Check out the video of [JD]’s TDD visualization after the break.

Continue reading “Monitoring Software Builds With A Traffic Light”