We're hiring!

We're actively seeking developers and designers for our Detroit & Ann Arbor locations.

Inexpensive Ethernet JTAG Adapter with Raspberry Pi and OpenOCD

I recently wanted an ethernet JTAG adapter for a project I was working on. Unfortunately ethernet JTAG adapters can cost upwards of $300, and even then they can be specific to particular chipset and toolchains.

However, were already using OpenOCD with ST-LINK/V2 programmers to communicate with out hardware, and it turns out that it’s very easy to set up OpenOCD on the Raspberry Pi. You can then plug the programmer into the Pi, connect a debugger (gdb in our case) to the OpenOCD instance, and debug your firmware remotely! Read more on Inexpensive Ethernet JTAG Adapter with Raspberry Pi and OpenOCD…

Posted in Embedded Systems | Tagged , , , | 2 Comments

High-Quality Font Rendering for Embedded Systems

Setting up high-quality font rendering in a memory-constrained embedded system sounds like it would be hard. However, like many other problems in embedded systems, this one has pretty much already been solved by game developers. It turns out that getting proper font rendering, with kerning and all, can easily be done in a day’s work.

The game development communities are actually a great place to look for a lot of algorithms. Anything with graphics (even simple things like fonts), geometry/spatial algorithms (collision detection/prediction), or physical simulations have all gotten a lot of attention from the game developers. And their solutions are often mindful of memory and realtime constrains, which are of particular interest in embedded systems.

My particular use case is rendering text to a tiny black and white display (smaller than 150×50) in a resource-constrained environment (32k of RAM total) written in C. Read more on High-Quality Font Rendering for Embedded Systems…

Posted in Embedded Systems | Tagged , , | Leave a comment

Game Networking Made Easy

I’ve made several toy games with friends, but whenever it came around to adding some simple multiplayer support, getting the networking running was always a royal pain. It seemed like each game had so many special cases for how game-state needed to be synchronized between players that it was impossible to decouple the netcode from the game logic. I wished for a network library that could handle all the state synchronization for me, but I could never find one.

The trouble is that most existing “game networking libraries” are actually mostly data transport protocols (built over UDP). These help ship the data to its destination more responsively than TCP and more reliably than UDP, but usually don’t help much with the coordination/synchronization of game-state between players. So I decided to make one myself! And I did! (It only took me 3 years; turns out it’s kinda tricky.)

I have a simple, working, and hopefully actually useful implementation at github. Read more on Game Networking Made Easy…

Posted in Extracurricular Activities | Tagged | 2 Comments

Moving Unpushed Changes to a New Branch with Mercurial

So you’ve been studiously committing your changes early and often only to discover that, for whatever reason, you really wished you’d been committing your changes to a different branch. Now what do you do? Is there a way we can just move unpushed changes onto a new branch? Actually, Yes!

1. Make a Backup

First of all, in order to do this we’re going to need to use the mercurial rebase extension to essentially re-write (unpushed) commit history. Rebasing is one of the few mercurial commands that can irreversibly destroy changes. Fortunately, we can easily create a convenient backup by just creating a local clone of the repository.

Make sure you don’t have any uncommitted local changes, and then do:

hg clone path/to/original path/to/backup/

Now that we have a good backup, lets get started. Read more on Moving Unpushed Changes to a New Branch with Mercurial…

Posted in Developer Tools | Tagged | Leave a comment

Creating Automated Build Versions During Development

I was recently working on a project where I needed to be able to tell (in an automated way) if the versions of two builds matched. The project provided version info that consisted of a manually hardcoded version number and timestamp of when the source was built. This was problematic. The manual version number was incremented rarely and so was useless for day-to-day development. And the timestamp would only tell you when that particular build was generated but not what source was used to generate it. This made it difficult to trace down bugs as it was nearly impossible to know for sure what source a build was generated from.

So I set about to come up with a good replacement.

What Makes Version Information Useful?

