Skip to content

fix split BLE DFU notification readiness - #2

Open
colonelpanic8 wants to merge 1 commit into
fix/ble-split-dfu-compilefrom
fix/dfu-split-not-subscribed
Open

fix split BLE DFU notification readiness#2
colonelpanic8 wants to merge 1 commit into
fix/ble-split-dfu-compilefrom
fix/dfu-split-not-subscribed

Conversation

@colonelpanic8

@colonelpanic8 colonelpanic8 commented Jul 20, 2026

Copy link
Copy Markdown
Owner

Summary

  • keep the immediate firmware-hash announcement for serial split transports only
  • detect the split notification CCCD write in the BLE peripheral
  • after accepting that write, announce the firmware hash only if notifications are enabled
  • recognize TrouBLE's Error::NotSubscribed as an expected readiness condition

Why

The peripheral previously attempted its one-shot firmware-hash announcement before the central subscribed, so the notification could be dropped.

This handles readiness at the BLE transport boundary. Accepting the CCCD write updates TrouBLE's subscription state; RMK then checks should_notify and sends the hash. This avoids the generic first-message proxy and announcement state machine from rmk-rs#978.

Validation

  • RUST_MIN_STACK=16777216 cargo +1.97.0 clippy --bin peripheral --features rmk/dfu_rp,rmk/dfu_split -- -D warnings in examples/use_rust/pi_pico_w_ble_split
  • cargo +1.92 check --bins in examples/use_rust/pi_pico_w_ble_split
  • cargo +1.97.0 check --bins in examples/use_rust/rp2040_dfu_split
  • cargo +1.92 clippy --no-default-features --features=split,vial,storage,async_matrix,_ble -- -D warnings in rmk
  • sh scripts/format_all.sh --touched
  • git diff --check

Stacked on #4. The TrouBLE revision and generated lockfiles are isolated in #3. Upstream change: embassy-rs/trouble#649.

@colonelpanic8
colonelpanic8 force-pushed the fix/dfu-split-not-subscribed branch from ec50328 to 8bdd8a8 Compare July 20, 2026 07:59
@colonelpanic8
colonelpanic8 changed the base branch from main to deps/trouble-not-subscribed July 20, 2026 07:59
@github-actions

Copy link
Copy Markdown

Size Report

Example main PR Diff .text .data .bss
use_config/nrf52832_ble 390.1 KiB 390.1 KiB +0.00% ⬆️ +36 0 0
use_config/nrf52840_ble 435.3 KiB 435.4 KiB +0.00% ⬆️ +36 0 0
use_config/nrf52840_ble_split (central) 489.0 KiB 489.0 KiB +0.00% ⬆️ +32 0 0
use_config/nrf52840_ble_split (peripheral) 315.9 KiB 316.2 KiB +0.08% ⬆️ +284 0 0
use_config/pi_pico_w_ble 663.4 KiB 663.4 KiB +0.01% ⬆️ +68 0 0
use_config/rp2040 145.6 KiB 145.6 KiB +0.00% 0 0 0
use_config/rp2040_split (central) 159.2 KiB 159.2 KiB +0.00% 0 0 0
use_config/rp2040_split (peripheral) 27.8 KiB 27.8 KiB +0.00% 0 0 0
use_config/stm32f1 61.8 KiB 61.8 KiB +0.00% 0 0 0
use_config/stm32h7 99.0 KiB 99.0 KiB +0.00% 0 0 0
use_rust/nrf52832_ble 377.3 KiB 377.3 KiB +0.01% ⬆️ +40 0 0
use_rust/nrf52840_ble 432.0 KiB 432.0 KiB +0.00% ⬆️ +32 0 0
use_rust/nrf52840_ble_split (central) 497.4 KiB 497.5 KiB +0.00% ⬆️ +36 0 0
use_rust/nrf52840_ble_split (peripheral) 312.1 KiB 312.3 KiB +0.08% ⬆️ +264 0 0
use_rust/pi_pico_w_ble 663.6 KiB 663.7 KiB +0.01% ⬆️ +72 0 0
use_rust/rp2040 145.1 KiB 145.1 KiB +0.00% 0 0 0
use_rust/rp2040_split (central) 158.0 KiB 158.0 KiB +0.00% 0 0 0
use_rust/rp2040_split (peripheral) 28.2 KiB 28.2 KiB +0.00% 0 0 0
use_rust/stm32f1 61.3 KiB 61.3 KiB +0.00% 0 0 0
use_rust/stm32h7 119.6 KiB 119.6 KiB +0.00% ⬇️ -4 0 0
use_config/nrf52832_ble — 390.1 KiB → 390.1 KiB (+0.00% ⬆️)

