erika educational
overview
news
download
  what's required
  compiling and using
  gcc3 support
demos
wireless interface
Matlab support
people
related links

Using E.R.I.K.A.

Setting up the Software (for Unix/Linux platforms)

The E.R.I.K.A. Snapshots need the GNU Makefile to compile in the correct way the source code of the project.

Download the last snapshot of the Project, and decompress it on your Hard Disk.

Finally, you need to install the Development Environment for the H8/300 platform.

Building the H8 development environment

First of all you have to get the GCC (Gnu C Compiler) which is generally distribuited as two separate packages: gcc (which is the C/C++ compiler) and binutils (which contains assembler, linker and some other tools). These packages are distribuited from the GNU project ftp server (ftp.gnu.org). To obtain the versions we used to test and develop ERIKA you can click on the links below:

Faster way to install the H8 development environment is to use a script file: click here to see it.
If you decide to use it, you have only to save it in the same directory you have the packages and execute it  with the following command:

      > full_H8_install

Note that it was developed and tested on Linux Red Hat 9.0 system. You can use it at your own risk.... obviously! :-)


If you do not like to use script, in the follow you can see the main steps needed for the installation (for a detailed list of the steps you should look at the script).

Once you get the packages you have to extract them using the tar command:

      > tar xfz binutils-2.11.2.tar.gz

> tar xfz gcc-core-2.95.2.tar.gz

> tar xfz gcc-g++-2.95.2.tar.gz

This will create two subdirectories: binutils-2.11.2 and gcc-2.95.2.

When you have extracted the files, the next thing to do is to compile binutils. This must be done before compiling gcc, since this process depends on binutils being available for the Hitachi architecture, H8/300.
First of all, you have to specify the directory you want the cross-compiler to be installed: 

      > export H8_INSTALL_DIR=$HOME/hitachi

If you want the tools to be installed elsewhere, say /usr/local/hitachi, just specify /usr/local/hitachi instead of  $HOME/hitachi.

Both binutils and gcc needs to be configured for the particular setup; from a Linux system you can use the shell script configure in the way showed below.

      > cd binutils-2.11.2

> ./configure --target=h8300-hitachi-hms --prefix=$H8_INSTALL_DIR

Since we want gcc to work as a cross-compiler, we also need the assembler and the linker to generate code for Hitachi H8/300. This is what the --target=h8300-hitachi-hms option specifies. The option --prefix=$H8_INSTALL_DIR specifies that binutils is to be installed relative to the directory $H8_INSTALL_DIR. This means that executable files are installed in $H8_INSTALL_DIR/bin, libraries in $H8_INSTALL_DIR/lib and documentation and other files in other subdirectories of $H8_INSTALL_DIR

When configure finishes checking the system setup and provided no problems were detected, binutils is now ready to be compiled. This is done using make:
      > make

When the compilation is finished, binutils can be installed, which is accomplished with the make command again:

      > make install

The installation process creates a number of subdirectories of $H8_INSTALL_DIR, and copies the newly built executable files, libraries, documentation and other files to these.

Having installed binutils, gcc can be compiled in a way such this:

      > cd ../gcc-2.95.2

> ./configure --target=h8300-hitachi-hms --prefix=$H8_INSTALL_DIR --with-newlib

For the same reasons as above, target and prefix is specified as shown. The option --with-newlib specifies that gcc should not expect to find a standard C library for the Hitachi H8/300 architecture.

When configure finishes, gcc can be compiled. However, during the compilation, make must be able to access the executable files from binutils, so $H8_INSTALL_DIR/bin should be added to the path. One way to do this is to invoke make as:

      > export PATH=$H8_INSTALL_DIR/bin:$PATH 

> make

When this is done, gcc can be installed:

      > make install

As for binutils, this will install executable files and other files in subdirectories of $H8_INSTALL_DIR.

Compiling E.R.I.K.A.

Once you have downloaded and unzipped E.R.I.K.A. you should be able to compile it (the Snapshots contains a set of tests that can be found under the tests directory under the E.R.I.K.A. tree).

Suppose that E.R.I.K.A. is installed into the /home/abc/erika directory, so you have to set the following environment variables:

     > export ERIKABASE=/home/abc/erika

> export H8BASE=$H8_INSTALL_DIR
Note that you can add the two lines above to your .bash_profile file (such a solution avoid you to set manually these variables through different sessions): in that case you have to substitute $H8_INSTALL_DIR with its value (for example, if $H8_INSTALL_DIR=/local/share/h8 then you can insert a line such this: export H8BASE=/local/share/h8).

Now you can go to a test directory and run make. The Makefile will create another directory called out, where all object files will be put.

If you have any problem, please send a mail to the erika-help mailing list.