Thinkstock
Electronicdesign 20918 Websitedevelopment 832109622 0

Is C the Best Embedded Programming Language?

Feb. 27, 2018
C is still the dominant language for embedded programming—but these days, it has lots of company.

Mention embedded programming and most will automatically think of C. But while it’s still the dominant language for the space, these days C has lots of company. The Internet of Things (IoT) is one of many factors that have brought languages like Python and Javascript to the embedded realm. These days, projects may encompass a range of languages running on platforms, ranging from embedded micros to Java apps running on a smartphone.

Exposure to multiple languages can be useful, but does the language matter?

I started my programming career in high school where I learned BASIC on a time-sharing system via a Teletype machine complete with a paper tape punch and reader. I also picked up a rudimentary assembler for a simple virtual machine. I wound up working on COBOL and FORTRAN compilers that were written in BASIC because that is all the time-sharing system exposed. This was the start of my interest in programming languages. Over the years, I have used everything from APL, Algol, and ADA to Lisp, LabVIEW, and Visual Basic. C and Java are also in the mix.

Having a wide choice of programming languages has often been the norm for mainframes, minicomputers, and microprocessors that were targeting businesses, although there was often a dominant or preferred language. Microcontrollers used to come only with macro assemblers, but these days C (and possibly C++) is the minimum provided by chip vendors. Unique processor architectures tended to limit tool support, but these days ARM and x86 platforms are providing language developers with fewer architectures to support while increasing the number of targets.

Another aspect for embedded development is the increase in processor performance, the amount of memory available and standardization on 32- and 64-bit platforms. This allows languages like Java, Lua, or Python to be used in deeply embedded systems.

The definition of “deeply embedded” is often where arguments about language suitability begin, because embedded applications covers a lot of ground these days—from motor control to IoT gateways to process control systems. Real-time systems with tight timing requirements may limit languages that can be used, but developers typically have more choices than just C (even for bare metal applications).

Applications that use Linux have almost any programming language available in one form or another. At that point, does the programming language matter?

Another way of looking at this is to ask whether C should be the language of choice or another language should be used. For example, would Python be more useful because of the power it gives developers compared to C? Many will point to C++ because of its compatibility with C, but C++ should really be considered with other languages like Java, Python, and Ada because it shares functionality with this class of languages. It is possible to use C++ as a better C, but that doesn’t utilize the former to its full advantage.

Of course, other considerations often have more impact on which programming languages might be used for a particular application. For example, the use of deep neural networks (DNNs) is increasing. Python is one language that has become popular in this space. It may be advantageous to use Python if it provides better support for a DNN framework and can meet the rest of an application’s needs.

C is still the language of choice for many embedded applications, but that is often due to inertia rather than being an optimal (or even preferable) choice. Issues such as maintainability, software reuse, and project size should be considered along with the ability to create reliable and secure code.

Embedded programmers are being tasked to use and manipulate more complex data using more communication than ever. Security, reliability, and maintainability are now critical aspects of a design. C can and is being used, but it is far from ideal.

Sponsored Recommendations

What are the Important Considerations when Assessing Cobot Safety?

April 16, 2024
A review of the requirements of ISO/TS 15066 and how they fit in with ISO 10218-1 and 10218-2 a consideration the complexities of collaboration.

Wire & Cable Cutting Digi-Spool® Service

April 16, 2024
Explore DigiKey’s Digi-Spool® professional cutting service for efficient and precise wire and cable management. Custom-cut to your exact specifications for a variety of cable ...

DigiKey Factory Tomorrow Season 3: Sustainable Manufacturing

April 16, 2024
Industry 4.0 is helping manufacturers develop and integrate technologies such as AI, edge computing and connectivity for the factories of tomorrow. Learn more at DigiKey today...

Connectivity – The Backbone of Sustainable Automation

April 16, 2024
Advanced interfaces for signals, data, and electrical power are essential. They help save resources and costs when networking production equipment.

Comments

To join the conversation, and become an exclusive member of Electronic Design, create an account today!