C++ Embedded systems learning

Hello all,

Going to try looking at using Modern C++ with embedded systems and wondered if anyone here recommended a(any) good book(s)on the topic or on-line resources that would contain not only proper usage of the Standard Library but also good instruction of how to code for embedded systems (what to do and what NOT to do) especially for time critical applications, space limitations, type security, etc.

I figure that this sub-set application of C++ must probably have its own nuances of how to go about correctly programming processors as well as accessing peripherals, memory, etc.

If you also recommend starting with a specific group of processors or application boards first and then graduating to full ARM architecture type boards - I'm open to those kind of recommendations too.

Any ideas?

Xanadu
I would recommend https://www.edx.org/ . I've looked up books and was unsuccessful so I looked outside the scope of c++ and found there lots of Arduino books.
modern c++ is not always supported. Be sure you understand procedural (non OOP) style, pointers, and possibly even have a grounding in C. Many devices have "C-like" or "c++ like" languages that you can more or less what you are used to, but may lack unexpected things (like cout or vector!). You will see this as you get into it; maybe you already have.
"Embedded" is a catch all phrase. The original Android OS, before Google bought it, was for controlling a camera, and that's an embedded application.

Indeed, smart phone development is, technically, embedded development. Even if you intend to control a robot, that can be done using a phone or tablet as the "computer", using an interface like BlueTooth or WiFi to communicate to the device powering motors and reading sensors.

The smaller the device (RAM in particular), the more likely the language is restricted.

With the present cost of the various chips, and their power efficiency profiles, I can hardly see why one would need to squeeze software into a 16K machine, but it is still done. I suppose when mass fabricated a few K shaves a penny.

That said, there are some full C++ suites and libraries that are broadly applicable to robotics. I can't say I have tried these two, or endorse them, just that they are among the things I find when first attempting to locate something to work with:

https://pros.cs.purdue.edu/

https://www.roboticslibrary.org/

Arduino is popular. The development suite presents the "Arduino way" of doing things, where, in contrast to standard C++, you don't start with a "main" function - but there is a way of taking more control where you DO write your own "main", and thus have more features.

Arduino's popularity is support and packaging. From zero to functional result, it is well put together. It is also somewhat limited, but a good starting point.

"Embedded" could be a hard disk controller (SSD or HDD), a cash register, the computer controlling a car, a full and complex robot, a watch, a microwave oven.....

What embedded targets do you have in mind? Some use full C++ using any modern compiler and a library, some insist on their own language subset and their own IDE.
With the present cost of the various chips, and their power efficiency profiles, I can hardly see why one would need to squeeze software into a 16K machine, but it is still done. I suppose when mass fabricated a few K shaves a penny.


Its a combination of cost, power draw, size and weight, certifications, power creep, and other factors. Less so now, as you noted, but when you have complex systems on battery platforms, it adds up, and batteries, good as they are now, also are a weight issue. Power creep is the funny one. Now that a single cell phone can do what 10 pounds of gizmos did in the mid 90s, … the customers now want 50 times the capability or 1/100th the size or both

think about those palm sized and smaller robots that are or were the craze a few years back... the flying ones can't carry a cell phone around...
Last edited on
Thank you gentlemen,

RJ, I will go to that site and check it out.

My background STARTED in strict "C" and I have since migrated to C++ so I sort of know both - I know C better but am currently increasing my C++ skills to match the previous C skills!

I agree with all of you that this seems to be a very "quirky" and specialized field. I have programed robots using VmWare back in the 90's (it is totally different now probably!! ) and I have also programmed full projects using Arduino's and similar embedded systems.

I do agree with Jonnin that because of space, and power economy and features people keep asking more for less..... making this all very difficult.

Since I'm an engineer interfacing with hardware and controlling "things" is naturally where I will end up so I figured at least exploring where C++ is for embedded is worth it.

I know that it can be anything from the whole C++ implementation with the STL all the way down to very restrictive portions of the language due to space, memory and also the size of the data (Heard Bjarne say that you're pretty much wasting your time if you attempt to use it in anything below 8-bit processors?? but it has been done)

The roboticslibrary that Niccolo brought up I have heard of before but have NO experience with whatsoever. Now, I have seen that NVidia makes a very compact (Raspberry Pi size? or slightly bigger?) processor and dev board which I believe can take the whole language and there are libraries available for it (roboticslibrary may be one!!) for many robotics functions like vision, movement, navigation, neural networks, etc.

It would seem that a lot of universities and even some commercial users have latched onto these boards and processors and have made some really cool and very sophisticated robots.

Xanadu
Topic archived. No new replies allowed.