Skip to content

A truly modular keyboard

C

app: warn against run-after-programming over USB DFU

Nathan086c53eca8de
diff --git a/app/PROTOCOL.md b/app/PROTOCOL.md
index 81b7d89..9de07db 100644
--- a/app/PROTOCOL.md
+++ b/app/PROTOCOL.md
@@ -113,7 +113,7 @@ How the app does it (Settings → **Update Keyword firmware…**, or File → Up
- It checks the file first: a Cortex-M vector table whose reset handler is inside 0x08007000 plus the image size. That rejects `keyword_full.bin`, which is for USB DFU.
- It sends writes of 240 bytes (176 on macOS, whose usual MTU is 185), stepping down to 176 and then 16 if the first write is refused. Every write is a multiple of 8, and the last one is padded with `FF`, because the bootloader programs flash 8 bytes at a time.
-- If the Keyword reports no BLE stack, the app offers **Restart into USB DFU** instead.
+- If the Keyword reports no BLE stack, the app offers **Restart into USB DFU** instead. After DFU, flash with STM32CubeProgrammer and replug. Never use `-g`, `:leave`, `-startfus` or `-fwupgrade` over USB DFU: they rewrite nSWBOOT0 and can lock the Keyword out of DFU.
- With no Keyword connected, it goes straight to finding `Keyword OTA`, so it can recover a Keyword stuck in the bootloader.
## Computer actions (no protocol)
diff --git a/app/renderer/app.js b/app/renderer/app.js
index 918d97f..7b22012 100644
--- a/app/renderer/app.js
+++ b/app/renderer/app.js
@@ -1393,7 +1393,9 @@ $('#ota-dfu').onclick = async () => {
const m = await waitForMessage((x) => (x.type === 'ok' && x.what === 'DFU') || x.type === 'error', 2000);
if (m?.type === 'ok') {
await disconnect();
- otaSet('The Keyword is in USB DFU mode. Flash keyword_full.bin at 0x08000000 with STM32CubeProgrammer.');
+ // Over USB DFU, starting the app from the programmer (-g, :leave, -startfus, -fwupgrade)
+ // rewrites nSWBOOT0 and can lock the Keyword out of DFU.
+ otaSet('The Keyword is in USB DFU mode. Flash keyword_full.bin at 0x08000000 with STM32CubeProgrammer, then unplug and replug it. Don\'t use "run after programming" (-g / :leave) or the FUS/stack upgrade, which can lock it out of DFU.');
} else otaSet(m ? `Keyword: ${m.message}` : 'No reply from the Keyword.', { error: true });
};