Global Sources
EE Times-Asia
Stay in touch with EE Times Asia
EE Times-Asia > Embedded

Exploring various embedded programming languages

Posted: 25 Sep 2014 ?? ?Print Version ?Bookmark and Share

Keywords:C? embedded applications? object oriented programming? Java? JavaScript?

JavaScript was originally intended as a means to give programmatic capabilities to web pages, and it is now almost ubiquitous. Any modern-style web page uses JavaScript. It has been called the "Assembly Language of the Web" (presumably by someone who was unfamiliar with assembly programming). Furthermore, JavaScript is at the heart of HTML 5, which is gaining widespread adoption.

The source code is included in a web page definition. This is executed by means of a highly optimised just-in-time compiler built into the browser. Amazingly complex web applications have been implemented in JavaScript. In the embedded systems context, JavaScript is particularly interesting for cross-platform application development and the definition of user interfaces.

An example of JavaScript code that has been embedded in an HTML file is shown below.

Another language that first appeared in the early 1990sPythonwas created by Guido van Rossum. It is thought of as a scripting language, but it is powerful enough for much more sophisticated programming applications.

Python borrows some syntactic elements from C but is less C-like than the other languages discussed above. In particular, white space is significant to program structure, which tends to lead to more intrinsically readable code.

Below we see an example of Python code.

The language is broadly object oriented (everything is an object), but it also supports procedural and functional programming styles. Typing is strong but dynamic, with support for lists, dictionaries, etc. The language is interpretedthe source is compiled to bytecodes (like Java)and executed by a virtual machine.

The Pythonic philosophy is as follows:

???Beautiful is better than ugly.
???Explicit is better than implicit.
???Simple is better than complex.
???Complex is better than complicated.
???Readability counts.
Python has been widely used in embedded applications and has many more potential uses where its unique style is beneficial. The implementation is readily portable, so the language can be used just about anywhere. Not so long ago, the developers of the low-cost, single-board Raspberry Pi computer selected Python as its primary programming language.

Conclusions and acknowledgements
It is easy to think of the embedded programming language as being C (along with C++), with a smattering of assembly language. However, there are other options where particular programming requirements demand a specific solution. It is interesting that the core C syntax, though often criticised, forms the basis for many other more recent languages.

I gratefully acknowledge the invaluable assistance I received with the planning and writing of this article from Clive Maxfield and the other Design West presenters/authors: Duane Benson, David Beberman, and Mark Guagenti.

About the author
Colin Walls has over thirty years experience in the electronics industry, largely dedicated to embedded software. A frequent presenter at conferences and seminars and author of numerous technical articles and two books on embedded software, Colin is an embedded software technologist with Mentor Embedded [the Mentor Graphics Embedded Software Division], and is based in the UK.

To download the PDF version of this article, click here.

?First Page?Previous Page 1???2???3???4

Article Comments - Exploring various embedded programmi...
*? You can enter [0] more charecters.
*Verify code:


Visit Asia Webinars to learn about the latest in technology and get practical design tips.

Back to Top