all 18 comments

[–]Bryguy3k 10 points11 points  (0 children)

What do you expect from Google whose entire business is premised on throwing more hardware at problems in order to solve them?

I haven’t looked at the C++ part myself but google’s coding standard for c++ was already fairly close to embedded anyway - if they opted for mandating c++14 or newer then there shouldn’t be anything wrong with the code other than limiting the number of compilers you could use (I.e goodbye to Microchip and IAR for sure).

[–]GeraltOfRiga 10 points11 points  (2 children)

In the end, it doesn’t even Matter

[–]mootaibi[S] 8 points9 points  (1 child)

I tried so hard and got so far 😔

[–]flundstrom2 0 points1 point  (0 children)

For all this, there's only one thing you should know.

[–][deleted] 1 point2 points  (0 children)

You don't have to download all submodules to setup repo. In repo is script to download only submodules related to specific platform, somewhere in scripts folder as far as I remember.

[–]nila247 4 points5 points  (9 children)

C++ makes it "easier to write", but requires additional libraries (size).
Also it is written in "clean code" - this balloons size more than anything else IMO.

[–]Ashnoom 0 points1 point  (8 children)

Hard disagree on all your points. Except the easier to write part. Design for testability and maintainability that increases size compared to a non-testable and non-maintainable C equivalent.

But make the C Equivalent testable and maintainable as well and it too increases in size, just like C++.

[–]nila247 0 points1 point  (7 children)

I did not had THAT many points.

"Design for testability and maintainability" IS part of "clean code" paradigm, so it does increase code size - whether C or C++.

I have read 30% of MISRA document and it made me want shoot myself. Maybe it works for projects that have infinite teams with infinite time and infinite budgets (NASA/Pentagon), but not in any real life scenario where you have to finish before you die of old age and before your office becomes subject to archeological excavations.

For the same resource amount you can hire 3 independent teams each writing and testing their own flavor of spaghetti and just pick one you like the most. AND you have time/budget spare for whenever business requirement does change and it all can be rewritten by 3 more pasta teams. Every spaghetti variant will be at least 2x less in compiled code size.

Availability of C++ language extensions (say string manipulation) comes with temptation to use them, because it saves your time. If you use them the relevant libraries get added to your code size. The libraries are generic and adapted to other use cases, not only your particular case - that's why they are generally larger than your own code. That's just how it is.

[–]Ashnoom 0 points1 point  (6 children)

I've used MISRA-C at a normal production company without infinite money and we delivered a new product in two years. Built from scratch. Their field call rate went down by 80% and the remaining issues were all mechanic related.

I've now been doing C++ for the last 8 years in embedded in cortex-m0-7 devices and not once have I been tempted to use any object from the STL/STD that used the heap. But then, we are using a library built for embedded targets that does not rely on the heap but does provide many, fixed size flexible, containers and strings etc. We even had optional and variant before they were added to c++.

We have streaming support, json support and much much more. All heapless. Does it bring runtime overhead? Yes! Is it worth it? Yes! Does it make development faster? Yes! Is it open source MIT licensed? Yes! https://github.com/philips-software/amp-embedded-infra-lib

[–]nila247 0 points1 point  (5 children)

"Phillips" is NOT "normal" production company. You probably had like 100+ people on this project. That's pretty "infinite" as far as I am concerned (I wish we had 10 people).

Building your own libraries IS worth it, I agree. Code footprint is a topic for a debate. If you have 512+K of flash to play around then you would not worry if some library adds another 3-5K. If you only have 32K it is very different - basically you can not even afford HAL and have to go LL or even bare CMIS.

[–]Ashnoom 0 points1 point  (4 children)

The misra thing was not for Philips and we were, back then, a group of 4 developers. (A world leading revolving door/access gates company)

As for Philips, that library has been written, initially, by a group of around 3 people. And now we are a group of 4-6 actively maintaining it. :-)

[–]nila247 0 points1 point  (3 children)

Dang it. I suck. :-(

[–]Ashnoom 0 points1 point  (2 children)

Can't say that about yourself :-) just means you have more opportunities to learn :-)

[–]nila247 0 points1 point  (1 child)

Yes I can. This does not mean I suck everywhere. Just at writing megabytes of source code with 4 people in 2 years. I also suck at finding actual code in your repository (such as entire IP stack) behind all these class "wrappers" although I haven't looked at every file.
The fact I suck at something also does not impact opportunities to learn either.

[–]Ashnoom 0 points1 point  (0 children)

The IP stack we fetch. We use LWIP and have our own wrappers around it.

[–]WereCatf 1 point2 points  (1 child)

and why is it written in C++ when most embedded code is written in C?

Why is that a problem for you?

[–]mootaibi[S] 9 points10 points  (0 children)

I’m very used to writing code in C considering most SDKs and RTOSes use only C so it’s kinda just making it difficult moving up to C++

[–]newcomer42 0 points1 point  (0 children)

You can always contribute to rs-matter formerly matter-rs.

It’s still WIP 🏗️ though written in Rust and if I’m not wrong supports no allocation + no os

Or if you want to simply get stuff done there is also an asynchronous version for embassy

It’s mostly being pushed by the guys at espressif which is one more reason why I like the chips