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

Preliminar GCC 3 support for E.R.I.K.A.



Riccardo Vestrini

Introduction

Compiling of programs for ERIKA Educational has been done with gcc 2.95 but newest versions of gcc include a better support of hitachi H8 platform, particulary floating-point type and standard C library.

Floating-point data types

Using gcc 3 let you define and use double and float variables, libgcc3 contains code to emulate floating-point operations on top of hardware integer 16-bit operations.
Note that this makes the use of ERIKA H8 fixed point math library no longer necessary, thought still usable.

Standard C library

Newlib (http://sources.redhat.com/newlib/) is a C library intended for use on embedded systems. It is a conglomeration of several library parts, all under free software licenses that make them easily usable on embedded products.
This library is distributed by RedHat inc. and can be used with gcc 3 instead of glibc, this way you can use libc functions in ERIKA programs without using too much ROM code.
Most importantly you can easily use standard math functions.
To obtain this, you have simply to download Newlib source code and rebuild gcc 3 configuring Newlib support.

How to build gcc 3

A good tutorial about how to build gcc 3 for H8 can be found at http://www.skyfree.org/linux/embedding/h8-cross.html (local copy here); some Linux distributions can distribute already-built packages or provide tools to ease the installation (for example: with Debian GNU/Linux you may use toolchain-source-newlib package). Althought only gcc-3.2 was tested newer versions of gcc should be usable too, so if possible use the newest version available. Some informations about Debian users are also available here.

How to use it with ERIKA

Current ERIKA makefile assume you are using gcc 2.95, if you want to use gcc 3 you can use __GCC3__ option, this way you will switch to a modified makefile; Newlib support is enabled by default, if you do not wont it you cand use __NO_NEWLIB__ option.

Configuration

New makefile requires some configuration to work, look at h8cfg3.mak file in $ERIKABASE/config directory and follows comments in source code.

Limitations

Gcc 3 should have been tested with existing ERIKA programs but it have not, so watch out for compiletime and runtime errors with existing applications; newly-developed applications should have no problems, gcc 3 is better.
The biggest limitations is that no stop-and-resume is supported (like having __NO_ROM_DATA__ always set), this will be soon fixed, we hope.

New makefile interface

To ease the linking of addictional libraries to ERIKA applications gcc 3 makefile reads INCLUDE and LIBRARY_PATH variables to search for include files and libraries; libraries to be included can be specified defining LIBS variable (for example: LIBS=mylib rsa will link libmylib and librsa with the application); pay attention if you have these variables defined for other uses.