Rethinking C++ for embedded systems design -

Rethinking C++ for embedded systems design


This week's Tech Focus newsletter leads off with the a two-part article titled “C++14 in Embedded Systems – Myth and Reality,” by Dominic Herity. In it he extensively updates an article he originally wrote for Embedded Systems Design Magazine in 1998.

Although C++ is much criticized by C developers, Herity writes, the language has gone through at least three major revisions since then, many of them incorporating features that make it easier to transition from C to C++ or even use them both in the same software application. While there are numerous resources available for learning more about C++, Dominic's article is about the best I have seen because it zeros in on those features that embedded developers will find most useful.

“In small embedded systems, the suspicion lingers that C++ is somehow unsuitable for use,” he writes. “For 8- and 16-bit processors lacking a C++ compiler, that may be an issue, but there are now 32-bit microcontrollers available for under a dollar supported by mature C++ compilers.”

To dispel any concerns that remain, Dominc has made an effort to provide a detailed understanding of what C++ code does at the machine code level, so that readers can evaluate for themselves the speed and size of C++ code as naturally as they do for C code.

He gets down into the nuts and bolts of C++ code generation, discussing the major features of the language and how they are implemented in practice. What I found most useful was inclusion of C++ code snippets, followed by the equivalent (or near equivalent) C code, with each discussion of a feature in this much maligned programming language.

To compliment Dominic's excellent article, included in this week's Tech Focus newsletter are a range of design articles on the use of C++ in various embedded design environments. Of these my Editor's Top Picks are:

Dive in to C++ and survive
Christopher White guides you through the hazards of learning the ins and outs of the C++ language, the books to read, the tools to use and how to begin using it effectively in your embedded systems designs.

Using C++ as an alternative to C in embedded designs
In this two part tutorial, Colin Walls addresses the well-known barriers to use of C++ by C programmers, and provides some guidelines. He also discusses an in-between alternative he calls “C+.”

Making the transition from C to C++
Although it has taken almost a decade, the transition from C to C++ is now gaining momentum in many complex embedded software projects. Here’s a three step strategy for making the transition and migrating code from C to C++.

Another resource that embedded developers can refer to on C++ in general and its use with C is Dan Saks blog “Programming Pointers.” It is an invaluable resource that any serious C/C++ programmer should include in the browser favorites list. I find it a useful place for a good grounding in any number of topics common to both languages. More importantly, his blogs provide me with insight into the habits of thought that any software programmer needs to develop and hone.

Finally if you are the sort who wants to test drive a vehicle before buying it, go to ARM's mbed online software development platform. Detailed in “ARM design using the mbed Integrated Development Environment,” it is totally written in C++ with the specific purpose of generating C code for Cortex-M core-based designs. Site Editor Bernard Cole is also editor of the twice-a-week newsletters as well as a partner in the TechRite Associates editorial services consultancy. If you want to see a calendar of topics for the weekly Tech Focus newsletter or have a topic you would like to see covered, he welcomes your feedback. Send an email to , or call 928-525-9087.

See more articles and column like this one on up for s ubscriptions and newsletters . Copyright © 2015 UBM–All rights reserved.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.