Build problem with SparkFun nRF52 Boards on Arduino

Hi, trying to build Blink for RedBear Lab nRF51822 using the nRF5 boards support, downloaded to Arduino 1.6.13 on Linux 32 bit OpenSuSE, using

https://raw.githubusercontent.com/spark … index.json

installed with BoardManager.

But build fails with:

/home/mikem/.arduino15/packages/SparkFun/tools/nrfutil/0.5.2-SFE/dist/nrfutil dfu genpkg --application “/tmp/arduino_build_367071/Blink.ino.bin” “/tmp/arduino_build_367071/Blink.ino.zip”

fork/exec /home/mikem/.arduino15/packages/SparkFun/tools/nrfutil/0.5.2-SFE/dist/nrfutil: exec format error

and indeed /home/mikem/.arduino15/packages/SparkFun/tools/nrfutil/0.5.2-SFE/dist/nrfutil turns out to be an ARM executable not a i686-linux-gnu executable:

file /home/mikem/.arduino15/packages/SparkFun/tools/nrfutil/0.5.2-SFE/dist/nrfutil

/home/mikem/.arduino15/packages/SparkFun/tools/nrfutil/0.5.2-SFE/dist/nrfutil: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, BuildID[sha1]=57df86d5b84818fe7c0bb84b7d15100b607fe520, stripped

Seems that https://cdn.sparkfun.com/assets/learn_t … ux.tar.bz2 (the origin of the nrfutils package) contains an ARM executable instead of the expected processor type:

Could this be fixed please? Im expecting some SparkFun nRF52832 Breakout boards soon and the build for that chip also suffers from the same problem.

Cheers.

I ran into the same problem while trying to upload to my Sparkfun nRF52832 breakout.

As a workaround, the following worked for me (on Ubuntu 16.04) to get a working executable:

cd <some_temporary_scratch_directory>
wget 'https://github.com/NordicSemiconductor/pc-nrfutil/archive/v0.5.2.tar.gz'
tar -xf v0.5.2.tar.gz
cd pc-nrfutil-0.5.2
pip install -U setuptools
pip install pyinstaller
pip install -r requirements.txt
wget 'https://raw.githubusercontent.com/NordicSemiconductor/pc-nrfutil/master/nrfutil.spec'
vi nrfutil.spec
    # replace \\ by /
pyinstaller nrfutil.spec
cp -p dist/nrfutil ~/.arduino15/packages/SparkFun/tools/nrfutil/0.5.2-SFE/dist/

Thanks, almost works for me on OpenSuSE 13.2 too, except that I also needed:

pip install pc-ble-driver-py

also had to edit pc-nrfutil-0.5.2/nordicsemi/dfu/intelhex/init.py to fix a number of syntax errors when run with python 3

print “xxxxx” → print(“xxxxx”)

and

except xxxx, y: → except xxxx as y:

finally the dist/nrfutil is built but when I run it I get:

Traceback (most recent call last):

File “nordicsemi/main.py”, line 34, in

from nordicsemi.dfu.dfu import Dfu

File “/usr/lib/python3.4/site-packages/PyInstaller/loader/pyimod03_importers.py”, line 389, in load_module

exec(bytecode, module.dict)

File “nordicsemi/dfu/dfu.py”, line 39, in

from nordicsemi.dfu.package import Package

File “/usr/lib/python3.4/site-packages/PyInstaller/loader/pyimod03_importers.py”, line 389, in load_module

exec(bytecode, module.dict)

File “nordicsemi/dfu/package.py”, line 41, in

from nordicsemi.dfu.nrfhex import *

File “/usr/lib/python3.4/site-packages/PyInstaller/loader/pyimod03_importers.py”, line 389, in load_module

exec(bytecode, module.dict)

File “nordicsemi/dfu/nrfhex.py”, line 29, in

from nordicsemi.dfu import intelhex

File “/usr/lib/python3.4/site-packages/PyInstaller/loader/pyimod03_importers.py”, line 389, in load_module

exec(bytecode, module.dict)

File “nordicsemi/dfu/intelhex/init.py”, line 50, in

from compat import asbytes, asstr

ImportError: No module named ‘compat’

Failed to execute script main

apparently caused by this line in

nordicsemi/dfu/intelhex/init.py:

from compat import asbytes, asstr

but I cant find this compat module anywhere.

There seem to be many other errors listed in build/nrfutil/warnnrfutil.txt

Ideas?

Cheers.

Looks like my main problem was using python3 instead of python2 (both availbale here)

This works for me:

cd <some_temporary_scratch_directory>

wget ‘https://github.com/NordicSemiconductor/ … 5.2.tar.gz

tar -xf v0.5.2.tar.gz

cd pc-nrfutil-0.5.2

pip2 install -U setuptools

pip2 install pyinstaller

pip2 install -r requirements.txt

wget ‘https://raw.githubusercontent.com/Nordi … futil.spec

vi nrfutil.spec

replace \ by /

python2 /usr/bin/pyinstaller nrfutil.spec

cp -p dist/nrfutil ~/.arduino15/packages/SparkFun/tools/nrfutil/0.5.2-SFE/dist/

thanks for getting me so close!

Hope this helps someone else