This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

DFU SDK v16 on Mac OS X

Hi,  I am trying to get DFU from SDK16 working on my Mac.(Mac Os Mojave).  I am following the instruction on https://infocenter.nordicsemi.com/index.jsp?topic=%2Fsdk_nrf5_v16.0.0%2Fble_sdk_app_dfu_bootloader.html

I have tried first to build the micro-eco library by clicking on the build_all.bat file and got the following errors from the Terminal.app:

/**************************

SLMini-I5-172:~ slareau$ /Users/slareau/nrf52_development/nRF5_SDK_16/external/micro-ecc/build_all.bat ; exit;

/Users/slareau/nrf52_development/nRF5_SDK_16/external/micro-ecc/build_all.bat: line 1: @ECHO: command not found

/Users/slareau/nrf52_development/nRF5_SDK_16/external/micro-ecc/build_all.bat: l: command not found

/Users/slareau/nrf52_development/nRF5_SDK_16/external/micro-ecc/build_all.bat: line 3: syntax error near unexpected token `('

/Users/slareau/nrf52_development/nRF5_SDK_16/external/micro-ecc/build_all.bat: line 3: `:: This script will use git (must be in %PATH%) and arm-none-eabi tools 'n combination with GNU Make

logout

Saving session...

...copying shared history...

...saving history...truncating history files...

...completed.

/*************************

To solve that step, I have navigate to the micro.ecc folder in terminal.  I have open the build_all.bat file in TexEdit ,  copy and paste the following command directly in Terminal.app  

git clone https://github.com/kmackay/micro-ecc.git

and then

make -C nrf52hf_armgcc/armgcc      // I believe that  the only one that I need for my project

This work perfectly. 

I have tried to generate a public and private key with nrf_util.  I have done that without problem in SDK14.3

nrf_util ask me to upgrade to the latest version with I did. 

In Terminal.app  I have navigate to the dfu folder where I want the key to be generated and type the command :

nrfutil keys generate priv.perm

I have the following problems :

/*****************************

SLMini-I5-172:dfu slareau$ nrfutil keys generate priv.perm

Traceback (most recent call last):

  File "/Library/Frameworks/Python.framework/Versions/3.7/bin/nrfutil", line 11, in <module>

    load_entry_point('nrfutil==6.0.1', 'console_scripts', 'nrfutil')()

  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pkg_resources/__init__.py", line 490, in load_entry_point

    return get_distribution(dist).load_entry_point(group, name)

  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pkg_resources/__init__.py", line 2853, in load_entry_point

    return ep.load()

  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pkg_resources/__init__.py", line 2444, in load

    return self.resolve()

  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pkg_resources/__init__.py", line 2450, in resolve

    module = __import__(self.module_name, fromlist=['__name__'], level=0)

  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/nordicsemi/__main__.py", line 52, in <module>

    from nordicsemi.dfu.dfu_transport_serial import DfuTransportSerial

  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/nordicsemi/dfu/dfu_transport_serial.py", line 53, in <module>

    from nordicsemi.dfu.dfu_trigger import DFUTrigger

  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/nordicsemi/dfu/dfu_trigger.py", line 48, in <module>

    import usb1

  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/usb1/__init__.py", line 61, in <module>

    from . import libusb1

  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/usb1/libusb1.py", line 199, in <module>

    libusb = _loadLibrary()

  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/usb1/libusb1.py", line 173, in _loadLibrary

    return dll_loader('libusb-1.0' + suffix, **loader_kw)

  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/ctypes/__init__.py", line 364, in __init__

    self._handle = _dlopen(self._name, mode)

OSError: dlopen(libusb-1.0.dylib, 6): image not found

/*******

It seems to have found the /libusb1   but not the libusb library.

In Terminal.app I type :  pip install libusb

/**************

SLMini-I5-172:dfu slareau$ pip install libusb

Requirement already satisfied: libusb in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (1.0.22b9)

Requirement already satisfied: setuptools>=42.0.2 in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (from libusb) (45.1.0)

Requirement already satisfied: atpublic>=1.0.0 in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (from libusb) (1.0)

/***********

and the package seems to be install correctly.

Here a creenshoot of the folder 

At this point, I am not sure what is the next step.

  • I have just notice that nrfutil come with the libusb package.  have tried to reinstall nrfutil with the following command as stated in the nrfutil v1.3 document find on the web:When installing on macOS, you might get an error about the Python module six. In this case, enter the following command instead

    pip install --ignore-installed six nrfutil

    When generating the private key, I still have the same error : 

    OSError: dlopen(libusb-1.0.dylib, 6): image not found

    
    
  • Following the instruction, I have download tnrfutil installation pkg from Github.

    In Terminal.app I navigate to the folder and type : pip install -r requirements.txt

    Listing says that all requierent were satisfied, except this line :

       Ignoring antlib: markers 'sys_platform == "win32"' don't match your environment

    I  assume that Ok, its a Mac.

    have tried to run nrf_util without installation and this append:

    ****

     SLMini-I5-172:pc-nrfutil-master slareau$ python nordicsemi/__main__.py

      Traceback (most recent call last):

      File "nordicsemi/__main__.py", line 43, in <module>

        import click

    ImportError: No module named click

    ****

    I ran instead python3 command (not in the instruction):  python3 nordicsemi/__main__.py 

    ****

    SLMini-I5-172:pc-nrfutil-master slareau$ python3 nordicsemi/__main__.py 

    Traceback (most recent call last):

      File "nordicsemi/__main__.py", line 52, in <module>

        from nordicsemi.dfu.dfu_transport_serial import DfuTransportSerial

      File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/nordicsemi/dfu/dfu_transport_serial.py", line 53, in <module>

        from nordicsemi.dfu.dfu_trigger import DFUTrigger

      File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/nordicsemi/dfu/dfu_trigger.py", line 48, in <module>

        import usb1

      File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/usb1/__init__.py", line 61, in <module>

        from . import libusb1

      File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/usb1/libusb1.py", line 199, in <module>

        libusb = _loadLibrary()

      File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/usb1/libusb1.py", line 173, in _loadLibrary

        return dll_loader('libusb-1.0' + suffix, **loader_kw)

      File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/ctypes/__init__.py", line 364, in __init__

        self._handle = _dlopen(self._name, mode)

    OSError: dlopen(libusb-1.0.dylib, 6): image not found

    *****

    The // OSError: dlopen(libusb-1.0.dylib, 6): image not found // is the one I got previously - see beginning of the post 

    To install nrfutil, the python setup.py install does not work - it try to install the program with python 2.7 framework.  I had to use python3 setup.py install

    and then got  the error at the end of a long list:

    error: [Errno 13] Permission denied: '/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/easy-install.pth'

    I had to use the command: sudo python3 setup.py install,  and it work.

    I have then tried to run the command : pyinstaller nrfutil.spec

    and the command was not found.

    ***

    SLMini-I5-172:pc-nrfutil-master slareau$ pyinstaller nrfutil.spec

    -bash: pyinstaller: command not found

    *****

    Typing the command: nrfutil -- help    give and a long list ending by the following error:

    OSError: dlopen(libusb-1.0.dylib, 6): image not found

    Could it be that a file is misplace during the installation ? Please look at the screenshot.

  • Specific installation instruction for OsX would be nice since command differ from what is in the instruction.

    Had to use sudo and python3.

  • After the install command, I had the following warning , but the rest of the processs seems OK.

    SLMini-I5-172:pc-nrfutil-master slareau$ sudo python3 setup.py install

    /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/dist.py:274: UserWarning: Unknown distribution option: 'zipfile'

      warnings.warn(msg)

    /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/dist.py:274: UserWarning: Unknown distribution option: 'console'

      warnings.warn(msg)

    running install.....

Related