cargo size (PR):

   text	   data	    bss	    dec	    hex	filename
 361460	   4588	  33456	 399504	  61890	rmk-nrf52832

cargo size (main):

   text	   data	    bss	    dec	    hex	filename
 361424	   4588	  33456	 399468	  6186c	rmk-nrf52832

Bloaty diff (PR vs main):

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.0%    +806  [ = ]       0    .debug_info
  +0.0%    +285  [ = ]       0    .debug_str
  +0.0%    +188  [ = ]       0    .debug_loc
  +0.0%    +112  [ = ]       0    .debug_line
  +0.7%     +54  [ = ]       0    .debug_abbrev
  +0.0%     +24  +0.0%     +24    .text
  +0.0%     +12  +0.0%     +12    .rodata
  -0.0%      -6  [ = ]       0    .strtab
 -13.0%      -7  [ = ]       0    [Unmapped]
  -0.0%      -8  [ = ]       0    .debug_aranges
  -0.0%      -8  [ = ]       0    .debug_ranges
  -0.0%     -16  [ = ]       0    .debug_frame
  -0.0%     -32  [ = ]       0    .symtab
  +0.0% +1.37Ki  +0.0%     +36    TOTAL
use_config/nrf52840_ble — 435.3 KiB → 435.4 KiB (+0.00% ⬆️)

cargo size (PR):

   text	   data	    bss	    dec	    hex	filename
 394200	   4596	  47016	 445812	  6cd74	rmk-nrf52840

cargo size (main):

   text	   data	    bss	    dec	    hex	filename
 394164	   4596	  47016	 445776	  6cd50	rmk-nrf52840

Bloaty diff (PR vs main):

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.0%    +666  [ = ]       0    .debug_info
  +0.0%    +186  [ = ]       0    .debug_loc
  +0.0%    +154  [ = ]       0    .debug_line
  +0.0%     +41  [ = ]       0    .debug_str
  +0.5%     +39  [ = ]       0    .debug_abbrev
   +73%     +30  [ = ]       0    [Unmapped]
  +0.0%     +24  +0.0%     +24    .text
  +0.0%     +12  +0.0%     +12    .rodata
  -0.0%      -8  [ = ]       0    .debug_aranges
  -0.0%      -8  [ = ]       0    .debug_ranges
  -0.0%     -16  [ = ]       0    .debug_frame
  -0.0%     -32  [ = ]       0    .symtab
  -0.0%     -36  [ = ]       0    .strtab
  +0.0% +1.03Ki  +0.0%     +36    TOTAL
use_config/nrf52840_ble_split (central) — 489.0 KiB → 489.0 KiB (+0.00% ⬆️)

cargo size (PR):

   text	   data	    bss	    dec	    hex	filename
 450544	   4652	  45536	 500732	  7a3fc	central

cargo size (main):

   text	   data	    bss	    dec	    hex	filename
 450512	   4652	  45536	 500700	  7a3dc	central

