
Nerves – Craft and deploy bulletproof embedded software in Elixir - punnerud
https://nerves-project.org
======
mmartinson
I think Nerves is cool because it really lowers the conceptual overhead for
the cohort of web developers using Elixir to hack on hardware projects. There
was a whole track on Nerves at ElixirConf in Bellevue last year, and I saw a
ton of people who'd never done anything with hardware get really excited about
it.

The keynote by the Nerves creator Justin Schneck was particularly good.

[https://www.youtube.com/watch?v=bd_EIWU9GzQ](https://www.youtube.com/watch?v=bd_EIWU9GzQ)

------
jimmyswimmy
Heh, when I think of embedded code I don't think of 12 MB. That's not to say
this isn't useful. I usually try to size the hardware to the task. Sometimes
the task calls for a little 8-bit micro, sometimes analog-only.

When the job calls for a heavy linux-running processor, this seems like it
could be interesting, as long as I can dig out all the details of what it's
actually doing. The chips I use usually have an errata document 20+ pages
long, and we usually find some new bugs to add to it during development. It's
hard to code around hardware bugs period, and that's in a language hardware
guys know, like C or assembly. Debugging hardware code written in Erlang
sounds... challenging.

~~~
jsjohnst
> Heh, when I think of embedded code I don't think of 12 MB.

ARM processors are so cheap these days that I think your idea of “embedded” is
a bit stagnant or too focused in one field. I’ve built and shipped a product
where it had an ARM processor and ample flash (among a bunch of other
components) packaged the size of a key fob and the BOM cost is way less than I
used to pay for Arduino or other micro controllers.

~~~
vvanders
That's very much dependent on volume. $0.50 @ 1M units = $500,000k.

You'll always see the crunch at high volume it's just small to medium volume
where your options open up. Back when I was in the smartphone business we'd
easily see 10M+ volume on a single device and the associated BoM was tuned to
a tenth of a penny.

~~~
jsjohnst
Even at quantities of 1M, you barely would get ARM processors for $0.50 each,
let alone entire BOM cost of a device.

------
hbcondo714
Here's an example posted on here yesterday fixing a Barcode Scanner using
Elixir and Nerves:

[https://news.ycombinator.com/item?id=16902628](https://news.ycombinator.com/item?id=16902628)

~~~
punnerud
It inspired me to do this post. Something that useful could not be hidden in
the “dark”.

------
MisterTea
I've been following some of the interesting Erlang stuff for distributed
embedded systems. A similar project which caught my eye is GRiSP
[https://www.grisp.org/](https://www.grisp.org/) Basically the BEAM VM ported
to run directly on bare metal using the RTEMS RTOS (Think of it as a library
that allows you to run a unix process on bare metal).

~~~
e_proxus
I'm one of the developers on the GRiSP project.

Our main difference is as you say, that we combine Erlang with RTEMS to make
the Erlang VM essentially be the kernel (no Linux running underneath). This
let's us use Erlang's inherent soft real-time properties more reliably and
allow us to do more hard real-time things.

Our low-level drivers for accessing hardware are written in C, and high level
drivers are written in Erlang (for development speed, readability,
testability, line count etc.) but can of course be written in C if you need
the performance.

I'd be happy to take questions about the project.

~~~
X4lldux
Project looks very interesting! What hardware is supported? I've seen you
product your own prototype board, but what about some off the shelf opensource
openhardware solutions like BeagleBone Black or NextThing's CHIP?

~~~
peerst
RTEMS supports all 32bit hardware architectures. We also run it on a PowerPC
controler for a customer project, but it also runs on Sparc, Mips all Arm and
many other architectures.

We don’t use the MMU so we don’t need it, some embedded chips have even small
MMUs that allows it running Linux size OS but since they have very small
translation lookaside buffers it needs to traverse the in RAM page table very
often and performance is quite poor then

------
cztomsik
What makes elixir/erlang good fit for rpi? When compared to let's say rust or
lua. Serious question, no offense.

~~~
sunkencity
erlangs bit matching syntax, case statements for structs... incredibly
elegant. I don't know about Rust or Lua, maybe they have this too.

~~~
steveklabnik
Rust doesn’t have the bit matching syntax, but we do have match generally.

~~~
anuragsoni
It'd be interesting to explore something similar to the bitstring[1] library
for Ocaml. Where should one start if exploring syntax extensions for Rust. I
haven't looked into rust in a while now so i'm not sure how far one can get
with macros these days.

[1]
[https://github.com/xguerin/bitstring](https://github.com/xguerin/bitstring)

~~~
steveklabnik
“Macros 1.2” is what you want to look up; it’s in FCP right now!

------
Communitivity
I think I met the guy behind Nerves a while ago when he presented at an
Erlang/Elixir meetup in DC, and had a good conversation. Smart guy, and the
project was impressive.

Also, as other commenters have pointed out, embedded doesn't mean what it used
to. Embedded now can range from a custom real time operating system written in
embedded C with memory allocations from a static pool to Java running on an
Arm processor.

~~~
atonse
Are you part of the DC Elixir community? I am too. Haven't had too many
meetups recently.

I too met the Nerves dude, very nice and approachable. I was proud to have
such a project come out of my area.

------
desireco42
I only can say that I enjoy Elixir a lot and wish I had a project in mind
where I can use Nerves. I am sure it will come.

------
shock
This looks very interesting but I haven't found any mention of GSM
connectivity. Is there any?

