Here, I will introduce how to make gcc environment for Ruputer on BeOS R5 or NetBSD 1.5. Probably you can do on other UNIX like platforms.
It's good idea to install binutils-2.10.1 and gcc-2.95.3 for BeOS previously. These packages include patch files needed for compiling these on BeOS, too. You can get these packages here.
% tar zxvf $SOMEWHERE/binutils-2.10.1.tar.gz % cd binutils-2.10.1 % patch -p1 < $SOMEWHERE/binutils-2.10.1-beos.diff % mkdir build % cd build % ../configure --host=i586-pc-beos \ --target=mn10200-elf \ --prefix=/boot/develop/tools/gnupro % make % make install
% tar zxvf $SOMEWHERE/binutils-2.11.2.tar.gz % cd binutils-2.11.2 % mkdir build % cd build % ../configure --prefix=/usr/local/gcc-2.95.2 \ --target=mn10200-elf % gmake % sudo gmake install
If you use not gcc-core but gcc tar-ball, you may have to add '--enable-languages=c' to configure options.
% tar zxvf $SOMEWHERE/gcc-core-2.95.3.tar.gz % cd gcc-2.95.3 % patch -p1 < $SOMEWHERE/gcc-2.95.3-beos.diff % mkdir build % cd build % ../configure --prefix=/boot/develop/tools/gnupro \ --target=mn10200-elf --with-newlib % make % make install
% tar zxvf $SOMEWHERE/gcc-core-2.95.2.tar.gz % cd gcc-2.95.2 % mkdir build % cd build % ../configure --prefix=/usr/local/gcc-2.95.2 \ --target=mn10200-elf --with-newlib % gmake % sudo gmake install
This library is not indispensable, but useful for your development.
% tar zxvf newlib-1.9.0.tar.gz % cd newlib-1.9.0 % mkdir build % cd build % ../configure --host=$MACHTYPE \ --target=mn10200-elf --prefix=$PREFIX % gmake CC_FOR_TARGET=mn10200-elf-gcc -I../../include \ AR_FOR_TARGET=mn10200-elf-ar \ LD_FOR_TARGET=mn10200-elf-ld \ AS_FOR_TARGET=mn10200-elf-as \ RANLIB_FOR_TARGET=mn10200-elf-ranlib % sudo gmake install
RupSDK is distributed by SII. So you can get it from Ruputer's official site.
$ cd $PREFIX/mn10200-elf $ unzip $SOMEWHERE/RupSDK102D.zip $ for f in RupSDK/inc/*; do \ nkf -dSe < $f > include/`basename $f`; done $ mv include/ADDRESS.DEF include/address.def $ cp RupSDK/lib/* lib/
Create crt0.o from crt0.s.
% mn10200-elf-as -I$PREFIX/mn10200-elf/include \ crt0.c -o crt0.o % sudo mv crt0.o $PREFIX/mn10200-elf/lib/
rutools is developed by IMAI Hiroei. It include file transfer library between PC and Ruputer, some transfer utility programs, and converter program which can make executables for Ruputer. GNU readline library is required for rutools. So first of all, you should install it. And rutools don't support new record types of srec. If you use binutils-2.10.x or later, you shuold fix this problem. Here is a patch for it.
On BeOS, you can not use transfer libraries as is. I have not resolved this problem, so only sf2bin, a converter program, is available.
% tar zxvf $SOMEWHERE/rutools-0.7.3.tar.gz % cd rutools-0.7.3 % patch -p1 < $SOMEWHERE/rutools-0.7.3.diff % cd ruutils % make % cp sf2bin $HOME/config/bin/sf2bin
You have to edit make-args by hand. On CFLAGS line, add path to the readline library headers. It may be like '-I/usr/local/include'. And you should specify install prefix, too.
% tar zxvf $SOMEWHERE/rutools-0.7.3.tar.gz % cd rutools-0.7.3 % patch -p1 < $SOMEWHERE/rutools-0.7.3.diff % env LIBRARY_PATH=/usr/local/lib make % sudo make install
Typical process is following.
% 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