Sep 04, 2019 Aerospace and Defense

VxWorks Now Has a Pet Snake

By Michel Chabroux

I guess this was an easy one: Snake… Python… Hmmm…

Part 1

Just to make sure, the Python I am referring to is the simple and easy to learn programming language with the nice blue/yellow logo.

Because of my role, I have the privilege to meet our customers across all industries and geographies to discuss many things:

  • Basic things such as drivers and board support
  • Dramatic things such as security vulnerabilities
  • Visionary things such as ******** and ***********
  • Or exciting things such as Python

Yes: Python is exciting. While my personal view did not come into play when I pulled the trigger on this investment, I do like Python a lot. I discovered it with Blender years ago and wrote my first Python program to export a scene so I could process it in my raytracer, getting my first cooler than a cube image:

Back to our topic: Python. We are very excited to introduce Python to the world of VxWorks.  Until now, our customers were limited to writing their embedded code in assembler, C or C++. Even if we recently added full support for C++17 and Boost 1.70.0 (a first for an RTOS), Python really takes it to the next level.

Motivation

Our edge – which I like to call electro-mechanical, is changing. It is getting broader. Our silicon partners are delivering SoCs that are more powerful and our customers want to do more with them on the IIoT devices they build. These new features/functions are no longer all real-time centric, yet they still are critical and add a lot of value.

The question then becomes: what is the right framework to deliver on these new features/functions? It is certainly not assembler. C or C++ are good options but not necessarily ideal. While Python is one of the options, let’s take a step back for a moment to understand why.

Recently, StackOverflow conducted a survey of “people who code around the world.” Of all the key results, the first one is:

Python, the fastest-growing major programming language, has risen in the ranks of programming languages in our survey yet again, edging out Java this year and standing as the second most loved language (behind Rust).”

Looking at the data, Python is listed as the fourth most popular languages (although I’d say second as HTML/CSS and SQL do not really qualify as programming languages) and the second most loved language.

That gives us the point of view of the developers and, truth be told, if I were asked to work on a new project, I certainly would feel more excited and empowered being able to use Python over traditional C/C++.

Looking at it now from the IIoT device manufacturer lens, there is now a much larger pool of developers that can be tapped into. Moreover, these developers, thanks to the wealth of information available and the ease with which one can program in Python, will be much more productive much more rapidly.

Simply put: productivity is key and Python is a productivity enabler.

Don’t take my word for it. Major universities have provided Python class for students irrespective of major. Check Carnegie (“Our platform integrates Brython, a powerful in-browser Python interpreter, to allow students to write real Python code from any browser”), MIT, Stanford, UC Berkeley, UCLA, etc.

Python in an IIoT device. Why?

What could one possibly do with Python? I am sure the Internet can provide a great deal of answers to that question. But in embedded devices, I see and have seen a few things including:

  • Running test scripts during developments
  • Creating more or less complex neural networks and inference engines to help with predictive maintenance
  • Solving complex math problems such as auto differentiation (that is what Tensorflow uses to compute the analytical derivative of functions – DuckDuck it)
  • Creating CLIs
  • Etc.

Now let’s see what I can do in Python as I have VxWorks 7 running with Python support.

Let me open an editor, Wind River Workbench or other, create a hello.py file


and run it in VxWorks 7…

That was easy! By the way, it is also possible to use Python in interactive mode…

It obviously isn’t much, especially considering how powerful Python is. How about you try it? Just contact your favorite Wind River associate.

The End?

This is just the beginning.  We are going to continue to bring newer technology into our edge (that electro-mechanical one) to make sure our customers can focus on the best application they can.

Stay tuned…

Previous Linux Reflections from a Wind River Intern
Next Embedded Systems: The Evolution of Embedded System Design