Subject: Re: Free Software in Embedded Systems (was Re: Studies)
From: Kragen Sitaker <kragen@dnaco.net>
Date: Tue, 16 Sep 1997 08:13:26 -0400 (EDT)

On Mon, 15 Sep 1997, Niels P. Mayer wrote:
> James Horton <horton@cft.net>:
> > I agree, even more so for Embedded Systems.
> 
> Speaking of embedded systems, I've been chartered to investigate using
> Java as a glue language to support custom-programmed applications in
> point of sale terminals. Anybody else thinking about embedded java?
> Anybody using some kind of "free" Java VM not subject to Sun's
> licensing ridiculousness?

Kaffe is a free-software JIT-JVM; see www.kaffe.org.  I can't vouch for
its quality or maturity.

> Michael Tiemann <tiemann@cygnus.com>:
> > I've heard the same thing.  In fact, we're going to be supporting Linux
> > as a standard host platform for embedded development in our next
> > release, and a number of our F500 companies are very happy about that.

I'm glad to hear it.  Are you going to support Linux for any other
purposes?  Are you going to support particular distributions, and if so,
which ones?

> Biggest issue in embedded systems is the footprint -- could you fit,
> say, a tiny embedded JAVA VM, a custom point-of-sale application
> (including special smart-card interfaces), and a 
> multitalking/multithreaded RTOS into 500k to 1Mbyte?

Pygmy Forth has a tiny embedded Forth VM, an interface to the MS-DOS
filesystem and video BIOS calls, and a cooperative multitasking,
multithreaded OS in (if I remember correctly) 16K.  It also includes a
WYSIWYG editor, Forth compiler (including a metacompiler, so it can be
used to compile itself), assembler, etc, all inside that 16K.  I suspect
it's probably possible to write all these things, plus a Java VM, inside
50K-100K or so.  The standard class libraries would add a significant
amount of space if you included them. 

Pygmy Forth is available, with full source and documentation, from
<ftp://ftp.forth.org/pub/Forth/Pygmy/pygmy14.exe>, which is a zipfile.  It
runs under MS-DOS in real mode.

The source is 3072 lines, in the traditional Forth fixed-width
64-char-per-line, no-newline format.

A similar Forth VM, pfe, is written in portable ANSI C, with termcap, and
is 93,144 bytes on my Linux box.  It doesn't include multitasking.  It is
available from <ftp://ftp.forth.org/pub/Forth/ANS/>, which has several
versions online.

There are probably disadvantages to Forth.  Notably, it's not C, or
C-like, or even Algol-like.  It's not type-safe -- typically, there are no
types.  It's hard to read if you're used to Algol-like languages --
although, if you want, you could certainly write Forth words that would
look like Algol when you used them.  Dynamic memory allocation is seldom
used.  Native-code Forth compilers don't generally optimize much --
although this is not as big of a problem as it would be in Algol-like
languages. 

Probably the biggest disadvantage is a perceptual one -- there are lots of
poor-quality Forths and a few good ones, and if you start with one of the
poor-quality ones, you may get turned off.  Forth, Inc., offers some
excellent ones.

Kragen