Installing a C++ Server on a Nerves Device

I’m working on an LED project using a couple of Fadecandy devices. For now I’m just testing it on my Mac, but I eventually need this system to be portable and my plan is to drive it using a Raspberry Pi. I would love to use Nerves for this, if possible.

To talk to the Fadecandies, you need to run a C++ server. Then you can send commands to that server using the Open Pixel Control protocol. I can easily wrap that protocol in Elixir, so the main challenge is just getting the server to run alongside my BEAM app in the Nerves environment.

I’ve been reading a bunch of Nerves documentation, trying to understand how to approach this. I think I could use overlays to get the file on the device, assuming I had a precompiled binary. Does this sound right? If so, I need to figure out how to get that binary. I’m guessing that I’m meant to do that using Docker and mix nerves.system.shell. Does that sound right? I’ve literally never used Docker before, so please let me know if there are other options. :slight_smile:

Thanks in advance for any advice you can share!

2 Likes

I haven’t dug into the details of compiling for the target and whatnot. But I imagine that should be doable as part of a mix firmware run if you package up the C++ server stuff as part of an Elixir package.

From my understanding a pretty good way of running non-Elixir code on Nerves or generally with Elixir is muontrap. But that would be once they are on the device.

1 Like

hmm I would try using https://github.com/elixir-lang/elixir_make

make sure to git pull the submodules, adapt the makefile to output to /priv - see this example(and project) https://github.com/visciang/nerves_dht/blob/master/Makefile

then attempt the crosscompile using (docker and) mix firmware

if that succeeds I would proceed to starting the server using rambo or muontrap - and then start interfacing it…

could be quite the rabbit hole though!

1 Like

I’m inferring from other posts that integrating the Fadecandy with Nerves didn’t go so well. However, I was curious if you were happy with the device other than that. I’m thinking about an LED project and the Fadecandy device looked like a reasonable thing to try for strips that are longer than what Blinkchain supports.