Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is a good scripting language for a small embedded system? [closed]

Tags:

I am looking for a scripting language that can be included in an embedded system to allow the user to pre-configure the unit behaviour based on the system events (I/O port changes, time events...). The sort of control required is

if (some_event) {      do some stuff     delay N seconds     do more stuff     if (some condition)     {         do something     }     else     {         delay until condition         do something else     } } 

Each of the "do stuff" parts of the would typically be to change the state of the IO or to allow/disallow the processing of one or more events.

There is no requirement for text processing or file handling unless it is required internally by the scripting language implementation.

The processor that I am using has some 8K of RAM and 20K of program store available after the normal operating code has been built. The firmware is written in C, so any source for the scripting language must also be in C.

like image 991
uɐɪ Avatar asked Jul 20 '11 09:07

uɐɪ


People also ask

Which language is best for embedded systems?

For many embedded systems, C or C++ will be the best choices. In part, that's because they are “compiled” languages and extremely efficient. In compiled languages, the machine (or embedded device) directly translates the code, which means the language is fast and stable.

Which scripting language is best?

The Best Scripting Languages To KnowPHP: PHP is an open-source scripting language that is frequently used in back-end web development. Python: Python is known for its concise syntax. It requires less typing than many other languages. Ruby: Ruby is one of the easiest scripting languages to learn.

What is embedded scripting language?

An embedded scripting language would be a scripting language (or more specifically an interpreter for such a language) that can be embedded into applications. Thus, the interpreter has an API that can be used to integrate it into the application, allowing scripts to control all or parts of the application.

What are 2 types of scripting language?

Types of scripting languages There are two main categories of scripting languages: server-side and client-side scripting languages. Programmers use languages like Perl, Ruby, PHP and Python to create scripts that run on a server that provides functionality to a web page or application.


2 Answers

We use Squirrel for this job. It is similar to Lua, but reference counted instead of garbage collected, so it tends to work better in very tight memory. On the downside, its community is much smaller.

I have also seen Lisp embedded successfully, particularly a Scheme-like derivative.

See also this other StackOverflow question: What are the available interactive languages that run in tiny memory?

like image 183
Crashworks Avatar answered Oct 08 '22 09:10

Crashworks


Lua is my first choice as an embedded language. It's written in C, easy to expose your own functions to Lua, and by the looks of it some work has been done to get it working on embedded systems.

like image 41
Jeff Foster Avatar answered Oct 08 '22 09:10

Jeff Foster