Lazy?

There is a web-based compiler at https://vheissu.mersenne.com/~dhm/compile-legOS.html that will compile your code and send back the SREC file that is needed for download. If you use it (and trust what patches it may-or-may-not have applied), you can skip this section.

Assembling the cross compiler

This assumes that everything will be installed in /usr/local/mindstorms.
mkdir /usr/local/mindstorms
change owner of /usr/local/mindstorms to the login that will be building the cross compiler. get binutils-2.9.1.tar.gz to get an assembler and linker (older versions have assembler problems with the combinations of the Hitachi processor target and gcc) extract and configure
  ./configure --prefix=/usr/local/mindstorms --target=h8300-hitachi-hms
build and install
  make
  make install
get egcs-1.1.1 (GCC 2.91.60) or better (I had egcs-1.1.1 already downloaded) extract and make a build area
  mkdir mindstorms-egcs
configure
  cd mindstorms-egcs
  ../egcs-1.1.1/configure --prefix=/usr/local/mindstorms --target=h8300-hitachi-hms
you only need a portion of the compiler, so ignore warnings about unsupported configurations for certain directories edit the makefile and add "-Dinhibit_libc" to CFLAGS build
  make LANGUAGES="c c++"
ignore the errors about the compiler not being able to create executables, the cross compiler cannot build objects for the host machine Install it:
  make LANGUAGES="c c++" install
now build the legOS support library and tools get legOS-0.1.7 as well as get and apply the following patches: edit Makefile.common and change TOOLPREFIX and LEGOS_ROOT to:
  TOOLPREFIX=/usr/local/mindstorms/bin/h8300-hitachi-hms-
  LEGOS_ROOT=/usr/local/mindstorms/legOS/
legOS assumes that it is still in development, so it is set up to look for include files in it's install directory. To keep life simple set that up now:
  mkdir -p /usr/local/mindstorms/legOS/include
  cp -r include /usr/local/mindstorms/legOS/
build it
  make 
There isn't an install target for the makefile so do the following:
  cp -r * /usr/local/mindstorms/legOS/
  (cd /usr/local/mindstorms/legOS/lib;ln -s ../liblegOS.a .)
  (cd /usr/local/mindstorms/bin;ln -s ../legOS/util/firmdl .)
Now change the owner of the contents of /usr/local/mindstorms to root and the cross compiler build is complete.
Previous - Overview Main Next - Building SREC files
Monty Stein Dec 18, 1999
CLUG Home