Bloaty diff (PR vs main):

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.0%    +445  [ = ]       0    .debug_info
  +0.0%    +348  [ = ]       0    .debug_str
  +0.0%     +61  [ = ]       0    .debug_loc
  +0.0%     +39  [ = ]       0    .strtab
  +0.0%     +20  +0.0%     +20    .text
  +0.0%     +12  +0.0%     +12    .rodata
  +0.0%      +8  [ = ]       0    .debug_aranges
  +2.0%      +1  [ = ]       0    [Unmapped]
  -0.5%     -39  [ = ]       0    .debug_abbrev
  -0.0%     -67  [ = ]       0    .debug_line
  +0.0%    +828  +0.0%     +32    TOTAL
use_config/nrf52840_ble_split (peripheral) — 315.9 KiB → 316.2 KiB (+0.08% ⬆️)

cargo size (PR):

   text	   data	    bss	    dec	    hex	filename
 292120	   4468	  27184	 323772	  4f0bc	peripheral

cargo size (main):

   text	   data	    bss	    dec	    hex	filename
 291836	   4468	  27184	 323488	  4efa0	peripheral

Bloaty diff (PR vs main):

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.0%    +589  [ = ]       0    .debug_info
  +0.2%    +407  [ = ]       0    .strtab
  +0.1%    +241  [ = ]       0    .debug_line
  +0.1%    +228  +0.1%    +228    .text
  +0.1%    +224  [ = ]       0    .debug_ranges
  +0.0%    +210  [ = ]       0    .debug_str
  +0.2%    +176  [ = ]       0    .symtab
  +0.3%     +92  [ = ]       0    .debug_frame
  +0.0%     +86  [ = ]       0    .debug_loc
  +0.2%     +56  +0.2%     +56    .rodata
  +0.1%     +40  [ = ]       0    .debug_aranges
  -1.4%      -1  [ = ]       0    [Unmapped]
  +0.0% +2.29Ki  +0.1%    +284    TOTAL
use_config/pi_pico_w_ble — 663.4 KiB → 663.4 KiB (+0.01% ⬆️)

cargo size (PR):

   text	   data	    bss	    dec	    hex	filename
 626032	      0	  53308	 679340	  a5dac	rmk-pi-pico-w

cargo size (main):

   text	   data	    bss	    dec	    hex	filename
 625964	      0	  53308	 679272	  a5d68	rmk-pi-pico-w

Bloaty diff (PR vs main):

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.0%    +730  [ = ]       0    .debug_info
  +0.1%    +227  [ = ]       0    .debug_line
  +0.0%    +132  [ = ]       0    .debug_str
  +0.0%     +56  +0.0%     +56    .text
  +0.0%     +48  [ = ]       0    .strtab
  +0.4%     +39  [ = ]       0    .debug_abbrev
  +0.0%     +32  [ = ]       0    .symtab
  +0.0%     +12  +0.0%     +12    .rodata
  -4.5%      -3  [ = ]       0    [Unmapped]
  -0.0%     -56  [ = ]       0    .debug_ranges
  -0.1%    -693  [ = ]       0    .debug_loc
  +0.0%    +524  +0.0%     +68    TOTAL
use_config/rp2040 — 145.6 KiB → 145.6 KiB (+0.00%)

cargo size (PR):

   text	   data	    bss	    dec	    hex	filename
 134412	      0	  14724	 149136	  24690	rmk-rp2040

cargo size (main):

   text	   data	    bss	    dec	    hex	filename
 134412	      0	  14724	 149136	  24690	rmk-rp2040

Bloaty diff (PR vs main):

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.0%    +101  [ = ]       0    .debug_str
  +0.1%     +92  [ = ]       0    .debug_line
  +0.0%     +37  [ = ]       0    .debug_info
  +0.0%      +1  [ = ]       0    .strtab
  -2.8%      -1  [ = ]       0    [Unmapped]
  -0.0%     -10  [ = ]       0    .debug_loc
  +0.0%    +220  [ = ]       0    TOTAL
use_config/rp2040_split (central) — 159.2 KiB → 159.2 KiB (+0.00%)

cargo size (PR):

   text	   data	    bss	    dec	    hex	filename
 147472	      0	  15588	 163060	  27cf4	central

cargo size (main):

   text	   data	    bss	    dec	    hex	filename
 147472	      0	  15588	 163060	  27cf4	central

