Suggestions for an Embbeded Scripting Language

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Banfa
    Recognized Expert Expert
    • Feb 2006
    • 9067

    Suggestions for an Embbeded Scripting Language

    The project I work on has a bespoke hardware platform which is designed to go into a variety of different situations. However to keep things simple we really want the software for the platform to remain the same in all cases (as good practice suggests). One of our thoughts is that to provide the final customisation required for each application we could embed a scripting language into the platform to allow any additional business logic to be applied to the platform in the form of one or more scripts.

    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?
  • JamieHowarth0
    Recognized Expert Contributor
    • May 2007
    • 537

    #2
    Hi Banfa,

    Not a clue - I'm a VB programmer so I only work in high-level... sorry :-$
    However, I would love to learn more about embedded stuff but my skill in C is incredibly rusty and probably just about covers "Hello World"!

    medicineworker

    Comment

    • JosAH
      Recognized Expert MVP
      • Mar 2007
      • 11453

      #3
      I'd say Forth (google for it). A basic Forth implementation has a footprint of just
      a couple of KB and you can extend Forth in Forth itself.

      kind regards,

      Jos

      Comment

      • RedSon
        Recognized Expert Expert
        • Jan 2007
        • 4980

        #4
        Originally posted by JosAH
        I'd say Forth (google for it). A basic Forth implementation has a footprint of just
        a couple of KB and you can extend Forth in Forth itself.

        kind regards,

        Jos
        Check this site out... http://www.embedded.com/story/OEG20021211S0034

        Comment

        Working...