[メモ] nrfutil をラズパイで使う

# 概要
ラズパイで、`nrfutil`を使ってDfuパッケージを作成したいのだが、`pip3 install nrfutil`をそのまま実行すると、`No matching distribution found for pc-ble-driver-py>=0.14.2 (from nrfutil)` というエラーが出てインストールできないので、`pc-ble-driver-py`をビルドした。

- Dfuの作成程度の動作確認しかしていない。

# 環境

- Raspberry Pi: 4B 
- OS: `2020-08-20-raspios-buster-armhf` または `2020-08-20-raspios-buster-armhf-lite`


# 手順

1. 初期設定(OSの書き込み、ネットワークの設定など)
2. パッケージ更新、`pip3`インストール、再起動

    ```bash:コピペ
    #echo 'Acquire::http::Proxy "http://apt-cache-server.local:3142";' | sudo tee /etc/apt/apt.conf.d/02proxy
    sudo apt update && \
    sudo apt upgrade -y && \
    sudo apt install -y python3-pip && \
    sudo reboot
    ```

3. インストール

    ```bash:一行ずつコピペ
    sudo pip3 install https://github.com/mt08xx/files/raw/master/pc_ble_driver_py-0.14.2-cp37-cp37m-linux_armv7l.whl
    sudo pip3 install nrfutil
    ```




# 実行例
- インストール

