
Mbeddr – engineering the future of embedded software - _qc3o
http://mbeddr.com/
======
codehero
When I work on an embedded system, I want as few layers between my code and
the assembler as possible. Even your C compiler can produce undesirable code
if you don't put the proper const, volatile qualifiers on your pointers.

The last thing I want is a layer of software and an IDE developed by a team
that I can only assume has 0 embedded experience (judging by team page they
are all architects or academics).

Secondly, if I handed off a work for hire implemented in this language I would
not get a next assignment. There is no room for fad modelling in the
established engineering trade and unfortunately I don't have the pull to start
the disruption if I truly believed in it.

~~~
errordeveloper
There are two problematic types of engineers out there, some have no clue what
they do and some have too much clue and wave their flags all over the place.
You are in the second group and have probably been doing too much C for too
long.

~~~
codehero
I really appreciate your succinct criticism of my points, you didn't need to
qualify with anything but "you have been doing C for too long." I consider
that a compliment.

Ask my clients how much of a problem I am and then ask them how many problems
I solve. And no, I don't solve them all with C.

~~~
errordeveloper
That's good for you! I don't personally find the tool in question exactly the
most appealing to me personally, but what I am excited about is that the
industry is moving on, as C is far too dated as a language and even C14
doesn't give much hope. So, as you suggested that you don't appreciate the
abstarction this tool adds, would you consider Rust, as it compiles right down
to machine code? Essentially Rust is much C-like in terms of basic syntax, but
has expressivenes of a functional language, safety-aware compiler and a ton of
other features, including the fact that it's aimed at system-level
applications and one should be able to write a kernel in Rust.

~~~
codehero
We differ on our opinions of C. It may be dated for you but I can I know how
to manipulate the syntax to get the desired result. Rust has been on my list
of things to check out, but not use for clients. Right now all roads (from
Javascript, C++, Objective-C and Java) lead to C. So when I write a library in
C, I know I can use it my iOS, Android, node.js and C++ projects. I cannot say
the same for Rust. I do not want to be on the Rust journey quite yet because I
am still smarting from node.js. And in 2012 when I was using node.js to solve
problems was when I was close to becoming a problem engineer, as you believe I
am.

~~~
dbaupp
Rust does allow you to write a dependencyless C-abi library, without requiring
any runtime or such. Hope we'll see you around at some point. :)

(It seems errordeveloper is doing exactly the same flag waving they originally
unfairly lambasted you for...)

~~~
codehero
Pattern matching looks cool but I have some concerns. What is the best forum
for Rust discussion? I get the feeling HN would rake me over the coals for
bringing up switch, falling through case labels and of course, goto.

~~~
dbaupp
reddit.com/r/rust is probably the best place to have exploratory discussions.

Although, our pattern matching is a strict superset of C's switch (other than
fall-through). But yeah, fall-through and goto aren't supported yet, and if we
were to get them (in safe code), they may have to be restricted to preserve
memory safety.

------
sitkack
This is great on many levels.

1\. They are using MPS [0] from JetBrains, a system for constructing tooling
around Domain Specific Languages.

2\. Markus Voelter is a huge proponent of DSLs and a very level headed fellow.
Loved his interview with Laurence Tratt [1] about compile time metaprogramming
[2].

This brings benefits of Ada and Lisp with a modern JetBrains style IDE while
targeting a C99 runtime. I think being able to sculpt the language to the
project can greatly compact the abstraction distance from the problem domain
to the code.

