----------------------------------------------------------------------
  How to install "kaffe for mips/eCos"
----------------------------------------------------------------------
                                                      27 Jun 2005 NIC
 
  00. Introduction
 
  01. Compile "eCos"
    01-1. Download a eCos source.
    01-2. Download a Configuration Tool.
    01-3. Install kaffe packages.
    01-4. Compile eCos.
 
  02. Compile "kaffe for mips/eCos"
    02-1. Delete relation newlib from mipsel-elf.
    02-2. Download a source of "kaffe for mips/eCos".
    02-3. Modify a install-script "kaffe_build.sh".
    02-4. Cross-compile "kaffe for mips/eCos".
    02-5. "kaffe for mips/eCos" is examined on Ultimodule.
 
 
 
----------------------------------------------------------------------
00. Introduction
----------------------------------------------------------------------
 
 Contents of this text are way of cross-compiling "kaffe for mips/eCos".
 
 [Requirements specification]
 
    * It installed "Configration Tool" and "mipsel-elf".
 
    * "mipsel-elf" is mounted like a following.
 
        ...\mipsel-elf --> /opt/ecos/gnutools/mipsel-elf
 
 
 [Attention]
 
    * You must prepare a "current.ect".
 
 
 
----------------------------------------------------------------------
01. Compile "eCos"
----------------------------------------------------------------------
 
 01-1. Download a eCos source.
 
   * Extract a downloaded eCos source to "/opt/ecos".
 
   $ export CVSRSH="ssh"
   $ cvs -d :ext:ryos@sitek02.exorint.net:/data/cvsprojects/ecos-scmxx
   pass : 04
 
 
 01-2. Download a Configuration Tool.
 
     http://www.ecoscentric.com/
 
   * You move from [DevZone] to [Configuration Tool] on the web site.

   * Download "eCos Configuration Tool version 2 for Windows"
      from item of "Downloading snapshots and source code".
 
 01-3. Install kaffe packages.
 

   * Download eCos-packages of kaffe from the following URL,
      and extract a one to arbitrary path.
 
     http://sourceforge.net/project/showfiles.php?group_id=96658
     
     File name : kaffe_ecos_2_0Beta.epk
 
 
   (a) Case of using "Configuration Tool"
 
     * You'll move like a following on menu.
 
         [Tools] --> [Administration]
 
     * Then, you click [add] and select a "*.epk".
 
 
   (b) Case of installing by yourself
 
      * Extract "kaffe_ecos_2_0Beta.epk" to arbitrary path.
 
      * Open pkgadd.db in a text-editor, 
         and you must add the content to tail of ".../packages/eCos.db".
 
      * Copy directory "kaffe" to ".../packages/".
 
 
   * Add template of "kaffe for mips/eCos" to "Configuration Tool".
 
      * Make a directory like "_kaffe_complete" on ".../packages/templates/".
 
      * Copy "current.ect" to directory you made.
 
 
 01-4. Compile eCos.
 
   * Set up options of "Configuration Tool" for compiling eCos.
 
     1. Repository : Appoint a directory you extracted eCos source.
     2. Templates  : Select "SCM20 board" and "_kaffe_complete".
     3. Save as    : Save it as arbitrary name at "~/eCosBase/".
 
   * Start compiling when you click [Library] in menu.
 
     If error is nothing, it create eCos objects on "~/eCosBase"
 
 
 
----------------------------------------------------------------------
02. Compile "kaffe for mips/eCos"
----------------------------------------------------------------------
 
 02-1. Delete relation newlib from mipsel-elf.
 
   * For use newlib in eCos.
   
   * Delete the all following file.
 
        [Needless file]
        -------------------------------------------------
        libc.a, libg.a, libm.a, libnullmon.a, libiberty.a
        libpmon.a, liblsi.a
        -------------------------------------------------
 
     $ find /mipsel-elf -name xxxxx.a | xargs rm -f
 
 
 02-2. Download a source of "kaffe for mips/eCos".
 
   * Download source of "kaffe for mips/eCos" from the following URL,
      and extract a one to arbitrary path.
 
      http://sourceforge.net/project/showfiles.php?group_id=96658
      
      File name : kaffe-1.0.7_for_eCos-2.0.tar.gz
 
 
 02-3. Modify a install-script "Build_eCos+kaffe.sh".
 
   * It publish a example of "Build_eCos+kaffe.sh" as follows.
 
   [Example of "Build_eCos+kaffe.sh"]
   --------------------------------------------------------------------------
   #!/bin/sh

   # 
   whereis_ecosbase="/home/NIC/eCosBase/kaffe_complete_scm20_install"

   # 
   whereis_mipsel_elf="`which mipsel-elf-gcc`/../../"
   whereis_gcclib="`find ${whereis_mipsel_elf} -type d -name include | grep gcc-lib`"

   # 
   whereis_kaffeh="`pwd`/`find . -name kaffeh_for_*.exe`"

   # 
   export KAFFEH=${whereis_kaffeh}
   export ECOS_ENV_DIR=${whereis_ecosbase}

   export LDFLAGS="-nostartfiles -Ttarget.ld -nostdlib -L$ECOS_ENV_DIR/lib "
   export OPTS="-O2 -Wall"
   export CFLAGS="-march=r3000 -mtune=r3000 -mel -G0 -msoft-float $OPTS"
   export CPPFLAGS="-I$ECOS_ENV_DIR/include -nostdinc -D__ECOS"

   export COMMAND_PREFIX=mipsel-elf

   export CC=$COMMAND_PREFIX-gcc
   export LD=$COMMAND_PREFIX-ld
   export NM=$COMMAND_PREFIX-nm
   export AR=$COMMAND_PREFIX-ar
   export RANLIB=$COMMAND_PREFIX-ranlib
   export CPP=$COMMAND_PREFIX-cpp
   export OBJCOPY=$COMMAND_PREFIX-objcopy
   export OBJCOPY_OUT_BFDNAME=elf32-littlemips
   export EXEEXT=.exe

   # 
   mv -f config.cache config.cache.old
   make clean

   sh configure --with-engine=intrp --with-includes=${whereis_gcclib} mipsel-dummy-ecos

   make
   --------------------------------------------------------------------------
 
 
 02-4. Cross-compile "kaffe for mips/eCos".
 
   $ ./Build_eCos+kaffe.sh
   
   $ make
 
 
 02-5. "kaffe for mips/eCos" is examined on Ultimodule.
 
   $ mipsel-elf-gdb /kaffe/kaffe/kaffe_bin
 
   (gdb) target remote 192.168.0.xxx:9000
   (gdb) load
   (gdb) cont
 
   * if it displayed "Hello Kaffe", the examination is success.
 
 
