chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] Chicken OSless


From: Shawn Rutledge
Subject: Re: [Chicken-users] Chicken OSless
Date: Thu, 1 May 2008 10:41:43 -0700

On Thu, May 1, 2008 at 10:00 AM, John Van Enk <address@hidden> wrote:
> I'm curious whether or not there's been work on running Chicken's binaries
> on a OSless piece of hardware. I've been trying to convince my boss that it
> would be worth while investigating dynamic languages for embedded systems.

I never tried but wondered about it too.

I was thinking it would be very hard to use Scheme on a
Harvard-architecture chip like an Atmel.  There could be an
interpreter, but anything new you define would have to go in SRAM (all
4K of it, in the case of the ATmega's).  You cannot execute machine
instructions out of SRAM, and you cannot write new instructions to the
Flash at runtime, so the only choice would be to interpret some kind
of VM instructions that are stored in SRAM, or interpret Scheme
directly, or some kind of tokenized representation.  And what about
having a combined RAM/ROM symbol table?  The approach for handling
them would be completely different between the two, but you would want
them to appear to work the same.  But it might just barely be possible
if all the libraries you could possibly want are precompiled and
stored in Flash, and only a small script is executed out of SRAM at
runtime.  Seems insane anyway, though.

On an ARM with enough RAM it would be OK though.  You could start with
TinyScheme; it's so small and simple (purely an interpreter) and the
code is relatively easy to read.

Compiling on a system without an OS would be rather challenging.  :-)
If you had a direct Scheme-to-Arm compiler (like Chez) it might make
more sense.  It would probably be faster and save memory to compile
first and then throw away the source code, rather than interpreting at
all.

But I'm thinking of the use case where the embedded system is on a
network and you connect and feed it some S-expressions to evaluate.
For a standalone fixed-purpose system though, if you can compile the
whole program ahead of time, there are big chunks of implementation
that you don't need anymore, right?  It's just static (unchanging)
machine code being executed, like any other microcontroller program
except less efficient. :-)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]