Underjord is a tiny, wholesome team doing Elixir consulting and contract work. If             you             like             the writin

Anatomy of Embedded Elixir

submited by
Style Pass
2024-10-07 15:00:06

Underjord is a tiny, wholesome team doing Elixir consulting and contract work. If you like the writing you should really try the code. See our services for more information.

Working on the Nerves project, the Embedded framework for Elixir, has given me an increased appreciation for how Frank Hunleth and his collaborators through the years have structured things. And while I’ve found crossing into the Linux-heavy part of it difficult and frustrating there has been reasonable steps to take all the way from building the application layer in Elixir all the way back to fighting the bootloader. I’ll try to detail how a Nerves system is built up in this post.

The reason to do Embedded Linux with Elixir is the BEAM. And yes, I have to type Linux every time or someone goes “hurr, hurr, oh you meant Linux, not real embedded, that’s microcontrollers only”, some are friendly, some are not, all are compelled to intervene. Anyway, the BEAM virtual machine treats your application as a system, and makes it possible to operate it at runtime and while this is powerful in your web app it is really important in Nerves. Your code gets assembled into an Erlang release. A tarball of various bits along with the necessary runtime parts.

That release contains many Erlang Applications. Some are system applications such as os_mon the OS monitor, alarm_handler the .. alarm .. handler. Then we have Nerves applications that come from Nerves-related libraries. Many of these will generally work on any Linux distribution but were developed for use with Nerves. Some provide facilities that other applications usually perform in Linux. These generally allow you to integrate the system-level information into your application in a nicer way with message passing and API structure we know and love:

Leave a Comment