Constraints
- The platform is an embedded one, normally with no direct interface with a human being.
- The script engine needs to be written in C or easily portable to C because the platform only has a C compiler.
- Program memory is relatively abundant, we can easily afford up to 100k of additional code.
- Data memory is more of a problem, the platform has 2Mbyte of RAM, however the processor only has a 64k data memory map. Currently 32k of that memory space is permanently mapped to RAM, 16k is used for mapping various bits of hardware directly into memory and 16k is used to page the rest of RAM and FLASH into the data space as required.
- The processor is not terribly powerful so the scripting language needs to be not too intensive.
- The EEPROM used for storing configuration is only 8k and only about 6k of that is available for storing scripts in.
Desirables and Requirements
- The script engine should not make excessive use of the heap. The heap consists of the 32k of permanently mapped space minus all the data that is already used in that space for static variables and task stacks. This is currently about 20k but is going down slowly.
- The script engine should only run when permitted to allow all the scripts data to be placed into a page 16k data segment.
- The scripts should be compilable to p-code externally to reduce their size for storage on the platform.
- The script language must be extensible via additional function or additional objects to allow us to create the interface to interact with the hardware platform.
My thoughts so far
It would be nice to have an already well defined language rather than trying to write my own.
Java - while I have seen the Java VM ported very successfully to various embedded platforms it has normally been to platforms that are less constrained resource wise (plenty of RAM, FLASH and processing power) and particularly do not have the heap constraints of this platform. Also we are not talking about writing major applications on this platform and it feels like a bit of a sledge hammer to crack a nut.
Python - this was my first thought, however I am not sure that it's scripts are compilable to p-code and given the use of indentation to denote script structure the scripts could end up quite big and so not fit in available memory. However reading the available documentation there has clearly already been some thought to embedding this into applications.
There are various other scripting languages available, for instance Pawn (http://www.compuphase.com/pawn/pawn.htm) but I do not know too much about them.
So now is the time for you input, what are you thoughts, comments and suggestions (or questions if something about this is unclear) on find/using/embedding a scripting language into an embedded application?