```shell-session:
pi@raspberrypi:~ $ sudo pip3 install https://github.com/mt08xx/files/raw/master/pc_ble_driver_py-0.14.2-cp37-cp37m-linux_armv7l.whl
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting pc-ble-driver-py==0.14.2 from https://github.com/mt08xx/files/raw/master/pc_ble_driver_py-0.14.2-cp37-cp37m-linux_armv7l.whl
  Downloading https://github.com/mt08xx/files/raw/master/pc_ble_driver_py-0.14.2-cp37-cp37m-linux_armv7l.whl (2.2MB)
    100% |████████████████████████████████| 2.2MB 196kB/s 
Collecting wrapt (from pc-ble-driver-py==0.14.2)
  Downloading https://www.piwheels.org/simple/wrapt/wrapt-1.12.1-cp37-cp37m-linux_armv7l.whl (68kB)
    100% |████████████████████████████████| 71kB 228kB/s 
Collecting future (from pc-ble-driver-py==0.14.2)
  Downloading https://www.piwheels.org/simple/future/future-0.18.2-py3-none-any.whl (491kB)
    100% |████████████████████████████████| 491kB 318kB/s 
Installing collected packages: wrapt, future, pc-ble-driver-py
Successfully installed future-0.18.2 pc-ble-driver-py-0.14.2 wrapt-1.12.1
pi@raspberrypi:~ $ sudo pip3 install nrfutil
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting nrfutil
  Downloading https://www.piwheels.org/simple/nrfutil/nrfutil-6.1.0-py3-none-any.whl (897kB)
    100% |████████████████████████████████| 901kB 246kB/s 
Collecting click (from nrfutil)
  Downloading https://files.pythonhosted.org/packages/d2/3d/fa76db83bf75c4f8d338c2fd15c8d33fdd7ad23a9b5e57eb6c5de26b430e/click-7.1.2-py2.py3-none-any.whl (82kB)
    100% |████████████████████████████████| 92kB 1.6MB/s 
Collecting pyyaml (from nrfutil)
  Downloading https://www.piwheels.org/simple/pyyaml/PyYAML-5.3.1-cp37-cp37m-linux_armv7l.whl (44kB)
    100% |████████████████████████████████| 51kB 3.7MB/s 
Collecting crcmod (from nrfutil)
  Downloading https://www.piwheels.org/simple/crcmod/crcmod-1.7-cp37-cp37m-linux_armv7l.whl
Collecting pyspinel>=1.0.0a3 (from nrfutil)
  Downloading https://files.pythonhosted.org/packages/80/e2/12156b8f2d0b6e0bcd169e6df078cbeb432312a5b2da8250b200975e4bac/pyspinel-1.0.1-py3-none-any.whl (69kB)
    100% |████████████████████████████████| 71kB 1.9MB/s 
Collecting tqdm (from nrfutil)
  Downloading https://files.pythonhosted.org/packages/0a/0e/ea53a3d6f1eb2cc31162c9ae89555cc26a3986e5559781f0b0df75aea5cf/tqdm-4.50.0-py2.py3-none-any.whl (70kB)
    100% |████████████████████████████████| 71kB 3.1MB/s 
Collecting pyserial (from nrfutil)
  Downloading https://files.pythonhosted.org/packages/0d/e4/2a744dd9e3be04a0c0907414e2a01a7c88bb3915cbe3c8cc06e209f59c30/pyserial-3.4-py2.py3-none-any.whl (193kB)
    100% |████████████████████████████████| 194kB 1.8MB/s 
Requirement already satisfied: pc-ble-driver-py>=0.14.2 in /usr/local/lib/python3.7/dist-packages (from nrfutil) (0.14.2)
Collecting ecdsa (from nrfutil)
  Downloading https://files.pythonhosted.org/packages/5d/8b/c6ea939f70b3356e10e771a8d5ef27fd8ecc74d9e49ec8116d94f83b9673/ecdsa-0.16.0-py2.py3-none-any.whl (103kB)
    100% |████████████████████████████████| 112kB 3.1MB/s 
Collecting intelhex (from nrfutil)
  Downloading https://files.pythonhosted.org/packages/bf/77/bf670318b3db325c71e2ac6a90b7bcfdf9fc739b7cf6aebb31715721623e/intelhex-2.2.1-py2.py3-none-any.whl (50kB)
    100% |████████████████████████████████| 51kB 2.3MB/s 
Collecting protobuf (from nrfutil)
  Downloading https://files.pythonhosted.org/packages/3b/ba/276d817d4b0184e544a9295e14e95f6148af5c5652033d30eb63d2c13bfa/protobuf-3.13.0-py2.py3-none-any.whl (438kB)
    100% |████████████████████████████████| 440kB 896kB/s 
Collecting libusb1 (from nrfutil)
  Downloading https://www.piwheels.org/simple/libusb1/libusb1-1.8-py3-none-any.whl (49kB)
    100% |████████████████████████████████| 51kB 158kB/s 
Collecting piccata (from nrfutil)
  Downloading https://files.pythonhosted.org/packages/19/4d/711f14ad4fd6de8c54143b404ddf8c203a52e2501227b137c9bb0e0ec55b/piccata-2.0.1-py3-none-any.whl
Collecting ipaddress (from pyspinel>=1.0.0a3->nrfutil)
  Downloading https://files.pythonhosted.org/packages/c2/f8/49697181b1651d8347d24c095ce46c7346c37335ddc7d255833e7cde674d/ipaddress-1.0.23-py2.py3-none-any.whl
Requirement already satisfied: future in /usr/local/lib/python3.7/dist-packages (from pc-ble-driver-py>=0.14.2->nrfutil) (0.18.2)
Requirement already satisfied: wrapt in /usr/local/lib/python3.7/dist-packages (from pc-ble-driver-py>=0.14.2->nrfutil) (1.12.1)
Requirement already satisfied: six>=1.9.0 in /usr/lib/python3/dist-packages (from ecdsa->nrfutil) (1.12.0)
Requirement already satisfied: setuptools in /usr/lib/python3/dist-packages (from protobuf->nrfutil) (40.8.0)
Installing collected packages: click, pyyaml, crcmod, ipaddress, pyserial, pyspinel, tqdm, ecdsa, intelhex, protobuf, libusb1, piccata, nrfutil
Successfully installed click-7.1.2 crcmod-1.7 ecdsa-0.16.0 intelhex-2.2.1 ipaddress-1.0.23 libusb1-1.8 nrfutil-6.1.0 piccata-2.0.1 protobuf-3.13.0 pyserial-3.4 pyspinel-1.0.1 pyyaml-5.3.1 tqdm-4.50.0
pi@raspberrypi:~ $ 
pi@raspberrypi:~ $ nrfutil --help
Usage: nrfutil [OPTIONS] COMMAND [ARGS]...

Options:
  -v, --verbose            Increase verbosity of output. Can be specified more
                           than once (up to -v -v -v -v).

  -o, --output <filename>  Log output to file
  --help                   Show this message and exit.

Commands:
  dfu       Perform a Device Firmware Update over serial, BLE, Thread, Zigbee
            or ANT transport given a DFU package (zip file).

  keys      Generate and display private and public keys.
  pkg       Display or generate a DFU package (zip file).
  settings  Generate and display Bootloader DFU settings.
  version   Display nrfutil version.
  zigbee    Zigbee-related commands and utilities.
pi@raspberrypi:~ $ nrfutil version
nrfutil version 6.1.0
pi@raspberrypi:~ $ 
```


# TODO
- ` pc-ble-driver-py` のビルド方法を書く。