Thinkstock
Embedded programming

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.

About the Author

William G. Wong | Senior Content Director - Electronic Design and Microwaves & RF

I am Editor of Electronic Design focusing on embedded, software, and systems. As Senior Content Director, I also manage Microwaves & RF and I work with a great team of editors to provide engineers, programmers, developers and technical managers with interesting and useful articles and videos on a regular basis. Check out our free newsletters to see the latest content.

You can send press releases for new products for possible coverage on the website. I am also interested in receiving contributed articles for publishing on our website. Use our template and send to me along with a signed release form. 

Check out my blog, AltEmbedded on Electronic Design, as well as his latest articles on this site that are listed below. 

You can visit my social media via these links:

I earned a Bachelor of Electrical Engineering at the Georgia Institute of Technology and a Masters in Computer Science from Rutgers University. I still do a bit of programming using everything from C and C++ to Rust and Ada/SPARK. I do a bit of PHP programming for Drupal websites. I have posted a few Drupal modules.  

I still get a hand on software and electronic hardware. Some of this can be found on our Kit Close-Up video series. You can also see me on many of our TechXchange Talk videos. I am interested in a range of projects from robotics to artificial intelligence. 

Sponsored Recommendations

Comments

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