Hi all Qwerkers,
I have successfully compiled the Ruby language on the Qwerk (Ruby is A Programmer's Best Friend : see www.ruby-lang.org). The port is complete : you can cross-compile C extensions (I have done it for the libqwerk, the serial port library and the camcapture module), use threads, sockets and even the included WEBrick web-server, etc. The good news is that it is very lightweight and can fit into the embedded flash on the qwerk (size of the full thing is 4MB, size of Ruby executable is 500kb).

To make it available, I have created the "Ruby On Qwerk" project on RubyForge.org.
If you are interested, you can download the precompiled binaries for the Qwerk at http://rubyforge.org/frs/?group_id=4614&release_id=15406.
This release includes the wrapper for libqwerk, that enables to use the Qwerk's hardware devices from Ruby.

Just for the beauty of the beast, a small example of code moving a servo :


require 'qwerk'

servo = Qwerk::RCServo.new(1)
servo.set_bounds(0, 32, 228)
  servo.set_position(0, 0)
  servo.set_position(0, 128)
  servo.set_position(0, 255)
end while true

and a code that plays pacman.wav :


require "qwerk"

hardware = Qwerk::QwerkHardware.new
audio = Qwerk::QEAudioController.new(hardware)
puts "Press <Enter>"

In order to run the examples above, you first need to install Ruby on your Qwerk. This is done by simply copying the ruby directory from the release file to /opt on your qwerk.
The best way to transfer files to/from your qwerk is use NFS (Network File System) : http://nfs.sourceforge.net/nfs-howto/
On Ubuntu, you just need to modify the /etc/exports file. Here is mine for example :


# /etc/exports: the access control list for filesystems which may be exported
#      to NFS clients.  See exports(5).

( is obviously the IP address of my Qwerk on my network, and /home/steux/terk the directory I want to mount on the Qwerk)
After editing this file, you may need to run exportfs to update the NFS server :


sudo exports

Now, you should log onto your Qwerk, either through the serial port, by using screen on linux :


screen -U /dev/ttyS0 57600

or minicomm, or HyperTerminal on Windows.
You can also use telnet to access the Qwerk :



Then, on the Qwerk, you can mount your file system :


mount -o nolock /mnt/terk

and if the Ruby release is under /home/steux/terk, you can copy Ruby to the Qwerk's flash memory by typing :


cp -r /mnt/terk/ruby /opt

At last, you have to add the ruby binaries to your path :


export PATH=/opt/ruby/bin:$PATH

You can check that Ruby is working by running irb (instant Ruby):


irb(main):001:0> 1+1
=> 2
irb(main):002:0> exit

or by typing :


ruby -e '5.times { puts "Hello World"}'
Hello World
Hello World
Hello World
Hello World
Hello World

For those who want to build Ruby themselves, here are the configure options that do the trick :


env \
  CC="arm-linux-gcc"  \
  CPP="arm-linux-cpp" \
  CXX="arm-linux-g++" \
  LDFLAGS="" \
  OBJCOPY="arm-linux-objcopy" \
  LD="arm-linux-ld" \
  AR="arm-linux-ar" \
  RANLIB="arm-linux-ranlib" \
  NM="arm-linux-nm" \
  STRIP="arm-linux-strip" \
  ac_cv_func_setpgrp_void=yes \
  ac_cv_func_isinf=no \
  ac_cv_func_isnan=no \
  ac_cv_func_finite=no \
  ./configure \
    --host=arm-qwerk-linux \
    --without-x \
    --disable-largefile \
    --prefix=/opt/ruby \
    --enable-socket=yes \
    --without-Win32API \

You will then just need to type make, and sudo make install. This will install Ruby in the /opt/ruby on your machine, which you can then transfer onto the Qwerk...
A short post install script that removes unnecessary libraries (who needs support for japanese?) :


sudo chown -R $(whoami) /opt/ruby
rm /opt/ruby/lib/libruby-static.a
rm /opt/ruby/lib/ruby/1.8/arm-linux/nkf.so
arm-linux-strip /opt/ruby/bin/ruby
cp rbconfig.rb /opt/ruby

Happy Rubying on the Qwerk !