Nerves: buildroot linux and Erlang, with an Erlang "init"
nerves-project.org
nerves-project.org
I spent quite some time trying to get tighter integration between a kernel module and the Erlang runtime. Because of the way Erlang works, one can't select(2)/poll(2) file descriptors in a useful way, which makes sysfs interrupt files less useful. I wrote a very simple Erlang node[0] to send messages when select/poll returns. It works okay, but the jitter is very high.
Peer Strizinger wrote something called Grisp[1] which uses the POSIX interface to RTEMS[2] to run Erlang without a canonical OS. RTEMS is still ultimately an embedded kernel, but it keeps you much closer to the metal than Linux. Unfortunately, Peer hasn't/won't release his code despite my pleas.
Most promisingly, there's Cloudozer's Erlang on Xen port to the Raspberry Pi[3]. This is a clean-sheet Erlang VM implementation that actually runs bare-metal (no POSIX!). The code is definitely experimental and I don't have the time to try to retarget it to my preferred platforms, but it's exciting anyway. It's definitely what I would call "firmware" in Erlang.
Anyway, Nerves is cool, but it's (u-boot + Linux + epmd + BEAM).
[0] https://github.com/thenewwazoo/erl_poc/blob/master/c_src/nod...
Ok, we'll use that as a provisional title, since people here have been objecting to all the previous titles. If anyone can suggest a better (i.e. more accurate and neutral) one, we'll change it again. (Normally it isn't so hard to look at a project page and find a suitable description, but I couldn't do that here—this one is surprisingly on the other side of the breathless marketing divide. Et tu, Erlang?)
* it's Elixir not Erlang
* to the people who would use the project, it is "firmware"
Nerves is really cool. And the cool part is that it's becoming possible to do what firmware programmers used to, but using higher level more productive languages/OS.Most things in Haskell work this way. If you wanted to get epoll behaviour without actually calling epoll yourself, you could spawn a ton of processes to wait on different sockets or whatever and then just have them write into an STM container when they receive anything. The thread receiving from x million different clients or whatever just keeps reading from the STM container.
Of course, at large scale you would probably just use epoll directly and save on the few hundred bytes per thread overhead.
My goal was to reduce the time between (physical) interrupt and Erlang thread response because I was trying to make sure I didn't miss an event.
For Ling in general or for the raspi port?
From what I understand, Nerves essentially creates a minimal Linux firmware image that boots into your Elixir app. That is way too huge and bulky for most embedded systems i.e. microcontrollers and FPGAs. Furthermore, I don't think that the overhead of the firmware and VM can actually handle the level of realtime control required in the embedded space.
Since Nerves seems to be targeting the IoT space, why not just say "Elixir for IoT"?
Nonetheless, it looks like an awesome project. Elixir is a really interesting language running on a mature platform, and has come quite a long way in a very short amount of time.
Edit: from the ElixirDaze talk [1], Gareth says that the image is around 18 MB in size.
I get that an RPi or Beaglebone or any large SoC architecture qualifies as an embedded system in the sense of "this board is running a drone/driverless car/CNC machine/etc".
But, at least to me, these are highly miniaturized desktop systems now. There's disk. There's advanced I/O (HDMI, LVDS, 802.11, Ethernet, SATA, PCIe!). There's a full operating system on there. You could put one inside a 1U case and pretend it's a server.
Not that this is a bad thing. SoCs are awesome and I personally have a half-dozen projects cooking with iMX6s and other cool parts in this domain. But I think we need to find a way, especially in the IoT era, to quantify a small device node architecture versus a Linux-desktop-on-a-board. I already see Microsoft abusing this by putting Win10 on an RPi and calling it an IoT architecture.
But let's be honest. Except if you have really strong constraint about power consumption and form factor, most of these small stuff are far easier to work with, perform probably better (because yes your software has bugs) and have so so so much better tooling.
Because the embedded world has a big tooling problem. I still hope to have some Rust on lower level to push it into the XXIst century.
And the nerves project is made by people that come from the embedded world. They completely know their limits and do not try to push it everywhere.
In such scenarios, the overhead and unpredictability of the OS scheduler is unacceptable. When you want to say isolate a fault exactly 100us after it takes place, you can't have the OS executing that task at some different delay in a nondeterministic fashion.
It is just a really different set of way to think. And a really hard one i may add.
I used to maintain a system most people would call true "embedded" - it was a PowerPC based VME system running VxWorks. The job of the system was to monitor some analog voltages, detect an unsafe condition, and open some relays if the unsafe condition was detected in < 10 ms. VxWorks dev tools and the PowerPC cards are very expensive, so we decided to replace it with a x86-64 server running RedHat MRG. That is the Linux kernel with the PREEMPT_RT patchset. We had a PCIe card in there for monitoring the analogs and firing the relays. Was the system still embedded? I would argue it was. The heart of the code was basically the same - VxWorks has the POSIX API for pthreads after all. There were just some driver call changes and init looked different.
So is a an industrial factory control server embedded? It controls valves, actuators, reads sensors. It can still be a whole rack top to bottom full of high power Xeon servers.
Embedded literally means inside something. It is not a computer used on its own, say to run general purpose software, but as part of another larger system. There is no power or size requirements for that. Well and most of all it is a fuzzy term.
a desktop is stand-alone. A webserver isn't but the internet its part of isn' really stand-alone. Mobiles were called embedded, but newer phones with apps are rather stand-alone. All are embeddable.
Well, there are some nice tools available, but not many seem to be willing to pay for them.
http://www.mikroe.com/compilers/
What if I had an ARM SoC (like in the RPi) running VxWorks or RTEMS controlling a missile? Few would argue that is not an embedded system.
What if the RPi is running real-time Linux doing computer vision on an assembly line? What if the timing deadlines are pretty loose (>10 ms), a miss a month is acceptable, and it runs a stock Linux kernel? I would argue all of those cases are real-time embedded systems, albeit with different hard real-time versus soft real-time requirements.
I've altered the title of the post to use Nerves' actual tagline.
Disclaimer: I work for a company whose products are based around SoCs running Linux for soft-real-time applications, and we whole-heartedly call these products embedded systems.
This is the classic example of it being done: https://www.youtube.com/watch?v=96UzSHyp0F8
What I don't know is whether that's generalisable, or relies on particularly fiddly work on the microprocessor to keep latencies down.
I've seen embedded 2U Xeon servers on a rack, used for signal processing or for controlling industrial systems. I would still consider those embedded. They are used inside of a larger system.
> Furthermore, I don't think that the overhead of the firmware and VM can actually handle the level of realtime control required in the embedded space.
It is perfectly fine. Just a few years ago someone demostrated using it to read data out of a camera sensor adn stream it. Beaglebone Black for example has two realtime co-processors (PRIs) which can be used to process and read data off sensors and such.
http://www.slideshare.net/fhunleth/building-a-network-ip-cam...
I heard a good definition: is it used as a computer or as an appliance. If it's the latter, it's at least kind of embedded, even if it's a fairly powerful processor with lots of memory and so on.
Still awesome and exciting stuff.
Anyway checkout the Elixir Conference talk on Nerves: https://www.youtube.com/watch?v=118-g0ODfgg&feature=youtu.be
If anyone wants a 30% off coupon to an Elixir course, here you go: https://www.udemy.com/elixir-for-beginners/?couponCode=Save3...
Wow. Okay. Can you show us?