Use Nerves with an emulated Raspberry Pi?

Hello all! I am interested in using the Nerves for a school project, but I am unable to access the physical material. That’s why I emulated a Raspberry Pi with Qemu software and connected it in SSH to my mac (using this command $ ssh -p 22222 pi@localhost). But I can’t upload ($ mix upload) my program in SSH. Is it possible to use Nerves with an emulated device? is there a config file to change?
Thank you for your reply!

While it’s possible to use Qemu with Nerves, we typically haven’t supported this. Qemu used to be slower, harder to use, and much more limited than a Raspberry Pi Zero. When the Zeros were everywhere and so inexpensive, we abandoned trying to make the Qemu experience better. I don’t know if things have improved enough now to revisit.

Depending on what you’re doing, much of it may be doable just by running Elixir on your development machine without any emulation. In the Nerves docs, this is the MIX_TARGET=host way of building and running projects. Host development is the default for all Elixir so this really isn’t anything special, and you can leave off setting MIX_TARGET.

For experimenting with simulated hardware, there’s a I2C, SPI, and GPIO simulator that may be helpful. You can read about it at the circuits_sim git repository.

Hope this helps.

2 Likes