News for hackers. Stuff that matters.
Re:Guide to Implementing Communication Protocols in C++ for ... by vardump on Tuesday June 12, 2018 @04:56AM (#17291743)
Embedded dev here.

Using C/C++ for embedded systems external communications feels like building a house out of matches.

Sure, there's tooling to help fire proofing things a bit, like static analysis and so on. You see, it's important to spray some fire retardant on the match house.

But wouldn't it be so much nicer to have a construction material other than matches for this purpose...

Re:Guide to Implementing Communication Protocols in C++ for ... by pjmlp on Tuesday June 12, 2018 @05:18AM (#17291819)
Re:Guide to Implementing Communication Protocols in C++ for ... by taneq on Tuesday June 12, 2018 @10:20AM (#17293461)
IEC 61131-3 Structured Text [1] is very similar to Pascal if you're more on the industrial / electrical side rather than 'real' embedded dev, quite a few PLCs support it these days and it's a fair compromise between safety and expressiveness.

[1] https://en.wikipedia.org/wiki/Structured_text

Re:Guide to Implementing Communication Protocols in C++ for ... by berti on Tuesday June 12, 2018 @02:51PM (#17296626)
Unfortunately a large portion of the language spec is optional so it's not portable between PLC manufacturers, and implementation quality varies significantly. Source: it's my dayjob. :(
Re:Guide to Implementing Communication Protocols in C++ for ... by pjmlp on Tuesday June 12, 2018 @10:39AM (#17293647)
Quite cool, thanks for point it out.
Re:Guide to Implementing Communication Protocols in C++ for ... by taneq on Tuesday June 12, 2018 @10:09AM (#17293364)
I've done a fair bit of embedded stuff with C++ and I completely agree. I've been watching Rust quite closely in the hopes that it's suitable for embedded development by the time my next round of projects comes up.
Re:Guide to Implementing Communication Protocols in C++ for ... by ranit on Tuesday June 12, 2018 @06:26AM (#17292054)
So, which language or tool would you recommend?
Re:Guide to Implementing Communication Protocols in C++ for ... by v_lisivka on Tuesday June 12, 2018 @08:28AM (#17292596)
Rust looks promising, but it is not ready yet. I use it on iMX6, which is relatively powerful system, but on NRF52 we still use C. Maybe I will use it on NRF52 when support for bare hardware metal will be in stable (working group[1] is working on that).

[1]: https://github.com/rust-lang-nursery/embedded-wg

Re:Guide to Implementing Communication Protocols in C++ for ... by vardump on Tuesday June 12, 2018 @07:13AM (#17292238)
Rust looks quite promising.

Currently limited microcontroller architecture support is one of the biggest issues with it.

Rust based RTOS would also be helpful for medium size devices. Of course small devices are fine on bare metal.

Re:Guide to Implementing Communication Protocols in C++ for ... by v_lisivka on Tuesday June 12, 2018 @08:48AM (#17292715)
There are some projects, for example [1],[2], but they require nightly compiler, i.e. they cannot be used in production yet.

[1]: https://github.com/tock/tock/blob/master/doc/Getting_Started... [2]: https://github.com/hashmismatch/freertos.rs

Re:Guide to Implementing Communication Protocols in C++ for ... by iainmerrick on Tuesday June 12, 2018 @09:02AM (#17292786)
If you don't use Rust yet, what do you use right now?

I would have guessed C or C++. Maybe they're not great for the purpose but they're also just about the only game in town, no?

Re:Guide to Implementing Communication Protocols in C++ for ... by vardump on Tuesday June 12, 2018 @10:54AM (#17293784)
Mostly C.

While C++ is easier to write, for very low level code, it is harder to maintain when you need to understand all of the side effects to maintain code safety.

C++ compiler support is also sometimes not available. (And of course it's very like there'll be no Rust compiler available either in this case.)

Re:Guide to Implementing Communication Protocols in C++ for ... by w_t_payne on Tuesday June 12, 2018 @06:11AM (#17292014)
AutoSAR? or Ada?

Actually, does anyone know if FORTRAN is ever used for embedded applications?

Re:Guide to Implementing Communication Protocols in C++ for ... by tjalfi on Tuesday June 12, 2018 @10:18AM (#17293446)
RTF/68k [0] is a extended Fortran 77 for embedded systems based on the 68k.

It was used for a fair number of control systems in the 1980s and 1990s.

[0] https://webhome.weizmann.ac.il/home/fhlevins/RTF/RTF-TOC.htm...