elixir-circuits / circuits_spi

Communicate over SPI from Elixir
26 stars 6 forks source link

Nerves 1.4 / Elixir 1.8 firmware issue #15

Closed fkumro closed 5 years ago

fkumro commented 5 years ago

This appears to be a known issue with Circuits.GPIO and I ran into it with Circuits.SPI.

When using Nerves 1.4 with Elixir 1.8 I am unable to create firmware.

Error:

Updating base firmware image with Erlang release...
scrub-otp-release.sh: ERROR: Unexpected executable format for '/home/fkumro/code/lake_effect/fw/_nerves-tmp/rootfs-additions/srv/erlang/lib/circuits_spi-0.1.0/priv/spi_nif.so'

Got:
 readelf:Advanced Micro Devices X86-64;0x0

Expecting:
 readelf:ARM;0x5000400, Version5 EABI, hard-float ABI

This file was compiled for the host or a different target and probably
will not work.

Source which it can be reproduced with: https://gitlab.com/fkumro/lake_effect/tree/nerves_1.4_elixir_1.8

fhunleth commented 5 years ago

This happens for every project with a port and NIF. It has been an issue for a really long time, but until Elixir 1.8, it was more cumbersome to switch targets so it didn't seem to come up as often. To work around this for now, every time you switch your MIX_TARGET, build clean.

The core issue is that all non-Elixir/Erlang code is compiled in the same directory. I'm experimenting with solutions. Once something gels, I'll copy the solution to all of the Elixir Circuits repositories and the other Nerves repositories.

fhunleth commented 5 years ago

FYI - I've made releases for circuits_gpio, circuits_i2c and circuits_spi that address this issue. Could you try it out?

fkumro commented 5 years ago

I tested the changes by firm compiling for host and then for rpi3. Followed by building firmware for rpi3 and everything worked as expected. Thank you!

fhunleth commented 5 years ago

Great! Thanks for following up.