Bloaty diff (PR vs main):

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.0%     +14  [ = ]       0    .debug_loc
  +6.6%      +4  [ = ]       0    [Unmapped]
  +0.0%      +1  [ = ]       0    .strtab
  -0.0%      -3  [ = ]       0    .debug_str
  +0.0%     +16  [ = ]       0    TOTAL
use_config/rp2040_split (peripheral) — 27.8 KiB → 27.8 KiB (+0.00%)

cargo size (PR):

   text	   data	    bss	    dec	    hex	filename
  25616	     60	   2796	  28472	   6f38	peripheral

cargo size (main):

   text	   data	    bss	    dec	    hex	filename
  25616	     60	   2796	  28472	   6f38	peripheral

Bloaty diff (PR vs main):

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.1%    +708  [ = ]       0    .debug_str
  +0.2%     +40  [ = ]       0    .strtab
  +0.1%    +748  [ = ]       0    TOTAL
use_config/stm32f1 — 61.8 KiB → 61.8 KiB (+0.00%)

cargo size (PR):

   text	   data	    bss	    dec	    hex	filename
  56540	     28	   6740	  63308	   f74c	rmk-stm32f1

cargo size (main):

   text	   data	    bss	    dec	    hex	filename
  56540	     28	   6740	  63308	   f74c	rmk-stm32f1

Bloaty diff (PR vs main):

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  [ = ]       0  [ = ]       0    TOTAL
use_config/stm32h7 — 99.0 KiB → 99.0 KiB (+0.00%)

cargo size (PR):

   text	   data	    bss	    dec	    hex	filename
  92232	    264	   8928	 101424	  18c30	rmk-stm32h7

cargo size (main):

   text	   data	    bss	    dec	    hex	filename
  92232	    264	   8928	 101424	  18c30	rmk-stm32h7

Bloaty diff (PR vs main):

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +1.5%      +1  [ = ]       0    [Unmapped]
  -0.3%    -186  [ = ]       0    .strtab
  -0.1% -1.19Ki  [ = ]       0    .debug_str
  -0.0% -1.38Ki  [ = ]       0    TOTAL
use_rust/nrf52832_ble — 377.3 KiB → 377.3 KiB (+0.01% ⬆️)

cargo size (PR):

   text	   data	    bss	    dec	    hex	filename
 349312	   4588	  32488	 386388	  5e554	rmk-nrf52832

cargo size (main):

   text	   data	    bss	    dec	    hex	filename
 349272	   4588	  32488	 386348	  5e52c	rmk-nrf52832

Bloaty diff (PR vs main):

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.0%    +713  [ = ]       0    .debug_info
  +0.0%    +345  [ = ]       0    .debug_str
  +0.0%    +142  [ = ]       0    .debug_line
  +0.0%     +30  [ = ]       0    .debug_loc
  +0.0%     +28  +0.0%     +28    .text
   +51%     +23  [ = ]       0    [Unmapped]
  +0.0%     +19  [ = ]       0    .strtab
  +0.0%     +12  +0.0%     +12    .rodata
  +0.0% +1.28Ki  +0.0%     +40    TOTAL
use_rust/nrf52840_ble — 432.0 KiB → 432.0 KiB (+0.00% ⬆️)

cargo size (PR):

   text	   data	    bss	    dec	    hex	filename
 394432	   4588	  43352	 442372	  6c004	rmk-nrf52840

cargo size (main):

   text	   data	    bss	    dec	    hex	filename
 394400	   4588	  43352	 442340	  6bfe4	rmk-nrf52840

