The embedded software language menagerie

In the history of the embedded software industries, for the most part, developers writing software for microcontroller-based systems have had very few software languages to choose from. At the dawn of the computer age, developers were stuck using low-level assembly language that forced them to learn the instruction set for each microcontroller device that they used. While highly effective and efficient, reading, maintaining, or even understanding assembly language was quite difficult and cumbersome.

Between 1969 and 1973, Dennis Ritchie developed the C programming language while working at Bell Labs and forever changed the way that software was developed. The C programming language caught on, and while general-purpose computing systems have moved on to other object-oriented languages, C has been the dominant language to use with microcontrollers for several different reasons. They include the following:

  • It is a high-level programming language that doesn't require developers to understand target-specific assembly language.
  • The ability to access low-level registers and hardware features.
  • The capability to create high-level software abstractions.
  • Cross-platform compilation (write the software once and deploy it to multiple targets).
  • Software that is reusable and portable.

The C language is so popular and successful that it has dominated the embedded software industry as the language of choice for almost half a century. The popularity of C has remained despite major software design paradigm shifts, such as object-oriented design, and new languages being available, such as C++. C fills an important niche that allows developers to efficiently develop software that interacts at the bit and byte levels in the hardware.

While C has been extremely popular among developers, over the past several years, its popularity has been waning for several different reasons. Some of these reasons are listed as follows:

  •  First, the C language has several sticky spots in its specification that can result in developers either getting confused about what the code is doing or that results in different behavior when compiled for a different target. This has caused additional standards such as MISRA-C to be developed, which create a safe subset of C features that developers can use in their software.
  • Second, the C language is no longer taught to university students in many parts of the world. In fact, even C++ is no longer taught at university! Students who want to learn a programming language are often presented with Java or Python as the language of choice, which means that any would-be embedded developers have to learn C on the job. When learning C on the job, the chances are that the developer will not be aware of the gotchas and issues with the C language, resulting in buggy, low-quality code that requires additional time and money to make production-ready.
  • Next, C is a relatively low-level and verbose programming language. It is quite easy to cause incredibly hard-to-find bugs from memory leaks, buffer overflows, or accidentally accessing an array out-of-bounds. Most modern languages provide explicit protection against these issues with features such as memory management and managed pointers (if pointers exist at all!).
  • Finally, most development teams use an object-oriented approach to software development when they develop their software architectures. While good software architecture is language agnostic, it can be much more difficult to write object-oriented code in a language such as C. It's often overlooked that C does provide perfect encapsulation and a mechanism for inheritance, but multiple inheritance and polymorphism are far more complicated and error-prone to pull off.

Because of these reasons, over the last few years, there has been a slow push to begin moving away from using C as the language of choice for embedded applications.

In fact, there has been a small explosion in the number of languages that can be used to develop embedded software. These range from the traditional compiled languages, such as Assembly or C, to C++ or Java, or to even more recent scripting languages such as Python or Squirrel. There are even visual programming languages that allow developers to generate high-level concepts and then generate low-level code such as MATLAB.

Every other year, ASPENCORE performs an embedded industry survey that polls a few thousand developers in the embedded systems industry. In the last survey, in 2019, it was found that only 56% of these projects were developed using the C programming language, while 22% of projects were developed using C++. The remaining 22% was a mix of several other languages, including Python. The complete breakdown can be seen in the following diagram. The menagerie of languages demonstrates how developers are desperately grasping at new languages and techniques that can be used to write their software in a more effective and modern manner. What's interesting is that if you compare these results to the 2017 results, the response for Python has doubled from 3% to 6%. Bear in mind, though, that the responses for C and C++ have stayed exactly the same, so while Python has grown more popular, it is not stealing any market share from C or C++. 

The breakdown of programming languages used for embedded systems in 2019 is shown in the following image:

The preceding pie chart is from a survey done by https://www.embedded.com/. Note that this is for all embedded systems and includes application processors, not just microcontrollers (ASPENCORE Embedded Systems Survey, 2019, www.embedded.com).

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.188.152.162