Skip to content

Commit fc955b1

Browse files
committed
remove bootloader binaries, update readme for using adafruit-nrufitl and flashing bootloader
1 parent df4184e commit fc955b1

11 files changed

Lines changed: 40 additions & 22119 deletions

ports/nrf/README.md

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ Target Board (BOARD) | Bluetooth Stack (SD) | Bluetooth Support | Flash
7979
pca10040 | s132 | Peripheral and Scanner | [Segger](#segger-targets)
8080
feather52832 | s132 | Peripheral and Scanner | [UART DFU](#dfu-targets)
8181
pca10056 | s140 | Peripheral and Scanner | [Segger](#segger-targets)
82+
feather52840 | s140 | Peripheral and Scanner | [UART DFU](#dfu-targets)
8283

8384
## Segger Targets
8485

@@ -98,11 +99,9 @@ note: On Linux it might be required to link SEGGER's `libjlinkarm.so` inside nrf
9899

99100
## DFU Targets
100101

101-
sudo apt-get install build-essential libffi-dev pkg-config gcc-arm-none-eabi git python python-pip
102-
git clone https://github.com/adafruit/Adafruit_nRF52_Arduino.git
103-
cd Adafruit_nRF52_Arduino/tools/nrfutil-0.5.2/
104-
sudo pip install -r requirements.txt
105-
sudo python setup.py install
102+
run follow command to install [adafruit-nrfutil](https://github.com/adafruit/Adafruit_nRF52_nrfutil) from PyPi
103+
104+
$ pip3 install adafruit-nrfutil --user
106105

107106
**make flash** and **make sd** will not work with DFU targets. Hence, **dfu-gen** and **dfu-flash** must be used instead.
108107
* dfu-gen: Generates a Firmware zip to be used by the DFU flash application.
@@ -111,8 +110,7 @@ note: On Linux it might be required to link SEGGER's `libjlinkarm.so` inside nrf
111110
Example on how to generate and flash feather52832 target:
112111

113112
make BOARD=feather52832 SD=s132
114-
make BOARD=feather52832 SD=s132 dfu-gen
115-
make BOARD=feather52832 SD=s132 dfu-flash
113+
make BOARD=feather52832 SD=s132 dfu-gen dfu-flash
116114

117115
## Bluetooth LE REPL
118116

ports/nrf/boards/feather52832/README.md

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -21,24 +21,15 @@ $ cd ports/nrf
2121
$ ./drivers/bluetooth/download_ble_stack.sh
2222
```
2323

24-
## Installing `nrfutil`
24+
## Installing `adafruit-nrfutil`
2525

2626
The Adafruit Bluefruit nRF52 Feather ships with a serial and OTA BLE bootloader
2727
that can be used to flash firmware images over a simple serial connection,
2828
using the on-board USB serial converter.
2929

30-
If you haven't installed this command-line tool yet, go to the `/libs/nrfutil`
31-
folder (where nrfutil 0.5.2 is installed as a sub-module) and run the following
32-
commands:
30+
run follow command to install [adafruit-nrfutil](https://github.com/adafruit/Adafruit_nRF52_nrfutil) from PyPi
3331

34-
> If you get a 'sudo: pip: command not found' error running 'sudo pip install',
35-
you can install pip via 'sudo easy_install pip'
36-
37-
```
38-
$ cd ../../lib/nrfutil
39-
$ sudo pip install -r requirements.txt
40-
$ sudo python setup.py install
41-
```
32+
$ pip3 install adafruit-nrfutil --user
4233

4334
# Building and flashing firmware images
4435

@@ -75,7 +66,7 @@ You can then connect over BLE UART using an application like Bluefruit LE
7566
Connect, available for Android, iOS and OS X, or any other application that
7667
supports the NUS service and allows you to send the corrent EOL sequence.
7768

78-
## Flashing binaries with `nrfutil`
69+
## Flashing binaries with `adafruit-nrfutil`
7970

8071
### 1. **Update bootloader** to single-bank version
8172

@@ -90,20 +81,25 @@ Due to the size of CircuitPython, we must migrate this bootloader to a
9081
bootloader from the dual-bank version that ships on Arduino-based Adafruit
9182
Feather52 boards to a single-bank CircuitPython compatible version:
9283

84+
Firstly clone the [Adafruit_nRF52_Bootloader](https://github.com/adafruit/Adafruit_nRF52_Bootloader.git) and enter its directory
85+
86+
$ git clone https://github.com/adafruit/Adafruit_nRF52_Bootloader.git
87+
$ cd Adafruit_nRF52_Bootloader
88+
9389
#### S132 v2.0.1 single-bank (recommended):
9490

95-
By default s132 v2.0.1 is used when no `SOFTDEV_VERSION` field is passed in:
91+
To flash bootloader with s132 v2.0.1
9692

9793
```
98-
$ make BOARD=feather52832 SERIAL=/dev/tty.SLAB_USBtoUART boot-flash
94+
$ make BOARD=feather_nrf52832 VERSION=2.0.1 SERIAL=/dev/tty.SLAB_USBtoUART dfu-flash
9995
```
10096

10197
#### S132 v5.0.0 (BLE5, experimental):
10298

103-
To enable BLE5 support and the latest S132 release, flash the v5.0.0 bootloader via:
99+
To flash bootloader with s132 v5.0.0
104100

105101
```
106-
$ make BOARD=feather52832 SERIAL=/dev/tty.SLAB_USBtoUART SOFTDEV_VERSION=5.0.0 boot-flash
102+
$ make BOARD=feather52832 VERSION=5.0.0 SERIAL=/dev/tty.SLAB_USBtoUART dfu-flash
107103
```
108104

109105
### 2. Generate and flash a CircuitPython DFU .zip package over serial

ports/nrf/boards/feather52832/bootloader/.gitattributes

Lines changed: 0 additions & 2 deletions
This file was deleted.

ports/nrf/boards/feather52832/bootloader/README.md

Lines changed: 0 additions & 9 deletions
This file was deleted.
Binary file not shown.
Binary file not shown.

ports/nrf/boards/feather52840/README.md

Lines changed: 22 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ update the core CircuitPython firmware and internal file system contents
4343
using only a serial connection.
4444

4545
On empty devices, the serial bootloader will need to be flashed once using a
46-
HW debugger such as a Segger J-Link before the serial updater (`nrfutil`) can
46+
HW debugger such as a Segger J-Link before the serial updater (`adafruit-nrfutil`) can
4747
be used.
4848

4949
### Install `nrfjprog`
@@ -79,20 +79,27 @@ JLinkARM.dll version: 6.20f
7979
> This operation only needs to be done once, and only on boards that don't
8080
already have the serial bootloader installed.
8181

82+
Firstly clone the [Adafruit_nRF52_Bootloader](https://github.com/adafruit/Adafruit_nRF52_Bootloader.git) and enter its directory
83+
84+
```
85+
$ git clone https://github.com/adafruit/Adafruit_nRF52_Bootloader.git
86+
$ cd Adafruit_nRF52_Bootloader
87+
```
88+
8289
Once `nrfjprog` is installed and available in `PATH` you can flash your
8390
board with the serial bootloader via the following command:
8491

8592
```
86-
make SD=s140 BOARD=feather52840 bootloader
93+
make BOARD=feather_nrf52840_express VERSION=latest flash
8794
```
8895

8996
This should give you the following (or very similar) output, and you will see
9097
a DFU blinky pattern on one of the board LEDs:
9198

9299
```
93-
$ make SD=s140 BOARD=feather52840 bootloader
94-
Use make V=1, make V=2 or set BUILD_VERBOSE similarly in your environment to increase build verbosity.
95-
nrfjprog --program boards/feather52840/bootloader/feather52840_bootloader_6.0.0_s140_single.hex -f nrf52 --chiperase --reset
100+
$ make BOARD=pca10056 VERSION=latest flash
101+
Flashing: bin/pca10056/6.0.0r0/pca10056_bootloader_s140_6.0.0r0.hex
102+
nrfjprog --program bin/pca10056/6.0.0r0/pca10056_bootloader_s140_6.0.0r0.hex --chiperase -f nrf52 --reset
96103
Parsing hex file.
97104
Erasing user available code and UICR flash areas.
98105
Applying system reset.
@@ -105,6 +112,8 @@ Run.
105112
From this point onward, you can now use a simple serial port for firmware
106113
updates.
107114

115+
Note: You can specify other version that are available in the directory `Adafruit_nRF52_Bootloader/bin/feather_nrf52840_express/` . The `VERSION=latest` will use the latest bootloader available.
116+
108117
### IMPORTANT: Disable Mass Storage on PCA10056 J-Link
109118

110119
The J-Link firmware on the PCA10056 implement USB Mass Storage, but this
@@ -135,31 +144,14 @@ J-Link>exit
135144

136145
## Building and Flashing CircuitPython
137146

138-
### Installing `nrfutil`
147+
### Installing `adafruit-nrfutil`
139148

140-
If you haven't installed the required command-line tool yet, go to the
141-
`/libs/nrfutil` folder (where nrfutil 0.5.2b is installed as a sub-module)
142-
and run the following commands:
143-
144-
> If you get a 'sudo: pip: command not found' error running 'sudo pip install',
145-
you can install pip via 'sudo easy_install pip'
149+
run follow command to install [adafruit-nrfutil](https://github.com/adafruit/Adafruit_nRF52_nrfutil) from PyPi
146150

147151
```
148-
$ cd ../../lib/nrfutil
149-
$ sudo pip install -r requirements.txt
150-
$ sudo python setup.py install
152+
$ pip3 install adafruit-nrfutil --user
151153
```
152154

153-
#### Changes to `nrfutil` in 0.5.2d
154-
155-
**IMPORTANT**: Make sure that you have version **0.5.2d**, since a small
156-
change was required to `dfu_transport_serial.py` to account for the
157-
increased minimum flash erase time on the nRF52840 compared to the earlier
158-
nRF52832!
159-
160-
You can also manually change the file with the following new values (lines
161-
67-68), and reinstall the utility via `sudo python setup.py install`:
162-
163155
### Flashing CircuitPython with USB CDC
164156

165157
With the serial bootloader present on your board, you first need to force your
@@ -169,8 +161,7 @@ BUTTON1 still pressed as you come out of reset).
169161
This will give you a **fast blinky DFU pattern** to indicate you are in DFU
170162
mode.
171163

172-
At this point, you can **build and flash** a CircuitPython binary via the following
173-
command:
164+
you can **build and flash** a CircuitPython binary via the following command:
174165

175166
```
176167
$ make V=1 SD=s140 SERIAL=/dev/tty.usbmodem1411 BOARD=feather52840 all dfu-gen dfu-flash
@@ -197,19 +188,19 @@ Device programmed.
197188

198189
### Flashing CircuitPython with MSC UF2
199190

200-
Make `uf2` target to generate the uf2
191+
uf2 file is generated at the end of `all` target
201192

202193
```
203-
$ make V=1 SD=s140 SERIAL=/dev/tty.usbmodem1411 BOARD=feather52840 all uf2
194+
$ make V=1 SD=s140 SERIAL=/dev/tty.usbmodem1411 BOARD=feather52840 all
204195
Create firmware.uf2
205-
../../tools/uf2/utils/uf2conv.py -c -o "build-feather52840-s140/firmware.uf2" "build-feather52840-s140/firmware.hex"
196+
../../tools/uf2/utils/uf2conv.py -f 0xADA52840 -c -o "build-feather52840-s140/firmware.uf2" "build-feather52840-s140/firmware.hex"
206197
Converting to uf2, output size: 392192, start address: 0x26000
207198
Wrote 392192 bytes to build-feather52840-s140/firmware.uf2.
208199
```
209200

210201
Simply drag and drop firmware.uf2 to the MSC, the nrf52840 will blink fast and reset after done.
211202

212-
**Note**: you need to update `tools/uf2` for uf2conv.py to support hex file input, current circuitpython's master use older verion of uf2conv.py which only support biin file input. To update, change directory to top folder of circuitpython and run. The size of uf2 should be ~400KB, if using the old uf2conv.py the output file would be 1 MB which is not correct.
203+
**Note**: you need to update `tools/uf2` for uf2conv.py to support hex file input, current circuitpython's master use older verion of uf2conv.py which only support bin file input. To update, change directory to top folder of circuitpython and run. The size of uf2 should be ~400KB, if using the old uf2conv.py the output file would be 1 MB which is not correct.
213204

214205
```
215206
git submodule update --init

0 commit comments

Comments
 (0)