Here are the things we wanted from version information:

  • Determine if two builds come from the same source (even if built on different machines, at different times).
  • Easily find the code associated with a particular build.
  • Easily determine approximately how old a build is; compare age of versions.
  • Provide an easy mechanism for the user to tell different versions of builds apart.

Read more on Creating Automated Build Versions During Development…

Posted in DevOps & System Admin. | Leave a comment

5 Unix Commands I Wish I’d Discovered Years Earlier

I’ve been using *nix systems for quite a while. But there are a few commands that I somehow overlooked and I wish I’d discovered years earlier.

1. man ascii

This prints out the ascii tables in octal, hexadeciamal and decimal. I can’t believe I didn’t know about this one until a month ago. I’d always resorted to googling for the tables. This is much more convenient.

ASCII(7)           BSD Miscellaneous Information Manual           ASCII(7)
 
NAME
    ascii -- octal, hexadecimal and decimal ASCII character sets
 
DESCRIPTION
    The octal set:
 
    000 nul  001 soh  002 stx  003 etx  004 eot  005 enq  006 ack  007 bel
    010 bs   011 ht   012 nl   013 vt   014 np   015 cr   016 so   017 si
    020 dle  021 dc1  022 dc2  023 dc3  024 dc4  025 nak  026 syn  027 etb
    030 can  031 em   032 sub  033 esc  034 fs   035 gs   036 rs   037 us

For more information, see the ascii man page.
Read more on 5 Unix Commands I Wish I’d Discovered Years Earlier…

Posted in Developer Tools | Tagged | Comments closed

Simple Algebraic Data Types for Ruby

Haskell is my language of choice, and one of the features that I miss the most when working in a different language is algebraic data types. I get particularly frustrated about the lack of algebraic data types (and the associated destructuring) because they are so simple. You don’t need any fancy runtime features to make them work. It would even be feasible to make them work in C, for goodness sake.

If you are unfamiliar with algebraic data types, you should check out Rust’s enum data type. Rusts’ enum’s are algebraic data types, and I’ve found them to be the gentlest introduction to their usefulness. The Algebraic data type wikipedia entry is also decent and a bit more thorough. Read more on Simple Algebraic Data Types for Ruby…

Posted in Ruby | Tagged , | Comments closed

Rust Gets a Lot of Things Right

So some coworkers and I have been recently checking out the relatively new language Rust, and so far we’ve been very impressed.

Rust gets a lot of things right. You should check it out. If you use C or C++ on a regular basis, you really should check it out.

A Systems Language with Better Features

Rust is a systems language, but it has a lot of awesome features you don’t normally see in system languages, such as:

Posted in Embedded Systems | Tagged | Comments closed

Towards a Haskell Logic Library

In one of my previous posts, I described an implementation of miniKanren in Haskell. I have since been improving the implementation.

I am currently working on the third iteration of my logic library. The first one was described by my previous post. The second is in a GitHub repository. I have yet to settle on a design that I really like, but I thought I’d post something about what I’ve been working on.

Improvements

The key improvements in the second iteration were the ability to easily add custom data types and the addition of a match function. The custom data type addition was pretty straightforward. Read more on Towards a Haskell Logic Library…

Posted in Functional Programming | Tagged | Comments closed

Why Haskell Is Worth Learning

When I recommend learning Haskell to the uninitiated, I often get asked: “Why Haskell?” “Is it a practical language?” and ”Is it something I can actually use?” My answer is definitely yes.

Haskell isn’t my primary language at work (I mostly write C code for embedded systems), I’ve still found it incredibly useful. And even if I never used Haskell at work, I would still consider learning it as time well spent. So, why Haskell?

1. Haskell Plays Well with C

It turns out Haskell is a very powerful tool for helping you write C. Haskell has let me do things I would normally not even consider to be, umm, practical.

Read more on Why Haskell Is Worth Learning…

Posted in Functional Programming | Tagged , , | Comments closed
Google Circle
Join my Circle on Google+