70 lines
2.6 KiB
Plaintext
70 lines
2.6 KiB
Plaintext
Instructions for how to produce a frozen nrfutil executable on MacOS
|
|
|
|
These instructions describe how to use the cx_freeze tool to generate a
|
|
standalone self-contained (or 'frozen') version of the nrfutil script. This is
|
|
useful for distribution so users don't need to manually install it and deal
|
|
with potential python version headaches and more.
|
|
|
|
Initial setup (do this once):
|
|
- Get cx_freeze installed for _Python 2.7_. Very important to use Python 2 as
|
|
the nrfutil script doesn't work with Python 3 and cx_freeze will use whichever
|
|
version of Python it's run with to build the exe (i.e. you need to run
|
|
cx_freeze with Python 2.7). Assuming you have homebrew installed:
|
|
|
|
- Update python 2 in homebrew to the latest version, and reinstall just to
|
|
fix odd issues like links to old dynamic libraries that might be missing,
|
|
etc. Run:
|
|
|
|
brew update
|
|
brew reinstall python
|
|
|
|
Or if you never had homebrew python2 installed run:
|
|
|
|
brew install python
|
|
|
|
Now just to make sure homebrew python is setup and linked as the 'active'
|
|
python run:
|
|
|
|
brew unlink python && brew link python
|
|
|
|
- At this point when you run python or pip you should be using homebrew
|
|
python. Do not continue until this is true.
|
|
|
|
- Make sure there is no other version of cx_freeze already installed. Run
|
|
these to wipe it out if so (it's ok if these fail with errors that cx_freeze
|
|
isn't installed):
|
|
|
|
pip uninstall cx_freeze
|
|
pip2 uninstall cx_freeze
|
|
pip3 uninstall cx_freeze
|
|
|
|
- Install cx_freeze for homebrew python 2:
|
|
|
|
pip2 install cx_freeze
|
|
|
|
Make sure this completes successfully. You should be able to run the
|
|
cxfreeze script and verify it shows usage info:
|
|
|
|
cxfreeze
|
|
|
|
- Install nrfutil dependencies. Be sure to install them into homebrew's python
|
|
2 as this is what cx_freeze will run from and use to find dependencies. Run
|
|
from this directory:
|
|
|
|
pip2 install -r requirements.txt
|
|
python setup.py install
|
|
|
|
- That's it, you should be setup with cx_freeze on homebrew python 2 and all
|
|
the nrfutil dependencies ready to go.
|
|
|
|
Generating a frozen nrfutil:
|
|
- You'll run a cxfreeze command to generate the executable and place it in
|
|
the binaries/macos location under the name nrfutil. From this directory run:
|
|
|
|
cxfreeze ./nordicsemi/__main__.py --target-dir binaries/macos --target-name nrfutil
|
|
|
|
If it completes without an error message then everything should be good. Try
|
|
running ./binaries/macos/nrfutil to make sure you can get usage info. The
|
|
boards.txt should already be pointing to this file so try using it in Arduino
|
|
to upload to a board.
|