Bloaty diff (PR vs main):

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.0%    +729  [ = ]       0    .debug_info
  +0.0%    +269  [ = ]       0    .debug_str
  +0.1%    +223  [ = ]       0    .debug_line
  +0.0%    +176  [ = ]       0    .debug_loc
  +0.5%     +39  [ = ]       0    .debug_abbrev
  +0.0%     +20  +0.0%     +20    .text
  +0.0%     +19  [ = ]       0    .strtab
  +0.0%     +12  +0.0%     +12    .rodata
  -4.2%      -3  [ = ]       0    [Unmapped]
  -0.0%      -8  [ = ]       0    .debug_aranges
  -0.0%      -8  [ = ]       0    .debug_ranges
  -0.0%     -16  [ = ]       0    .debug_frame
  -0.0%     -32  [ = ]       0    .symtab
  +0.0% +1.39Ki  +0.0%     +32    TOTAL
use_rust/nrf52840_ble_split (central) — 497.4 KiB → 497.5 KiB (+0.00% ⬆️)

cargo size (PR):

   text	   data	    bss	    dec	    hex	filename
 454288	   4652	  50464	 509404	  7c5dc	central

cargo size (main):

   text	   data	    bss	    dec	    hex	filename
 454252	   4652	  50464	 509368	  7c5b8	central

Bloaty diff (PR vs main):

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.0%    +538  [ = ]       0    .debug_info
  +0.0%    +274  [ = ]       0    .debug_str
  +0.0%     +73  [ = ]       0    .debug_loc
  +0.0%     +24  +0.0%     +24    .text
  +0.0%     +12  +0.0%     +12    .rodata
  +0.0%      +8  [ = ]       0    .debug_aranges
  -7.0%      -4  [ = ]       0    [Unmapped]
  -0.0%      -9  [ = ]       0    .strtab
  -0.0%    -104  [ = ]       0    .debug_line
  +0.0%    +812  +0.0%     +36    TOTAL
use_rust/nrf52840_ble_split (peripheral) — 312.1 KiB → 312.3 KiB (+0.08% ⬆️)

cargo size (PR):

   text	   data	    bss	    dec	    hex	filename
 289928	   4468	  25432	 319828	  4e154	peripheral

cargo size (main):

   text	   data	    bss	    dec	    hex	filename
 289664	   4468	  25432	 319564	  4e04c	peripheral

Bloaty diff (PR vs main):

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.1% +3.90Ki  [ = ]       0    .debug_str
  +0.3%    +734  [ = ]       0    .strtab
  +0.0%    +625  [ = ]       0    .debug_info
  +0.1%    +421  [ = ]       0    .debug_loc
  +0.2%    +368  [ = ]       0    .debug_ranges
  +0.1%    +216  +0.1%    +216    .text
  +0.1%    +176  [ = ]       0    .debug_line
  +0.1%    +144  [ = ]       0    .symtab
  +0.2%     +76  [ = ]       0    .debug_frame
  +0.2%     +48  +0.2%     +48    .rodata
  +0.1%     +32  [ = ]       0    .debug_aranges
 -10.2%      -6  [ = ]       0    [Unmapped]
  +0.1% +6.67Ki  +0.1%    +264    TOTAL
use_rust/pi_pico_w_ble — 663.6 KiB → 663.7 KiB (+0.01% ⬆️)

cargo size (PR):

   text	   data	    bss	    dec	    hex	filename
 626120	      0	  53500	 679620	  a5ec4	rmk-pi-pico-w

cargo size (main):

   text	   data	    bss	    dec	    hex	filename
 626048	      0	  53500	 679548	  a5e7c	rmk-pi-pico-w

Bloaty diff (PR vs main):

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.0%    +479  [ = ]       0    .debug_info
  +0.0%    +129  [ = ]       0    .debug_line
  +0.0%     +60  +0.0%     +60    .text
  +0.0%     +44  [ = ]       0    .strtab
  +0.0%     +32  [ = ]       0    .symtab
   +46%     +23  [ = ]       0    [Unmapped]
  +0.0%     +12  +0.0%     +12    .rodata
  -0.0%      -4  [ = ]       0    .debug_str
  -0.0%     -56  [ = ]       0    .debug_ranges
  -0.1%    -683  [ = ]       0    .debug_loc
  +0.0%     +36  +0.0%     +72    TOTAL
