OnHandPC
Taken from bits of the site that were recoverable from archive.org. Maybe incomplete.
I recently picked up this watch because it’s got a programmable API in C and is very cool. However, so far I’ve been unable to cross compile GCC with it on Mac OS X. It’s made by Matsucom in the United States, and Seiko in Japan, though the old ruputer page doesn’t appear to be up.
Here are the specifications on it:
- 16 Bit CPU (3.6 MHz Panasonic MN10200)
- W-PS-Dos OS V1.16
- 2MB Flash storage
- 150k RAM
- 300k System Rom
- IR Port (38,400 BPS)
- RS-232C Serial Port
- 102 x 64 Matrix Display
- Navigation Joystick
- 2 lithium batteries CR2025
- Battery life: App. 2-3 months
- Approx. 52 grams
- Water Resistant
One of the unfortunate things about this watch is that it uses the Matsushita (Panasonic) MN10200 cpu, which is now being obsoleted from GCC and GDB. This creates a problem because I seem to be unable to get gcc 2.95.3 to work with it as of yet. If anyone else that happens to stumble onto this page is trying to do the same thing, gcc 2.95.3 does not support Mac OS X, or more specifically, the powerpc-apple-darwin7.2.0 (panther) host, so you’ll need this patch: GCC 2.95.3 for Darwin patch (Shamelessly borrowed from the Zaurus on Mac OS X people). To even start playing with stuff, that patch needs to be applied.
I was thinking that I’d want to use newlib with gcc since it uses less space, but I’m getting strange problems with it being unable to find the proper headers, so I’m right now trying to build it using glibc instead.
At any rate, the binutils themselves work fine on Mac OS X, and this process seems to work fine on Linux, so I’ll detail how to build the compiler toolchain for the onHand/Ruputer:
I used gcc-core-2.95.3, binutils-2.14 and newlib-1.12.0 for this stage. Apparently, you have to build the binary tools, such as the linker, etc. before you build the compiler or merge the two trees together. I haven’t had much success with building both trees at once, so I’ll build them separately:
tar xjvf binutils-2.14.tar.bz2
cd binutils-2.14
./configure –prefix=/usr/local/ruputer –target=mn10200-elf
make all
sudo make install
Now to try to build gcc-2.95 using newlib. Newlib is an interesting case because it was used by Cygnus (Now Red Hat) when it writing the patches to gcc for cross compilation. Newlib uses portions from a number of different libc implementations, including FreeBSD’s, so it’s a strange beast and is not necessarily the best to use. However, it is supposed to generate smaller binaries than glibc, which is important in an embedded environment.
tar xzvf gcc-core-2.95.3.tar.gz
# if using newlib:
tar xzvf newlib-1.12.0.tar.gz
cd gcc-2.95.3
# if using Mac OS X, grab the patch above and apply
patch -p1 < gcc-2.95.3.patch
# these two if using newlib:
ln -s ../newlib-1.12.0/newlib
ln -s ../newlib-1.12.0/libgloss
# if /usr/local/ruputer/bin isn’t already in your path:
export PATH=$PATH:/usr/local/ruputer/bin
mkdir gcc-build
cd gcc-build
../gcc-2.95.3/configure –prefix=/usr/local/ruputer –target=mn10200-elf –with-newlib
make
sudo make install
At this stage, there should be binary tools and a gcc cross-compiler for the mn10200 architecture, but not enough to produce binaries for the OnHandPC just yet. At this point, we’ll now need a couple of things from the Ruputer SDK for it to work properly. We’ll also need to bootstrap the C runtime using the crt0.s from toyoshima-house.
unzip ruputer-sdk.zip
cd onHand_SDK/RupSDK
sudo cp Inc/* /usr/local/ruputer/mn10200-elf/include
sudo cp Lib/* /usr/local/ruputer/mn10200-elf/lib
cd Src
sudo find -name “*.a” -exec cp ‘{}’ /usr/local/ruputer/mn10200-elf/lib \;
sudo /usr/local/ruputer/bin/mn10200-ranlib /usr/local/ruputer/mn10200-elf/lib/*.a
sudo mv /usr/local/ruputer/mn10200-elf/include/Address.def /usr/local/ruputer/mn10200-elf/include/address.def
Wherever you have the crt0.s file, do the following:
mn10200-elf-as -I/usr/local/ruputer/mn10200-elf/include crt0.c -o crt0.o
sudo mv crt0.o /usr/local/ruputer/mn10200-elf/lib/
Now there is everything necessary to make elf binaries for the OnHandPC. One final problem with that is that we need to convert them to the exf format, for which I’m am not sure of the differences, but I do know that it is necessary. You’ll need this patch to compile, which fixes a missing header (or at least I did), which also contains some changes from others that fix 2 byte address data records: rutools patch
tar zxvf rutools-0.7.3.tar.gz
cd rutools-0.7.3
patch -p1 < rutools-0.7.3.patch
make
sudo make install
This worked fine for me except, that I needed to add #include into one of the files to get it to work. Now, to compile something, you’ll need something like this:
mn10200-elf-gcc -o hello.o -c hello.c
mn10200-elf-gcc hello.o -o hello –Xlinker -Ttext=0x110100 -lrupsys -lruptool -llcdbios -lpsdos -lwbios
cp hello hello.elf
mn10200-elf-objcopy -O srec hello hello.elf
sf2bin hello.elf hello.exf
Note that parts of this were shamelessly borrowed from: toyoshima-house.net