C++ embedded

Hi all,

I'm about to start moving to the filed of embedded C++. I've got good experience in C++ and also some other tools like Qt and QML and stuff near these. Embedded programming is new for me so I'm not sure where to start.
My purpose is C++ embedded programming.

Now should I read a whole book in this area? Or could a tut be well for now?
Do I also need a hardware device for testing?

Thanks in advance for your guidance
Most embedded programming involves a device, and quite often development software and their own compiler implementing a limited portion of the C or C++ language.

It depends on the embedded platform.

Some support full C++ from gcc (some with CLang).

You have to pick a device first.

The device could be Arduino, Raspberry Pi.

Technically, developing software for phones is "embedded", which generally involves some platform specific language (Swift or Objective C for Apple, Java or Kotlin for Android), along with full C/C++ in the mix.

If you know C++, you probably just need to get the device, a development platform comes with it, and you walk through their introductions.
I think those are good choices. I am electrical engineer and we studied embedded systems (HW/SW - hardware/software). The first thing I would recommend is a bread board kit.
Thank you.
Should I necessarily pick a real device or can I stick to a simulator, instead? Which one is better?

And if I need a real device, OK. But what to do with that?
For instance, Raspberry Pi 3 is a small computer and can be used for installing many operating systems. It's also very well-known and probably used widely even for Qt. Suppose we have a Raspberry Pi 3 device, the mouse and keyboard USBs are connected to it and we attach that to a monitor and install its Raspberry Linux-based OS on its SD card. Then we boot it and even connect to it by SSH through another machine. So up to now, we have a small Linux machine on that Raspberry Pi 3 device that we can connect with via a program like Putty, for example. But what're the advantages of this? I already have both Linux and Windows machines on my real PC! :(

What I have in mind about embedded programming is to firstly create a C++/Qt code on an IDE (specific for C++/Qt embedded programming, probably, not usual IDEs like: Visual Studio or Qt Creator), and then put the output of the code, the executable file, into the real device, weather it's a programmable section of an automobile or an industry device.

Am I wrong, please?
Last edited on
@frek,

The question you seem to be dancing around is "What is the definition of an embedded platform?" The answer is, "It depends."

What makes an embedded platform embedded? Definitions I've heard over the years are absence of an operating system, no direct user interface, small memory, lack of a file system, need to cross-compile, etc.

While some of these characteristics a true for some "embedded" systems, none are universal, and none are exclusive to "embedded" systems. While an Arduino may look different than a non-embedded system, a Raspberry Pi may not. Where do you draw the line?

There just isn't a whole lot of difference between embedded programming and non-embedded programming. Most of the embedded systems I work on have complete Linux kernels, so there ain't a lot they cannot do vis-a-vis a non-embedded system.

So, I would figure out what project you want to work on, then determine what device make sense, and then learn that. Trying to learn "embedded" programming doesn't make as much sense as you might think.
Thank you.
Should I necessarily pick a real device or can I stick to a simulator, instead? Which one is better?

Simulator is better. Some chips and hardware can be fried if you screw up (plug the power wire into the data input kinds of things). And simulators are often free/cheap (given so you will WANT to buy 10000000000 copies of their hardware when you produce your product). Hardware is messy (physical stuff all around your machine) and can be fried and costs money (some of it is rather steep, other things are quite cheap, it varies, but you don't want to have to buy a PI just to discover you don't want to build your system on a PI because of X reason).

If you want to make something with a GUI, you can code that on your PC most likely. Its the little stuff that gets weird, not the computer-like systems. Its different to program a flat DSP chip (no screen, no os, nothing but wires in and out and a tool to dump the program to it) vs a tablet PC.

Last edited on
@doug4
I know it's a rather vague and too broad question, but I really need to start from some point.

I don't have any real project on hands for the time being; what I actually want is to be able to program devices that are mostly/commonly installed into an automobile or some industry device like a machine controller, etc, because they're highly demanded these days and I know C++ so like to use it for these areas.

I guess I should start with basics, something common that I can take advantages of it afterwards in the areas I mentioned.

The tools I nearly certainly will make use are C++ with/without Qt (depending on the target device) and Raspberry Pi 3.

So I guess I must know:
1- How to use C++/Qt for embedded programming? To see how different it's from code I write on Visual Studio or Qt Creator.
2- What IDE should I use to create programs and on what operating system?
3- How to create programs for different embedded devices?
4- How does Raspberry Pi 3 help me in the tasks?

@jonnin

I really don't know what embedded target device I will work on first whether it's GUI based or not. Probably both.
Do you still, by reading the statements above, believe it's better to use a simulator? If so, what simulator do you suggest to me, please?
Honestly i have the feeling that when you say "embedded" you actually need "bare metal programming". Google it, i might have given you a search keyword you was unknowingly needing..
I really don't know what embedded target device I will work on first whether it's GUI based or not. Probably both.
Do you still, by reading the statements above, believe it's better to use a simulator? If so, what simulator do you suggest to me, please?

1) it should be the same; systems that support QT are big systems and are pc-like in most respects.
2) whatever you like for c++. If you get into special embedded systems, they will give you a compiler or it may be free online etc.
3) down in the simple non pc-like devices, you just have to read the manual and use their tools. There isnt a one size fits all answer. Just be well rounded enough in {assembly like, C like, c++ like} coding to adapt to the task at hand. These tools usually have great resources, forums for that device, examples and guides, ... you can literally cut and paste your way to glory here for most tasks. If you do something weird, then you have to get into it deeper.
4) honestly, I thought the PI was a computer, not an embedded device. Its a popular platform and a good starting point, but its going to be awfully similar to just coding on PC.

for the last bit..
1) Pick something.
2) get the simulator and documents and examples for it
3) run the examples, start figuring stuff out
4) make it do something new
5) consider buying a physical one and build something with it

you will laugh but to get started, another way, is to get one of those kiddy sets (lego, others have) that have programmable motors and such. They can do a fair amount these days, and while its overly simplified, it gets a lot of concepts across.
Last edited on
Great answer jonnin, thanks. :)

1- So when picking a device to program on its micro-controller(s), we must be careful what it can do as the output of the micro-controller(s) (for example, it's moving, turning on/off some LEDs, etc) because this is the range of our ability to change these behaviors by programming. right?

2- And the majority of micro-controller(s) types in industry are: 8051, AVR, PIC and ARM. And some of them run an OS (Linux, Android or VmWorks) and the rest don't have an OS but only a sysroot. Right?

3- And for programming the device, we must find a way to connect to its micro-controller(s) and then either directly run the program on it (using a Linux PC, for instance), or transfer the created executable file on it and then run that directly there. True?
Last edited on
Topic archived. No new replies allowed.