use_rust/rp2040 — 145.1 KiB → 145.1 KiB (+0.00%)

cargo size (PR):

   text	   data	    bss	    dec	    hex	filename
 133988	      0	  14644	 148632	  24498	rmk-rp2040

cargo size (main):

   text	   data	    bss	    dec	    hex	filename
 133988	      0	  14644	 148632	  24498	rmk-rp2040

Bloaty diff (PR vs main):

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.1%    +124  [ = ]       0    .debug_line
  +0.0%    +102  [ = ]       0    .debug_str
  +0.0%     +37  [ = ]       0    .debug_info
  +0.0%     +10  [ = ]       0    .debug_loc
  +0.0%      +1  [ = ]       0    .strtab
  -4.3%      -2  [ = ]       0    [Unmapped]
  +0.0%    +272  [ = ]       0    TOTAL
use_rust/rp2040_split (central) — 158.0 KiB → 158.0 KiB (+0.00%)

cargo size (PR):

   text	   data	    bss	    dec	    hex	filename
 146356	      0	  15420	 161776	  277f0	central

cargo size (main):

   text	   data	    bss	    dec	    hex	filename
 146356	      0	  15420	 161776	  277f0	central

Bloaty diff (PR vs main):

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.0%     +33  [ = ]       0    .debug_str
  +0.0%      +5  [ = ]       0    .strtab
  -0.0%      -9  [ = ]       0    .debug_info
  -0.0%     -10  [ = ]       0    .debug_loc
  -0.0%     -19  [ = ]       0    .debug_line
  [ = ]       0  [ = ]       0    TOTAL
use_rust/rp2040_split (peripheral) — 28.2 KiB → 28.2 KiB (+0.00%)

cargo size (PR):

   text	   data	    bss	    dec	    hex	filename
  25716	     60	   3060	  28836	   70a4	peripheral

cargo size (main):

   text	   data	    bss	    dec	    hex	filename
  25716	     60	   3060	  28836	   70a4	peripheral

Bloaty diff (PR vs main):

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.0%      +1  [ = ]       0    .strtab
  +1.5%      +1  [ = ]       0    [Unmapped]
  -0.0%      -2  [ = ]       0    .debug_str
  [ = ]       0  [ = ]       0    TOTAL
use_rust/stm32f1 — 61.3 KiB → 61.3 KiB (+0.00%)

cargo size (PR):

   text	   data	    bss	    dec	    hex	filename
  55940	     28	   6756	  62724	   f504	rmk-stm32f1

cargo size (main):

   text	   data	    bss	    dec	    hex	filename
  55940	     28	   6756	  62724	   f504	rmk-stm32f1

Bloaty diff (PR vs main):

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  [ = ]       0  [ = ]       0    TOTAL
use_rust/stm32h7 — 119.6 KiB → 119.6 KiB (+0.00% ⬇️)

cargo size (PR):

   text	   data	    bss	    dec	    hex	filename
 107236	    320	  14924	 122480	  1de70	rmk-stm32h7

cargo size (main):

   text	   data	    bss	    dec	    hex	filename
 107240	    320	  14924	 122484	  1de74	rmk-stm32h7

Bloaty diff (PR vs main):

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.1%    +124  [ = ]       0    .debug_line
  +0.0%     +37  [ = ]       0    .debug_info
   +17%      +7  [ = ]       0    [Unmapped]
  -0.0%      -4  -0.0%      -4    .text
  -0.0%     -10  [ = ]       0    .debug_loc
  -0.2%    -181  [ = ]       0    .strtab
  -0.1% -1.97Ki  [ = ]       0    .debug_str
  -0.0% -2.00Ki  -0.0%      -4    TOTAL

@colonelpanic8
colonelpanic8 force-pushed the fix/dfu-split-not-subscribed branch from 8bdd8a8 to 9c3724b Compare July 20, 2026 19:28
@colonelpanic8
colonelpanic8 changed the base branch from deps/trouble-not-subscribed to fix/ble-split-dfu-compile July 20, 2026 19:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant