At the recent VistA Expo & Symposium 2012, the always visionary Rob Tweed
showed us his recently acquired Raspberry Pi,
and pointed out how interesting for the Education of the community it would be
if we could run GT.M on it.
The Raspberry Pi was indeed conveived as a device for education. More specifically, for stimulating the teaching of basic Computer Science in Schools. At $35 a piece, one can let the card in the hands of a toddler without the same apprehension that one would have for a shiny new laptop. It is also, by design, an open device that exposes the basic elements of a computer in the same way that the personal computers did for us in the early 80's.
"The lack of programmable hardware for children
– the sort of hardware we used to have in the 1980s –
is undermining the supply of eighteen year olds who know how to program,
so that's a problem for universities,
and then it's undermining the supply of 21 year olds
who know how to program, and that's causing problems for industry."
That said, the Raspberry Pi is far from being a simple toy. It is a fully functional computer. It has an ARM processor, can fit a 4Gb SD memory card, 512Mb RAM, has an HDMI video port, an ethernet wired port and two USB ports. Combined with LEGOs It has been used to build a supercomputer. There is also a whealth of educational resources built around the Raspberry Pi.
Making strides towards that goal of running GT.M on the Raspberry Pi (but not there yet...), we have started by creating a cross compilation environment that allows us to use a standard Linux laptop (with an Intel i7 processor) to compile code targeted to be executed in the Raspberry Pi's ARM processor.
The first challenge for us was to actually put our hands on a Raspberry Pi. They are back ordered by several months, and some stores only sell them as added bonus after one orders more than $350 of goods. We were lucky to get a tip on where to buy one, from Professor Seth Chaiken at SUNY Albany, who work with several students on projects in these cards.
We got one with a prebuild Debian 6 Linux installation in a SD card. Once unpacked and plugged into the network, we started this exploration by building code natively in the Raspberry Pi, as described in this blog post, and verified that we could build CMake natively in the board.
The disadvantage of such approach is the long time that it takes to build code natively. About two hours for the case of CMake, and more than four days in the case of ITK. We don't have the exact time for ITK, because after waiting four days and fearing for the Raspberry Pi to overheat, we stopped the build, and accepted that cross-compilation was the way to go.
Cross-compilation is the process of building in one platform, object code that is targeted to a different platform. In our case, we want to use a standard Intel-based laptop running Ubuntu Linux to build object code that will run in the Raspberry Pi. To get there, we are taking advantage of the capabilities that CMake offers for doing cross-compilation.
The full details are described in this second blog post.
The challenge of porting GT.M to the Raspberry Pi has two major pieces, that have been discussed in the EWD Forum:
1) Compile the C source code of GT.M for ARM
2) Add an ARM code generator to the GT.M compiler
We, of course, start with (1), which is a lot easier now that GT.M 6.0-000 is configured with CMake. This is the easy part...
Part (2) is more challenging, since it involves adding new functionalities to GT.M, that will generate native code for the ARM processor. Ideally, this should be done by targeting a generic ARM platform, and in this way making GT.M available for the thousands of ARM-based devices that are in the market today. The effectiveness of the M language and the M database to work on limited hardware, makes of this combination a very interesting one indeed.
At this point,
Elves are working on part (1) from an undisclosed location...