How to install the cross compiler for the Hitachi h8300 processor.

You will need to install a cross compiler so that on your computer, you can compile code that will run on the Hitachi h8300 processor, also known as the LEGO RCX.
You will need two things: binutils and gcc.

  1. Download the following files for gcc and binutils from ftp://ftp.gnu.org:
    	ftp://ftp.gnu.org/gnu/binutils/binutils-2.13.2.1.tar.bz2
    ftp://ftp.gnu.org/gnu/gcc/gcc-3.3.tar.bz2

     

  2. Place these in your download directory and unpack them:
    	bash# cd download
    	bash# tar xvjpf binutils-2.13.2.1.tar.bz2
    	bash# tar xvjpf gcc-3.3.tar.bz2
    
    So now you have a subdirectory for each:
    	bash# ls -aFc
    	./  ../  binutils-2.13.2.1/  binutils-2.13.2.1.tar.bz2  gcc-3.3/  gcc-3.3.tar.bz2
    

     

  3. Make and install binutils as follows:
    	bash# mkdir build-binutils
    	bash# cd build-binutils
    	bash# ../binutils-2.13.2.1/configure --prefix=/eleague/cross-compile --target=h8300-hitachi-hms
    
    Replace /eleague/cross-compile with the full path of the directory where you want to install the cross-compiler.
    	bash# make
    	bash# make install
    	bash# cd ..
    

     

  4. Make and install gcc as follows:
    	bash# export PATH=$PATH:/eleague/cross-compile/bin
    
    Replace /eleague/cross-compile with the full path of the directory where you installed binutils (above).
    	bash# mkdir build-gcc
    	bash# cd build-gcc
    	bash# ../gcc-3.3/configure --prefix=/eleague/cross-compile --target=h8300-hitachi-hms --enable-languages="c c++"
    
    Replace /eleague/cross-compile with the full path of the directory where you want to install the cross-compiler.
    	bash# make
    
    Note that make will fail after a while, when trying to make the test suite, but ignore that part and continue...
    	bash# make install
    	bash# cd ..
    
Now we have a cross compiler that will let you write C code on your computer and compile it to run on the Hitachi h8300 processor -- the one that is inside that Lego RCX brick!

back to eleague howto page