Skip to content

Commit 546a677

Browse files
committed
Add frozen nrfutil tool for macOS, and instructions for generating with cx_freeze.
1 parent b710d6f commit 546a677

File tree

124 files changed

+2511
-1
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

124 files changed

+2511
-1
lines changed

boards.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,12 @@ feather52.build.lfclk_flags=-DUSE_LFXO
4848

4949
feather52.build.nrfutil=nrfutil
5050
feather52.build.nrfutil.windows={runtime.platform.path}/tools/nrfutil-0.5.2/binaries/win32/nrfutil.exe
51-
feather52.build.nrfutil.macosx=/usr/local/bin/nrfutil
51+
# Legacy MacOS nrfutil location, this is for when people had it globally
52+
# installed and is left just for reference:
53+
# feather52.build.nrfutil.macosx=/usr/local/bin/nrfutil
54+
# Frozen MacOS nrfutil location, this uses a frozen or pre-built standalone
55+
# version of nrfutil included in the BSP (no manual install required):
56+
feather52.build.nrfutil.macosx={runtime.platform.path}/tools/nrfutil-0.5.2/binaries/macos/nrfutil
5257

5358
feather52.menu.debug.l0=Level 0 (Release)
5459
feather52.menu.debug.l0.build.debug_flags=-DCFG_DEBUG=0

tools/nrfutil-0.5.2/MACOS_FREEZE.txt

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
Instructions for how to produce a frozen nrfutil executable on MacOS
2+
3+
These instructions describe how to use the cx_freeze tool to generate a
4+
standalone self-contained (or 'frozen') version of the nrfutil script. This is
5+
useful for distribution so users don't need to manually install it and deal
6+
with potential python version headaches and more.
7+
8+
Initial setup (do this once):
9+
- Get cx_freeze installed for _Python 2.7_. Very important to use Python 2 as
10+
the nrfutil script doesn't work with Python 3 and cx_freeze will use whichever
11+
version of Python it's run with to build the exe (i.e. you need to run
12+
cx_freeze with Python 2.7). Assuming you have homebrew installed:
13+
- Update python 2 in homebrew to the latest version, and reinstall just to
14+
fix odd issues like links to old dynamic libraries that might be missing,
15+
etc. Run:
16+
brew update
17+
brew reinstall python
18+
19+
Or if you never had homebrew python2 installed run:
20+
brew install python
21+
22+
Now just to make sure homebrew python is setup and linked as the 'active'
23+
python run:
24+
brew unlink python && brew link python
25+
- At this point when you run python or pip you should be using homebrew
26+
python. Do not continue until this is true.
27+
- Install cx_freeze for homebrew python 2:
28+
29+
pip2 install cx_freeze
30+
31+
Make sure this completes successfully. You should be able to run the
32+
cxfreeze script and verify it shows usage info:
33+
34+
cxfreeze
35+
- Install nrfutil dependencies. Be sure to install them into homebrew's python
36+
2 as this is what cx_freeze will run from and use to find dependencies. Run
37+
from this directory:
38+
39+
pip2 install -r requirements.txt
40+
python setup.py install
41+
- That's it, you should be setup with cx_freeze on homebrew python 2 and all
42+
the nrfutil dependencies ready to go.
43+
44+
Generating a frozen nrfutil:
45+
- You'll run a cxfreeze command to generate the executable and place it in
46+
the binaries/macos location under the name nrfutil. From this directory run:
47+
48+
cxfreeze ./nordicsemi/__main__.py --target-dir binaries/macos --target-name nrfutil
49+
50+
If it completes without an error message then everything should be good. Try
51+
running ./binaries/macos/nrfutil to make sure you can get usage info. The
52+
boards.txt should already be pointing to this file so try using it in Arduino
53+
to upload to a board.
1.41 MB
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)