Re: C interpreters for devices with embedded software

Dave.Dunfield@use.address.from.sig (Dave Dunfield)
23 May 2002 01:23:24 -0400

          From comp.compilers

Related articles
C interpreters for devices with embedded software M.Polak@adbglobal.com (Michal Polak) (2002-05-17)
Re: C interpreters for devices with embedded software Dave.Dunfield@use.address.from.sig (2002-05-23)
Re: C interpreters for devices with embedded software adamo@dblab.ece.ntua.gr (Yiorgos Adamopoulos) (2002-05-23)
Re: C interpreters for devices with embedded software mwdeeds@yahoo.com (2002-05-27)
| List of all articles for this month |

From: Dave.Dunfield@use.address.from.sig (Dave Dunfield)
Newsgroups: comp.compilers
Date: 23 May 2002 01:23:24 -0400
Organization: Dunfield Development Systems
References: 02-05-079
Keywords: interpreter
Posted-Date: 23 May 2002 01:23:24 EDT

>I am thinking of doing a port of an embeddable C interpreter and link
>it with an embedded software running on a device. The main aim to is
>be able to carry out tests of the embedded software. The C programming
>language would be the most preferable. The C "scripts" would be
>uploaded onto the device with embedded software through e.g. a serial
>port.


>Have ever anybody dealt with such a task? In particular, I mean about
>the C interpreters that seems to be most suitable for these needs
>(easy to port, small memory requirements, etc).


>[Why do you want C to be your scripting language? It's not a wonderful
>candidate for an interpreter. -John]


John's right that C is not a "wonderful candidate" for an interpreter,
especially if small size and simplicity are a goal.


Depending on your requirements, an approach I've used for scripting in
several small systems may work for you.


I designed a tiny "virtual machine" with an instruction set highly
suited to be a target of my compiler. I then ported a code generator
for the compiler which outputs code for the VM.


On most small CPU's the VM interpreter is about 1k in size, and
provides all the run-time benefits of an interpreter such as the
ability to control, limit and/or translate accesses to various memory
blocks, devices etc. I use a concept of virtual I/O devices to
communicate between the virtual machine and whatever system it has
been integrated into.


It won't work for you if you need to use "text stripts", ie: you want to
connect via a TTY connection and enter your program like you
would into a BASIC intepreter. Using the VM approach, the "scripts"
you load into the system are small binary format "programs".


For more information on my implementation, lookup "C-FLEA" on
my site.


Regards,


--
dave@ Dunfield Development Systems http://www.dunfield.com
dunfield. Low cost software development tools for embedded systems
com Software/firmware development services Fax:613-256-5821


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.