We have developed software in C, Java and (partly) Python for driving the Brainstem and CMUCam2 from the Gumstix. The code is filled with holes and bugs: it's an initial effort of an undergraduate class. We welcome any additions, modifications, and improvements.
C, Java, or Python? The obvious choice for Gumstix development is C (or C++). It is fast and straightforward. Unfortunately, C is also extremely inconvenient, as the Gumstix does not have gcc onboard. As a result, you must create a gcc cross-compiler to the Gumstix's ARM architecture (a so-called toolchain) to build any C program for the Gumstix; and then move the program's binaries to the Gumstix. The resulting turnaround time is prohibitive and the link-run-debug cycle unnecessarily complex.
We have also written significant code in Java. The idea is that Java does not require a cross-compiler: you can compile anywhere, even on the Gumstix (using jikes or kjc). This is much more convenient than C. However, even the fastest of virtual machines (JamVM) only does bytecode interpretation, not HotSpot-style bytecode compilation. As a result, the code is much slower than C code. There are also a few bugs in our Java code (or in the virtual machine) which are difficult to track down. Ultimately, though, we think that Java may prove to be the best choice, particularly if the (JamVM) author can improve its speed on the ARM architecture (encourage him).
Last, we have written some initial code in Python. Ordinarily Python would be the slowest of options, though it may not be much slower than Java in this (non-bytecode-interpreted) environment, and indeed might be faster. Python's other big advantage is that you can edit the file directly and submit it immediately; no need to recompile. We encourage any further Python development.
Code Overview
Brainstem/CMUCam2 Libraries on the Gumstix The Gumstix may control the Brainstem via either I2C or Serial. We began with a Serial interface but are moving to a pure I2C interface as it is much faster and more reliable. C and Java code is available for controlling the Brainstem either route. The Gumstix can also control the CMUCam2 over Serial via Java, C, or Python.
The Serial Daemon Because some languages (Java, Python) do not have a straightforward way to change the ioctl values on the serial port, we've developed a serial port daemon which listens in on a socket and shoves data out the serial port. This allows any language which can talk sockets to talk to the serial port.
Encoder Code We have also written some wheel encoder code, in the "TEA" language special to the Brainstem. The encoder program resides on the Brainstem and maintains a count of left and right wheel rotation which may be queried or reset by Gumstix or other computers connected to the Brainstem. The code is on the Brainstem rather than the Gumstix because the time to poll for encoder ticks over serial or I2C is far too high.
The Gumstix OS and Third-Party Software
We include some discussion of our Gumstix operating system modifications, file system layout, and I2C driver construction. We also spend some time discussing the use of third-party software provided with the various devices: Acroname's GP, Console, and Java/C libraries for the Brainstem; and the open-source CMUCam2 Java utilities.