Tonight I finally managed to get gcc ready to cross compile for my ruputer watch. This combined with my port of fton to Mac OS X (10.3.5) means that I can now do development and testing of OnHandPC/Ruputer programs without the use of Linux or Windows. Here’s the steps necessary to get it to work:

(Note that I’ve built wget and installed it in /usr/local/bin from source, so I’ll use that in the examples. This can be replaced with a curl command or something similar.)

mkdir cross
cd cross
# Binary tools for cross compilation
# Cross compiler
# Smaller C library designed for cross compiling
# GCC patches that make the cross compile work
# Tools required to convert the elf files to exf
# A patch for the rutools that fixes a bug
# OnHandPC SDK

Build and install the binary tools

tar xjvf binutils-2.14.tar.bz2
cd binutils-2.14
./configure –prefix=/usr/local/ruputer –target=mn10200-elf && make
sudo make install
cd ..
export PATH=$PATH:/usr/local/ruputer/bin

tar xzvf gcc-patches.tgz
tar xzvf newlib-1.12.0.tar.gz
cd gcc-2.95.3
ln -s ../newlib-1.12.0/libgloss
ln -s ../newlib-1.12.0/newlib
cp /usr/share/libtool/config.sub .
cp /usr/share/libtool/config.guess .
# This will produce some errors, ignore them
patch -p1 < ../gcc-patches/gcc-2.95.3.patch
cd ..
mkdir gcc-build
cd gcc-build
../gcc-2.95.3/configure –prefix=/usr/local/ruputer –target=mn10200-elf
sudo make install
cd ..

Now the cross compiler should be built and installed, but the needed libraries and headers to do anything useful aren’t installed yet.

cd onHand_SDK/RupSDK
sudo cp Inc/* /usr/local/ruputer/mn10200-elf/include
sudo cp Lib/* /usr/local/ruputer/mn10200-elf/lib
sudo find . -name “*.a” -exec cp ‘{}’ /usr/local/ruputer/mn10200-elf/lib ;
# This is a silly case issue
sudo mv /usr/local/ruputer/mn10200-elf/include/Address.def /usr/local/ruputer/mn10200-elf/include/address.def

Okay, this is all that’s needed to create elf binaries for the watch, but we’re not quite done yet, since we need binaries in the exf format for the watch. Luckily, there’s a nice tool that comes with rutools that can do this for us.

tar xzvf rutools-0.7.3.tar.gz
cd rutools-0.7.3
patch -p1 < ../rutools-0.7.3.diff

Edit the Makefile with your favorite editor and change the line that says “SUBDIR = rulib rutools ruutils ftr” to “SUBDIR = ruutils”

sudo make install

All Done!

Okay, so those are the steps needed to set up Mac OS X for development on the Ruputer/OnHandPC. Note that I put my files in a slightly different place than is specified in most Makefiles, so they may need some slight tweaking to get to work properly.