[0] [http://www.jetbrains.com/mps/](http://www.jetbrains.com/mps/) [1]
[http://tratt.net/laurie/](http://tratt.net/laurie/) [2] [http://www.se-
radio.net/2007/05/episode-57-compile-time-meta...](http://www.se-
radio.net/2007/05/episode-57-compile-time-metaprogramming/)

------
damian2000
Its great that it generates C but I'd worry that developers who are writing
embedded code won't bother to try it - they often are trying to squeeze some
code into a small amount of memory on a limited processor. Some of the things
it provides - state machines, unit conversions and error logging are pretty
simple to do within C anyway, and developers might not appreciate or want an
additional level of abstraction.

~~~
ShinyCyril
State Machines, as you noted, are easy to do with C. I think the added value
in this respect is that this makes it much easier to manage the State
Machines. I often hear guys at work complaining about how they'd like to
switch to using an RTOS because the codebase is a tangled mess of State
Machines (not that the two are mutually exclusive of course). Having said
that, I seem to remember there is a tool dedicated to creating State Machines
that compile down to C - the name escapes me however.

~~~
tlarkworthy
QP framework. Its bloody brilliant.

~~~
ShinyCyril
That's the one.

------
kabouseng
This looks like a lot of effort was put into it, but what pain point / problem
does it address? Embedded applications (bare metal) is usually not that
complicated, and when they are they are usually developed either on a RTOS, or
on embedded linux which gives you almost all the advantages of desktop
application development.

Coming back to embedded applications not being that complicated, now you also
need to get your developers to learn another framework and IDE while they are
already under pressure to develop their current feature set.

Like codehero states elsewhere it only adds another abstraction layer between
you and the silicon, in a field where exact control of the silicon is
paramount (Low power, response latency in real time, limited resources etc).

Furthermore what guarantee do you have that Mbeddr will support the latest
processor you are working on. At least with C being a defacto standard in the
industry you have that guarantee. Furthermore most processor manufacturers
supplies demonstration code to use their latest processor features, how easy
is it to pull that into Mbeddr?

I'm afraid this is a very fancy and polished solution looking for a problem.

~~~
dkarapetyan
It's all C. It is all syntactic sugar on top of C so if at the end of the day
you want to go back to C then just compile it down and take it from there.

Your comment reminds me what people were saying when assemblers were first
developed. Real programmers did not use assemblers because it was too high
level or too far removed from the hardware or any number of other excuses. The
fact is that plain C is inadequate for delivering correct software in high
assurance environments. This tool addresses that problem and then some.

~~~
ArkyBeagle
'C' is perfectly adequate for delivering safe and correct* code. Just because
it's possible to have 'C' code that is unsafe is not a blanket indictment of
the language. Micheal Barr, the MISRA team, Valgrind all exist to aid and abet
delivery of safe and correct systems.

*whatever that means in context...

As we say - "doctor, doctor it hurts when I do that!" "Well, don't do that!"

Tools like this simply automate or add leverage to that process.

And unless there's considerable community support for the use of something
like this, it'll remain a smaller thing than raw 'C'. But many embedded
projects are small enough that there's little pain in reinventing the wheel.

------
mackwic
This looks great ! With the JetBrains expertise in IDE, that surely was a
missing piece of software.

I am slightly concerned by the DSL thing, because I don't want each embedded
projects to have specific dialects like we can see on LISP projects.

But, on the average, gains are high: modules ! tests ! Inline contracts and
model checking ! Very nice state machines ! I like that !

Also, why C99 ? There's hardware where only C89 compilers are available...

~~~
errordeveloper
Because nobody would use those chips for new projects. Legacy chips need
legacy tools and run legacy software.

~~~
mackwic
I don't agree. Popular but legacy chips can have updated tools where new but
conservative chips can have odd software packaging.

Moreover, embedded development is conservative by nature and I know a lot of
teams which prefers to run projects on known hardware when possible, even if
we have to suffer of the tooling.

Also, don't forget the licencing. We already have to downgrade our targeted
platform because we couldn't afford to pay the whole tooling where OSS was
only compatible with the previous version.

------
errordeveloper
Great to hear that quality meta tooling is making it's ways into the industry
full of outdated and bad engineering practices.

~~~
mjbellantoni
Could you offer some specifics?

------
Nursie
"A cleaned up version of C99 helps avoid low-level bugs. For example, the
preprocessor is not supported"

NOPE.

From my cold, dead hands.

~~~
IshKebab
Why? The preprocessor is a huge hack that is mostly obsolete. 99% of my
programs only use `#include` and `#pragma once`.

~~~
metafex
Macros used right can really help to clean up messy code and/or reduce
repeating code to something clearer (e.g. in crypto-code).

~~~
hrjet
Pre-processing macros can reduce repetition, but they are certainly a hack:
They are not type-safe. They are not even syntactically safe. A missing brace
in one can cause untoward damage down the chain. And getting it right is
especially important in crypto-code!

------
orf
This looks awesome, one thing though: "All code is stored in XML files". I'm
not sure I see the advantage of this, what else is stored in the XML other
than the code and why can't it be stored on its own?

~~~
vertex-four
This is built on Jetbrains MPS[0], which is essentially an abstract tree
editor made to behave like a regular text editor. The weird thing is, the DSLs
can collide; there can potentially not be enough information in the text to
unambiguously decide which DSL the author intended. Therefore, additional data
has to be stored to disambiguate this.

[0] [http://www.jetbrains.com/mps/](http://www.jetbrains.com/mps/)

~~~
mike_hearn
Well not only that but MPS allows for things like graphical languages too. XML
is used because you're not really editing text at all, you're editing at a
higher level of abstraction.

Regardless, MPS has support for things like version control merging/diffing
and so on. It's a pretty mind blowing tool all round.

------
SixSigma
Oh what a terrible name because of

[http://mbed.org/](http://mbed.org/)

Which is _also_ an online embedded software toolchain from IDE to linker.

------
FnuGk
Why not use something like rust over this? Rust should provide the safety
missing in C while also providing higher abstractions and a safe macro system
with about the same performance as C

~~~
joezydeco
How big is the runtime? I have 64K of SRAM on my part and 512MB of onboard
Flash.

~~~
FnuGk
That is quite a lot for an embedded system.

looking through them comments in an earlier HN post
[https://news.ycombinator.com/item?id=6268291](https://news.ycombinator.com/item?id=6268291)
on running rust on the arduino DUE they link to zero.rs that should make it
possible to run without any runtime

~~~
errordeveloper
Zero.rs is dead now. Checkout [http://zinc.rs](http://zinc.rs) :)

~~~
MrBuddyCasino
Sweet! I'd really like to know how big the resulting binary for that blinking
leds example is.

------
sandGorgon
Hmm... is there any relation to mbed.org ? mbed is a new methodology
(supported by ARM) for programming and debugging embedded devices through
CMSIS-DAP.

------
anon4
So this is something like the friendly-C variant proposed some weeks ago?

------
tmuir
Maybe they've never heard of Eclipse.

------
linuxlizard
Embedded firmware engineers are so conservative I bet the firmware for
tricorders will be written in C.

~~~
tmuir
As opposed to all of those other languages that lend themselves so well to the
task?

Since tricorders will most likely run linux, by default, they will have lots
of C.

