Build problem with SparkFun nRF52 Boards on Arduino

For the discussion of Arduino related topics.

Moderator: phalanx

Build problem with SparkFun nRF52 Boards on Arduino

Postby mikemccauley » Tue Dec 13, 2016 8:10 pm

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.
mikemccauley
 
Posts: 4
Joined: Sun Nov 20, 2011 8:45 pm

Re: Build problem with SparkFun nRF52 Boards on Arduino

Postby woifi » Wed Dec 28, 2016 5:09 am

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:

Code: Select all
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/
woifi
 
Posts: 3
Joined: Wed Dec 28, 2016 4:58 am

Re: Build problem with SparkFun nRF52 Boards on Arduino

Postby mikemccauley » Sun Jan 08, 2017 12:12 am

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 <module>
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 <module>
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 <module>
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 <module>
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 <module>
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.
mikemccauley
 
Posts: 4
Joined: Sun Nov 20, 2011 8:45 pm

Re: Build problem with SparkFun nRF52 Boards on Arduino

Postby mikemccauley » Sun Jan 08, 2017 12:25 am

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/pc-nrfutil/archive/v0.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/NordicSemiconductor/pc-nrfutil/master/nrfutil.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
mikemccauley
 
Posts: 4
Joined: Sun Nov 20, 2011 8:45 pm


Return to Arduino

Who is online

Users browsing this forum: No registered users and 2 guests