فهرست منبع

Update BUILD_AND_DEPLOY.md

Jariullah Safi 4 ماه پیش
والد
کامیت
15ff48fd50
1فایلهای تغییر یافته به همراه31 افزوده شده و 0 حذف شده
  1. 31 0
      docs/BUILD_AND_DEPLOY.md

+ 31 - 0
docs/BUILD_AND_DEPLOY.md

@@ -14,6 +14,7 @@ Software:
 
 
 - `arduino-cli`
 - `arduino-cli`
 - Adafruit nRF52 Arduino core
 - Adafruit nRF52 Arduino core
+- `adafruit-nrfutil` (Python package, for DFU packaging - see "Build the firmware")
 - Chrome or Edge for the WebUSB app
 - Chrome or Edge for the WebUSB app
 
 
 ## 2. Install Arduino CLI
 ## 2. Install Arduino CLI
@@ -37,6 +38,7 @@ Use [choco](https://chocolatey.org/) and do a `choco install arduino-cli`. If yo
 Run once on any platform:
 Run once on any platform:
 
 
 ```bash
 ```bash
+pip install adafruit-nrfutil         # DFU packaging helper (required by the Adafruit nRF52 build recipe)
 arduino-cli config init
 arduino-cli config init
 arduino-cli core update-index
 arduino-cli core update-index
 arduino-cli core install adafruit:nrf52 --additional-urls https://adafruit.github.io/arduino-board-index/package_adafruit_index.json
 arduino-cli core install adafruit:nrf52 --additional-urls https://adafruit.github.io/arduino-board-index/package_adafruit_index.json
@@ -95,6 +97,35 @@ arduino-cli upload `
 
 
 Replace `COM5` with the actual board port.
 Replace `COM5` with the actual board port.
 
 
+## 5b. Upload via DFU (nRF52840 UF2 bootloader)
+
+If the board has the **Adafruit nRF52 UF2 bootloader** (common on Pro Micro nRF52840 boards), you can upload by dragging the compiled `.uf2` file onto the board's mass-storage volume:
+
+1. **Double-tap the RST button**. The board mounts as a **UF2BOOT** / **NRF52BOOT** drive.
+2. Locate the compiled `.uf2` file:
+
+   ```bash
+   # After a successful `arduino-cli compile`, find the .uf2 in the build directory:
+   ls /tmp/arduino/cores/adafruit_nrf52_adafruit52840/*.uf2
+   # or, on Windows, look in %TEMP%\arduino\...
+   ```
+
+3. **Copy the `.uf2` file** onto the UF2BOOT drive. The board auto-ejects and reboots with the new firmware.
+
+Alternatively, use the **adafruit-nrfutil DFU** Python tool with the board in DFU mode (bootloader LED pulsing):
+
+```bash
+# Enter DFU mode (double-tap RST). On Linux/macOS:
+adafruit-nrfutil --verbose dfu serial --package OpenPuck/OpenPuck.ino.adafruit_nrf52_feather52840.zip -p /dev/ttyACM0 -b 115200
+
+# On Windows (PowerShell):
+adafruit-nrfutil --verbose dfu serial --package OpenPuck/OpenPuck.ino.adafruit_nrf52_feather52840.zip -p COM5 -b 115200
+```
+
+Replace the port (`/dev/ttyACM0` / `COM5`) with the actual board port.
+
+> **Note:** The `.zip` package is generated automatically by `arduino-cli compile` when the Adafruit nRF52 core is used. If it is missing, ensure `adafruit-nrfutil` is installed and recompile.
+
 ## 6. Factory reset (erase persistent storage)
 ## 6. Factory reset (erase persistent storage)
 
 
 Re-flashing firmware does **not** erase the board's internal LittleFS. The paired-controller bond (`bonds.bin`) and every saved setting (`cfg.bin`: USB mode, chord assignments, back-paddle map, mouse sensitivity) survive a fresh build and upload. To bring a board up in a truly clean state — a new unit, a hand-me-down with a stale bond, or a corrupted config — wipe the filesystem with one of:
 Re-flashing firmware does **not** erase the board's internal LittleFS. The paired-controller bond (`bonds.bin`) and every saved setting (`cfg.bin`: USB mode, chord assignments, back-paddle map, mouse sensitivity) survive a fresh build and upload. To bring a board up in a truly clean state — a new unit, a hand-me-down with a stale bond, or a corrupted config — wipe the filesystem with one of: