ARM mbed is a poorly conceived framework, barely any better than Arduino.
when I used it in college.
What framework would you suggest for somebody who finds Arduino to be toylike (but so many easy-to-use libraries!) but has found most other microcontroller programming enviroments to be impenetrable at every step of the process?
What framework would you suggest for somebody who finds Arduino to be toylike (but so many easy-to-use libraries!) but has found most other microcontroller programming enviroments to be impenetrable at every step of the process?
Real-time and soft-real time are about provably bounding your execution run time ---- This is a much different statement than saying C++ is slow. C++ is fine, just make sure you are using deterministic features. Eg, no heap. Or only special heaps. Using C doesn't magically make you hard-real time safe.
None. Read the datasheet and write the code. It is not that hard, and gets easier as you go.
- C++ is slow. (real-time, soft-realtime, etc.)
- C++ produces bloated machine code.
- Objects are large.
- Virtual functions are slow.
- Abstraction leads to inefficiency.
I agree mbed and Arduino may be trash, but they are also so much more efficient in the short run. Maybe we should not write our own libraries but improve the public libraries like Arduino and mbed?
Now to my question, did we reach a point where it is advisable for an electrical engineer / embedded software engineer to learn C++? Is C++ the future for embedded?
ARM mbed is a poorly conceived framework, barely any better than Arduino. ARM sells IP, they don't really care about the software. The more generic it is, the less amount of money they need to spend on engineering resources that are not contributing to a bottom line. The more bloated it gets, the more money they get (hey you need a more powerful core to blink that LED).
The problem is that it is very easy to slip if you don't constantly check, especially in a team with different level of expertise.
Note: not all of these arguments are my own, googled before I asked the question.
- C++ is slower. (real-time, soft-realtime, etc.)
- C++ produces more bloated machine code.
- Objects are larger.
- Virtual functions are slower.
- Abstraction leads to runtime inefficiency.
1. The approach to start with a baremetal system and then code everything yourself is fine if you've got 20 engineers and a big budget $$$. What do you do if you're a freelancer, startup? You can't start with preparing your libraries for 2 years before releasing something that also makes money...
2. While I spend 3 weeks coding a driver, getting it to work and ironing out bugs, the mbed or Arduino kiddy just create a fully functional BLE app with LFS filesystem, Ethernet webserver, etc. in the same time
Note: not all of these arguments are my own, googled before I asked the question.
- C++ is slow. (real-time, soft-realtime, etc.)
- C++ produces bloated machine code.
- Objects are large.
- Virtual functions are slow.
- Abstraction leads to inefficiency.
is C++ the future?
nope, the future is C++11 (or C++n*)
1. The approach to start with a baremetal system and then code everything yourself is fine if you've got 20 engineers and a big budget $$$. What do you do if you're a freelancer, startup? You can't start with preparing your libraries for 2 years before releasing something that also makes money...
2. While I spend 3 weeks coding a driver, getting it to work and ironing out bugs, the mbed or Arduino kiddy just create a fully functional BLE app with LFS filesystem, Ethernet webserver, etc. in the same time
I wouldn't touch mbed even with safety gloves.
That said, C++ has some benefits over C, but it's a monster that some highly-regarded people consider should never have existed (including Linus Torvalds and Niklaus Wirth, who are not exactly dumbasses).
I rarely see any reason to use it in embedded settings, where we often see, when C++ is used, very trivial stuff encapsulated ad nauseam for no good reason whatsoever, except maybe looking hype. Especially on small targets like microcontrollers. And it can also make debugging a lot harder.
Some may object (no pun intended) that GUIs, for instance, are much easier to design with object-oriented languages. There are some nice GUI libraries in C for embedded development though, that are fairly straightforward to use. YMMV.
For bigger targets than small microcontrollers, higher-level languages than C may have some benefits. I would personally tend to favor ADA to C++ in this case. Granted ADA is kind of a huge monster too, but at least it gets object orientation and safety features right IMO.
As to what is the "future", it's kind of hard to predict. Whereas C++ is actually declining in use overall, and Java is starting to as well (after a two-decade raise), C is still going strong for embedded development, so I don't think it's going away anytime soon. And why is mbed using C++, I'm not sure. Some tech decisions in big companies are not as rational as you may think.
You can start with rmbed or Arduino if it feels more comfortable, jut do it with explicit goal to replace things as fast as possible, so don't get comfortable with the whole framework, just pick the "hard" parts here and there, do the easy parts yourself.
Note: not all of these arguments are my own, googled before I asked the question.
- C++ is slow. (real-time, soft-realtime, etc.)
- C++ produces bloated machine code.
- Objects are large.
- Virtual functions are slow.
- Abstraction leads to inefficiency.
- C++ is slow. (real-time, soft-realtime, etc.)
- C++ produces bloated machine code.
- Objects are large.
- Virtual functions are slow.
- Abstraction leads to inefficiency.
Is C++ the future for embedded?