From 7675bb1b4621d723e743efbbb1e608e9d52a17e8 Mon Sep 17 00:00:00 2001 From: Jorge Aparicio Date: Tue, 5 Jan 2021 10:57:07 +0100 Subject: [PATCH] document nrfutil python 3.9 workaround --- embedded-workshop-book/src/installation.md | 67 +++++++++++++++++++++- 1 file changed, 66 insertions(+), 1 deletion(-) diff --git a/embedded-workshop-book/src/installation.md b/embedded-workshop-book/src/installation.md index 35d6694..b1d036e 100644 --- a/embedded-workshop-book/src/installation.md +++ b/embedded-workshop-book/src/installation.md @@ -223,6 +223,71 @@ $ nrfutil version nrfutil version 6.1.0 ``` +**NOTE** as of version 6.1.0 nrfutil indicates that it does "not" support Python 3.9 in its pip manifest. Due to this, the above `pip install` command will fail if you have a Python 3.9 interpreter installed. Here's how to work around the issue: + +*start of nrfutil python 3.9 workaround* + +``` console +$ # these steps can also be done via a graphical interface + +$ # fetch the source code of version 6.1.0 +$ # or instead of curl you can enter the URL into your web browser +$ curl -LO https://github.com/NordicSemiconductor/pc-nrfutil/archive/v6.1.zip + +$ # unzip the code +$ unzip v6.1.zip + +$ # go into the new folder +$ cd pc-nrfutil-6.1 +``` + +Apply the following 2 patches (can also be done manually by editing these 2 files: `requirements.txt` and `setup.py`) + +``` diff +--- a/requirements.txt 2021-01-05 10:50:12.611556607 +0100 ++++ b/requirements.txt 2021-01-05 10:50:09.718226891 +0100 +@@ -4,7 +4,7 @@ + ecdsa + intelhex + libusb1 +-pc_ble_driver_py >= 0.14.2 ++# pc_ble_driver_py >= 0.14.2 + piccata + protobuf + pyserial +``` + +``` diff +--- a/setup.py 2021-01-05 10:49:56.014910707 +0100 ++++ b/setup.py 2021-01-05 10:50:26.004873175 +0100 +@@ -148,7 +148,7 @@ + '../libusb/x86/libusb-1.0.dll', '../libusb/x64/libusb-1.0.dll', + '../libusb/x64/libusb-1.0.dylib', '../libusb/LICENSE'] + }, +- python_requires='>=3.6, <3.9', ++ python_requires='>=3.6, <3.10', + install_requires=reqs, + zipfile=None, + tests_require=[ +``` + +``` console +$ patch -p1 < requirements.patch +$ patch -p1 < setup.patch +``` + +Then install the patched `nrfutil` + +``` console +$ pip install . + +$ # verify installation +$ nrfutil version +nrfutil version 6.1.0 +``` + +*end of nrfutil python 3.9 workaround* + ### `nrf-recover` Some nRF52840 devices, specially older revisions, may have parts of their Flash memory locked. To unlock the memory use the [`nrf-recover`](https://crates.io/crates/nrf-recover) tool. @@ -235,4 +300,4 @@ $ cargo install nrf-recover $ nrf-recover -y Starting mass erase... Mass erase completed, chip unlocked -``` \ No newline at end of file +```