Skip to content

New Protocol - V2#848

Draft
HaoboGu wants to merge 23 commits into
mainfrom
feat/rynk_protocol
Draft

New Protocol - V2#848
HaoboGu wants to merge 23 commits into
mainfrom
feat/rynk_protocol

Conversation

@HaoboGu

@HaoboGu HaoboGu commented May 13, 2026

Copy link
Copy Markdown
Owner

The 2nd try of adding RMK's protocol. Different from previous tries(#750, #835), this time postcard-rpc is dropped because it's kind of overkill and introduces long compile time.

Instead, a simpler, header + payload like protocol is used, and the new protocol is called rynk which means rmk + link.

Progress:

@github-actions

github-actions Bot commented May 13, 2026

Copy link
Copy Markdown

Size Report

Example main PR Diff .text .data .bss
use_config/nrf52832_ble 373.0 KiB 372.3 KiB -0.20% ⬇️ -476 0 -304
use_config/nrf52840_ble 422.3 KiB 423.0 KiB +0.17% ⬆️ +628 -8 +144
use_config/nrf52840_ble_split (central) 497.6 KiB 498.7 KiB +0.21% ⬆️ +932 0 +168
use_config/nrf52840_ble_split (peripheral) 322.9 KiB 322.8 KiB -0.04% ⬇️ -152 0 +8
use_config/pi_pico_w_ble 659.9 KiB 660.4 KiB +0.07% ⬆️ +372 0 +152
use_config/rp2040 148.2 KiB 145.7 KiB -1.70% ⬇️ -2136 0 -456
use_config/rp2040_split (central) 161.8 KiB 159.3 KiB -1.58% ⬇️ -2180 0 -448
use_config/rp2040_split (peripheral) 27.8 KiB 27.8 KiB +0.11% ⬆️ +24 0 +8
use_config/stm32f1 62.7 KiB 62.7 KiB +0.04% ⬆️ +16 0 +16
use_config/stm32h7 99.7 KiB 99.3 KiB -0.41% ⬇️ -48 0 -380
use_rust/nrf52832_ble 360.5 KiB 360.2 KiB -0.08% ⬇️ -24 0 -304
use_rust/nrf52840_ble 418.3 KiB 417.3 KiB -0.24% ⬇️ -1200 0 +136
use_rust/nrf52840_ble_split (central) 506.8 KiB 506.9 KiB +0.00% ⬆️ -140 0 +160
use_rust/nrf52840_ble_split (peripheral) 319.6 KiB 319.6 KiB +0.00% ⬇️ -40 0 +8
use_rust/pi_pico_w_ble 660.1 KiB 660.5 KiB +0.05% ⬆️ +196 0 +152
use_rust/rp2040 147.8 KiB 145.1 KiB -1.82% ⬇️ -2312 0 -456
use_rust/rp2040_split (central) 160.5 KiB 157.9 KiB -1.61% ⬇️ -2192 0 -456
use_rust/rp2040_split (peripheral) 28.1 KiB 28.2 KiB +0.11% ⬆️ +24 0 +8
use_rust/stm32f1 62.6 KiB 62.6 KiB +0.05% ⬆️ +20 0 +16
use_rust/stm32h7 121.9 KiB 119.6 KiB -1.88% ⬇️ -1900 0 -460
use_config/nrf52832_ble — 373.0 KiB → 372.3 KiB (-0.20% ⬇️)

cargo size (PR):

   text	   data	    bss	    dec	    hex	filename
 341684	   5256	  34264	 381204	  5d114	rmk-nrf52832

cargo size (main):

   text	   data	    bss	    dec	    hex	filename
 342160	   5256	  34568	 381984	  5d420	rmk-nrf52832

Bloaty diff (PR vs main):

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.5% +1.40Ki  [ = ]       0    .strtab
  +0.3%    +112  +0.3%    +112    .rodata
  +0.0%     +96  [ = ]       0    .debug_loc
  +0.0%     +32  [ = ]       0    .symtab
  -8.9%      -5  [ = ]       0    [Unmapped]
  -0.0%     -12  [ = ]       0    .debug_frame
  -0.0%     -16  [ = ]       0    .debug_aranges
  [ = ]       0  -0.9%    -304    .bss
  -0.2%    -424  [ = ]       0    .debug_ranges
  -0.2%    -588  -0.2%    -588    .text
  -0.4% -1.20Ki  [ = ]       0    .debug_line
  -0.5% -9.01Ki  [ = ]       0    .debug_info
  -0.8% -22.9Ki  [ = ]       0    .debug_str
  -0.5% -32.5Ki  -0.2%    -780    TOTAL
use_config/nrf52840_ble — 422.3 KiB → 423.0 KiB (+0.17% ⬆️)

cargo size (PR):

   text	   data	    bss	    dec	    hex	filename
 376584	   5256	  51360	 433200	  69c30	rmk-nrf52840

cargo size (main):

   text	   data	    bss	    dec	    hex	filename
 375956	   5264	  51216	 432436	  69934	rmk-nrf52840

Bloaty diff (PR vs main):

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.9% +6.36Ki  [ = ]       0    .debug_loc
  +1.2% +2.62Ki  [ = ]       0    .debug_ranges
  +0.4% +1.21Ki  [ = ]       0    .strtab
  +0.1%    +460  +0.1%    +460    .text
  +0.4%    +168  +0.4%    +168    .rodata
  [ = ]       0  +0.3%    +144    .bss
  +1.0%     +86  [ = ]       0    .debug_abbrev
   +35%     +17  [ = ]       0    [Unmapped]
  +0.9%      +8  [ = ]       0    .defmt
  -0.2%      -8  -0.2%      -8    .data
  -0.1%     -32  [ = ]       0    .debug_aranges
  -0.0%     -32  [ = ]       0    .symtab
  -0.4%    -180  [ = ]       0    .debug_frame
  -0.1%    -395  [ = ]       0    .debug_line
  -0.3% -6.40Ki  [ = ]       0    .debug_info
  -0.7% -24.3Ki  [ = ]       0    .debug_str
  -0.3% -20.4Ki  +0.2%    +764    TOTAL
use_config/nrf52840_ble_split (central) — 497.6 KiB → 498.7 KiB (+0.21% ⬆️)

cargo size (PR):

   text	   data	    bss	    dec	    hex	filename
 456872	   6588	  47200	 510660	  7cac4	central

cargo size (main):

   text	   data	    bss	    dec	    hex	filename
 455940	   6588	  47032	 509560	  7c678	central

Bloaty diff (PR vs main):

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +1.8% +14.4Ki  [ = ]       0    .debug_loc
  +0.4% +1.36Ki  [ = ]       0    .strtab
  +0.2%    +768  +0.2%    +768    .text
  +0.1%    +248  [ = ]       0    .debug_ranges
  [ = ]       0  +0.4%    +168    .bss
  +0.4%    +164  +0.4%    +164    .rodata
  +1.4%    +117  [ = ]       0    .debug_abbrev
  +0.9%      +8  [ = ]       0    .defmt
 -12.2%      -6  [ = ]       0    [Unmapped]
  -0.1%     -24  [ = ]       0    .debug_aranges
  -0.0%     -48  [ = ]       0    .symtab
  -0.3%    -148  [ = ]       0    .debug_frame
  -0.1%    -215  [ = ]       0    .debug_line
  -0.5% -11.6Ki  [ = ]       0    .debug_info
  -0.8% -29.0Ki  [ = ]       0    .debug_str
  -0.3% -24.0Ki  +0.2% +1.07Ki    TOTAL
use_config/nrf52840_ble_split (peripheral) — 322.9 KiB → 322.8 KiB (-0.04% ⬇️)

cargo size (PR):

   text	   data	    bss	    dec	    hex	filename
 297032	   5920	  27600	 330552	  50b38	peripheral

cargo size (main):

   text	   data	    bss	    dec	    hex	filename
 297184	   5920	  27592	 330696	  50bc8	peripheral

Bloaty diff (PR vs main):

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.1%    +112  [ = ]       0    .symtab
  +0.0%     +90  [ = ]       0    .strtab
  +0.1%     +56  [ = ]       0    .debug_aranges
  +0.2%     +56  [ = ]       0    .debug_frame
  [ = ]       0  +0.0%      +8    .bss
 -10.6%      -5  [ = ]       0    [Unmapped]
  -0.1%    -152  -0.1%    -152    .text
  -0.1%    -234  [ = ]       0    .debug_line
  -0.4%    -576  [ = ]       0    .debug_ranges
  -0.2%    -996  [ = ]       0    .debug_loc
  -0.1% -1.90Ki  [ = ]       0    .debug_info
  -0.1% -3.65Ki  [ = ]       0    .debug_str
  -0.1% -7.16Ki  -0.0%    -144    TOTAL
use_config/pi_pico_w_ble — 659.9 KiB → 660.4 KiB (+0.07% ⬆️)

cargo size (PR):

   text	   data	    bss	    dec	    hex	filename
 620500	      0	  55764	 676264	  a51a8	rmk-pi-pico-w

cargo size (main):

   text	   data	    bss	    dec	    hex	filename
 620128	      0	  55612	 675740	  a4f9c	rmk-pi-pico-w

Bloaty diff (PR vs main):

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.3% +3.02Ki  [ = ]       0    .debug_loc
  +0.5% +1.34Ki  [ = ]       0    .strtab
  +0.1%    +244  +0.1%    +244    .text
  [ = ]       0  +0.3%    +152    .bss
  +0.0%    +128  +0.0%    +128    .rodata
  +0.1%      +8  [ = ]       0    .debug_abbrev
  +0.9%      +8  [ = ]       0    .defmt
   +16%      +8  [ = ]       0    [Unmapped]
  -0.0%      -8  [ = ]       0    .debug_aranges
  -0.1%     -48  [ = ]       0    .symtab
  -0.2%     -92  [ = ]       0    .debug_frame
  -0.0%    -155  [ = ]       0    .debug_line
  -0.1%    -272  [ = ]       0    .debug_ranges
  -0.3% -8.05Ki  [ = ]       0    .debug_info
  -0.6% -21.8Ki  [ = ]       0    .debug_str
  -0.3% -25.7Ki  +0.1%    +524    TOTAL
use_config/rp2040 — 148.2 KiB → 145.7 KiB (-1.70% ⬇️)

cargo size (PR):

   text	   data	    bss	    dec	    hex	filename
 134128	      0	  15068	 149196	  246cc	rmk-rp2040

cargo size (main):

   text	   data	    bss	    dec	    hex	filename
 136264	      0	  15524	 151788	  250ec	rmk-rp2040

Bloaty diff (PR vs main):

    FILE SIZE        VM SIZE    
 --------------  -------------- 
   +59%     +24  [ = ]       0    [Unmapped]
  +1.9%      +8  [ = ]       0    .defmt
  -0.4%     -68  -0.4%     -68    .rodata
  -0.5%     -88  [ = ]       0    .debug_aranges
  -1.5%    -115  [ = ]       0    .debug_abbrev
  -0.2%    -238  [ = ]       0    .strtab
  -1.7%    -288  [ = ]       0    .debug_frame
  -1.3%    -432  [ = ]       0    .symtab
  [ = ]       0  -3.1%    -456    .bss
  -1.7% -1.34Ki  [ = ]       0    .debug_ranges
  -1.7% -2.02Ki  -1.7% -2.02Ki    .text
  -0.8% -2.39Ki  [ = ]       0    .debug_loc
  -2.1% -3.45Ki  [ = ]       0    .debug_line
  -2.4% -24.0Ki  [ = ]       0    .debug_info
  -3.6% -49.7Ki  [ = ]       0    .debug_str
  -2.6% -84.1Ki  -1.7% -2.53Ki    TOTAL
use_config/rp2040_split (central) — 161.8 KiB → 159.3 KiB (-1.58% ⬇️)

cargo size (PR):

   text	   data	    bss	    dec	    hex	filename
 147160	      0	  15924	 163084	  27d0c	central

cargo size (main):

   text	   data	    bss	    dec	    hex	filename
 149340	      0	  16372	 165712	  28750	central

Bloaty diff (PR vs main):

    FILE SIZE        VM SIZE    
 --------------  -------------- 
   +12%      +6  [ = ]       0    [Unmapped]
  -0.3%     -20  [ = ]       0    .debug_abbrev
  -0.3%     -56  [ = ]       0    .debug_aranges
  -0.4%     -68  -0.4%     -68    .rodata
  -0.2%    -224  [ = ]       0    .strtab
  -1.2%    -236  [ = ]       0    .debug_frame
  -0.8%    -304  [ = ]       0    .symtab
  [ = ]       0  -2.9%    -448    .bss
  -1.6% -2.06Ki  -1.6% -2.06Ki    .text
  -2.5% -2.21Ki  [ = ]       0    .debug_ranges
  -1.5% -2.77Ki  [ = ]       0    .debug_line
  -2.5% -8.91Ki  [ = ]       0    .debug_loc
  -2.1% -23.4Ki  [ = ]       0    .debug_info
  -3.1% -49.2Ki  [ = ]       0    .debug_str
  -2.4% -89.5Ki  -1.6% -2.57Ki    TOTAL
use_config/rp2040_split (peripheral) — 27.8 KiB → 27.8 KiB (+0.11% ⬆️)

cargo size (PR):

   text	   data	    bss	    dec	    hex	filename
  25648	     60	   2804	  28512	   6f60	peripheral

cargo size (main):

   text	   data	    bss	    dec	    hex	filename
  25624	     60	   2796	  28480	   6f40	peripheral

Bloaty diff (PR vs main):

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.8%    +576  [ = ]       0    .debug_loc
  +0.6%     +96  [ = ]       0    .debug_ranges
  +0.1%     +59  [ = ]       0    .debug_line
  +0.2%     +24  [ = ]       0    .debug_aranges
  +0.1%     +20  +0.1%     +20    .text
  [ = ]       0  +0.5%      +8    .bss
  +0.1%      +4  +0.1%      +4    .rodata
  -0.0%      -2  [ = ]       0    .strtab
 -36.2%     -21  [ = ]       0    [Unmapped]
  -0.0%    -128  [ = ]       0    .debug_info
  -0.0%    -356  [ = ]       0    .debug_str
  +0.0%    +272  +0.1%     +32    TOTAL
use_config/stm32f1 — 62.7 KiB → 62.7 KiB (+0.04% ⬆️)

cargo size (PR):

   text	   data	    bss	    dec	    hex	filename
  56692	     28	   7520	  64240	   faf0	rmk-stm32f1

cargo size (main):

   text	   data	    bss	    dec	    hex	filename
  56676	     28	   7504	  64208	   fad0	rmk-stm32f1

Bloaty diff (PR vs main):

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.2% +1.59Ki  [ = ]       0    .debug_str
  +0.2% +1.01Ki  [ = ]       0    .debug_info
  +0.2%    +237  [ = ]       0    .debug_loc
  +0.2%     +80  [ = ]       0    .debug_ranges
  +0.0%     +42  [ = ]       0    .debug_line
   +36%     +17  [ = ]       0    [Unmapped]
  [ = ]       0  +0.2%     +16    .bss
  +0.0%     +16  +0.0%     +16    .text
  +0.2% +2.98Ki  +0.0%     +32    TOTAL
use_config/stm32h7 — 99.7 KiB → 99.3 KiB (-0.41% ⬇️)

cargo size (PR):

   text	   data	    bss	    dec	    hex	filename
  92040	    268	   9364	 101672	  18d28	rmk-stm32h7

cargo size (main):

   text	   data	    bss	    dec	    hex	filename
  92088	    268	   9744	 102100	  18ed4	rmk-stm32h7

Bloaty diff (PR vs main):

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +2.0% +3.38Ki  [ = ]       0    .debug_loc
  +4.8% +3.12Ki  [ = ]       0    .debug_ranges
  +1.6%    +196  +1.6%    +196    .rodata
   +45%     +19  [ = ]       0    [Unmapped]
  -0.6%      -1  [ = ]       0    .defmt
  -0.2%     -72  [ = ]       0    .debug_aranges
  -0.7%    -112  [ = ]       0    .debug_frame
  -1.7%    -113  [ = ]       0    .debug_abbrev
  -0.3%    -244  -0.3%    -244    .text
  -1.0%    -288  [ = ]       0    .symtab
  [ = ]       0  -3.9%    -380    .bss
  -0.8%    -457  [ = ]       0    .strtab
  -0.6%    -731  [ = ]       0    .debug_line
  -1.2% -11.6Ki  [ = ]       0    .debug_info
  -2.0% -34.0Ki  [ = ]       0    .debug_str
  -1.3% -40.8Ki  -0.4%    -428    TOTAL
use_rust/nrf52832_ble — 360.5 KiB → 360.2 KiB (-0.08% ⬇️)

cargo size (PR):

   text	   data	    bss	    dec	    hex	filename
 330336	   5256	  33248	 368840	  5a0c8	rmk-nrf52832

cargo size (main):

   text	   data	    bss	    dec	    hex	filename
 330360	   5256	  33552	 369168	  5a210	rmk-nrf52832

Bloaty diff (PR vs main):

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.9% +1.99Ki  [ = ]       0    .strtab
  +0.1%    +144  [ = ]       0    .symtab
  +0.3%    +104  +0.3%    +104    .rodata
  +0.1%     +52  [ = ]       0    .debug_frame
  +0.1%     +40  [ = ]       0    .debug_aranges
  +1.7%      +8  [ = ]       0    .defmt
 -20.8%     -11  [ = ]       0    [Unmapped]
  -0.7%     -53  [ = ]       0    .debug_abbrev
  -0.0%    -128  -0.0%    -128    .text
  [ = ]       0  -0.9%    -304    .bss
  -0.4% -1.16Ki  [ = ]       0    .debug_line
  -0.2% -1.33Ki  [ = ]       0    .debug_loc
  -0.9% -1.74Ki  [ = ]       0    .debug_ranges
  -0.4% -7.92Ki  [ = ]       0    .debug_info
  -0.7% -19.6Ki  [ = ]       0    .debug_str
  -0.5% -29.6Ki  -0.1%    -328    TOTAL
use_rust/nrf52840_ble — 418.3 KiB → 417.3 KiB (-0.24% ⬇️)

cargo size (PR):

   text	   data	    bss	    dec	    hex	filename
 375180	   5264	  46840	 427284	  68514	rmk-nrf52840

cargo size (main):

   text	   data	    bss	    dec	    hex	filename
 376380	   5264	  46704	 428348	  6893c	rmk-nrf52840

Bloaty diff (PR vs main):

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.4% +1.26Ki  [ = ]       0    .strtab
  +0.4%    +160  +0.4%    +160    .rodata
  [ = ]       0  +0.3%    +136    .bss
  +0.6%     +48  [ = ]       0    .debug_abbrev
   +45%     +17  [ = ]       0    [Unmapped]
  +0.9%      +8  [ = ]       0    .defmt
  -0.2%     -80  [ = ]       0    .debug_aranges
  -0.4%    -204  [ = ]       0    .debug_frame
  -0.2%    -304  [ = ]       0    .symtab
  -0.4% -1.31Ki  [ = ]       0    .debug_line
  -0.4% -1.33Ki  -0.4% -1.33Ki    .text
  -0.9% -1.98Ki  [ = ]       0    .debug_ranges
  -0.9% -6.56Ki  [ = ]       0    .debug_loc
  -0.5% -10.3Ki  [ = ]       0    .debug_info
  -0.6% -17.9Ki  [ = ]       0    .debug_str
  -0.5% -38.5Ki  -0.2% -1.04Ki    TOTAL
use_rust/nrf52840_ble_split (central) — 506.8 KiB → 506.9 KiB (+0.00% ⬆️)

cargo size (PR):

   text	   data	    bss	    dec	    hex	filename
 459504	   6588	  52936	 519028	  7eb74	central

cargo size (main):

   text	   data	    bss	    dec	    hex	filename
 459644	   6588	  52776	 519008	  7eb60	central

Bloaty diff (PR vs main):

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.5% +1.71Ki  [ = ]       0    .strtab
  +0.0%    +403  [ = ]       0    .debug_loc
  +0.2%    +288  [ = ]       0    .symtab
  +0.4%    +164  +0.4%    +164    .rodata
  [ = ]       0  +0.3%    +160    .bss
  +0.7%     +58  [ = ]       0    .debug_abbrev
  +0.1%     +56  [ = ]       0    .debug_aranges
  +0.1%     +36  [ = ]       0    .debug_frame
   +28%     +16  [ = ]       0    [Unmapped]
  +0.9%      +8  [ = ]       0    .defmt
  -0.1%    -304  -0.1%    -304    .text
  -0.1%    -492  [ = ]       0    .debug_line
  -0.5% -1.12Ki  [ = ]       0    .debug_ranges
  -0.3% -7.00Ki  [ = ]       0    .debug_info
  -0.5% -18.8Ki  [ = ]       0    .debug_str
  -0.3% -25.0Ki  +0.0%     +20    TOTAL
use_rust/nrf52840_ble_split (peripheral) — 319.6 KiB → 319.6 KiB (+0.00% ⬇️)

cargo size (PR):

   text	   data	    bss	    dec	    hex	filename
 295552	   5360	  26368	 327280	  4fe70	peripheral

cargo size (main):

   text	   data	    bss	    dec	    hex	filename
 295592	   5360	  26360	 327312	  4fe90	peripheral

Bloaty diff (PR vs main):

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.0%     +51  [ = ]       0    .debug_line
  +0.1%     +32  [ = ]       0    .debug_aranges
  +0.0%      +9  [ = ]       0    .strtab
  [ = ]       0  +0.0%      +8    .bss
   +11%      +6  [ = ]       0    [Unmapped]
  -0.0%     -32  [ = ]       0    .debug_ranges
  -0.0%     -40  -0.0%     -40    .text
  -0.1%    -309  [ = ]       0    .debug_loc
  -0.0%    -622  [ = ]       0    .debug_info
  -0.1% -2.12Ki  [ = ]       0    .debug_str
  -0.1% -3.00Ki  -0.0%     -32    TOTAL
use_rust/pi_pico_w_ble — 660.1 KiB → 660.5 KiB (+0.05% ⬆️)

cargo size (PR):

   text	   data	    bss	    dec	    hex	filename
 620432	      0	  55908	 676340	  a51f4	rmk-pi-pico-w

cargo size (main):

   text	   data	    bss	    dec	    hex	filename
 620236	      0	  55756	 675992	  a5098	rmk-pi-pico-w

Bloaty diff (PR vs main):

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.5% +1.42Ki  [ = ]       0    .strtab
  +0.1% +1.14Ki  [ = ]       0    .debug_loc
  [ = ]       0  +0.3%    +152    .bss
  +0.0%    +128  +0.0%    +128    .rodata
  +0.0%     +68  +0.0%     +68    .text
  +0.9%      +8  [ = ]       0    .defmt
  -7.0%      -5  [ = ]       0    [Unmapped]
  -0.1%     -16  [ = ]       0    .debug_abbrev
  -0.1%     -56  [ = ]       0    .debug_frame
  -0.0%    -120  [ = ]       0    .debug_ranges
  -0.1%    -279  [ = ]       0    .debug_line
  -0.4%    -304  [ = ]       0    .symtab
  -0.3% -7.16Ki  [ = ]       0    .debug_info
  -0.5% -15.8Ki  [ = ]       0    .debug_str
  -0.2% -21.0Ki  +0.1%    +348    TOTAL
use_rust/rp2040 — 147.8 KiB → 145.1 KiB (-1.82% ⬇️)

cargo size (PR):

   text	   data	    bss	    dec	    hex	filename
 133600	      0	  14940	 148540	  2443c	rmk-rp2040

cargo size (main):

   text	   data	    bss	    dec	    hex	filename
 135912	      0	  15396	 151308	  24f0c	rmk-rp2040

Bloaty diff (PR vs main):

    FILE SIZE        VM SIZE    
 --------------  -------------- 
   +24%     +10  [ = ]       0    [Unmapped]
  -0.4%     -68  -0.4%     -68    .rodata
  -0.5%     -88  [ = ]       0    .debug_aranges
  -1.5%    -115  [ = ]       0    .debug_abbrev
  -0.2%    -223  [ = ]       0    .strtab
  -1.7%    -288  [ = ]       0    .debug_frame
  -1.1%    -352  [ = ]       0    .symtab
  [ = ]       0  -3.2%    -456    .bss
  -0.6%    -472  [ = ]       0    .debug_ranges
  -0.7% -2.06Ki  [ = ]       0    .debug_loc
  -1.9% -2.19Ki  -1.9% -2.19Ki    .text
  -2.0% -3.37Ki  [ = ]       0    .debug_line
  -2.4% -23.0Ki  [ = ]       0    .debug_info
  -3.4% -46.1Ki  [ = ]       0    .debug_str
  -2.5% -78.3Ki  -1.8% -2.70Ki    TOTAL
use_rust/rp2040_split (central) — 160.5 KiB → 157.9 KiB (-1.61% ⬇️)

cargo size (PR):

   text	   data	    bss	    dec	    hex	filename
 146020	      0	  15700	 161720	  277b8	central

cargo size (main):

   text	   data	    bss	    dec	    hex	filename
 148212	      0	  16156	 164368	  28210	central

Bloaty diff (PR vs main):

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +1.8%      +8  [ = ]       0    .defmt
 -20.0%     -12  [ = ]       0    [Unmapped]
  -0.3%     -20  [ = ]       0    .debug_abbrev
  -0.3%     -56  [ = ]       0    .debug_aranges
  -0.4%     -72  -0.4%     -72    .rodata
  -0.2%    -230  [ = ]       0    .strtab
  -1.2%    -236  [ = ]       0    .debug_frame
  -0.9%    -336  [ = ]       0    .symtab
  [ = ]       0  -3.0%    -456    .bss
  -2.0% -1.79Ki  [ = ]       0    .debug_ranges
  -1.7% -2.07Ki  -1.7% -2.07Ki    .text
  -1.8% -3.14Ki  [ = ]       0    .debug_line
  -2.0% -6.75Ki  [ = ]       0    .debug_loc
  -2.1% -23.1Ki  [ = ]       0    .debug_info
  -2.8% -43.8Ki  [ = ]       0    .debug_str
  -2.2% -81.5Ki  -1.6% -2.59Ki    TOTAL
use_rust/rp2040_split (peripheral) — 28.1 KiB → 28.2 KiB (+0.11% ⬆️)

cargo size (PR):

   text	   data	    bss	    dec	    hex	filename
  25720	     60	   3068	  28848	   70b0	peripheral

cargo size (main):

   text	   data	    bss	    dec	    hex	filename
  25696	     60	   3060	  28816	   7090	peripheral

Bloaty diff (PR vs main):

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.9%    +598  [ = ]       0    .debug_loc
  +0.6%    +104  [ = ]       0    .debug_ranges
  +0.1%     +68  [ = ]       0    .debug_line
  +0.2%     +24  [ = ]       0    .debug_aranges
  +0.1%     +20  +0.1%     +20    .text
  [ = ]       0  +0.4%      +8    .bss
   +15%      +8  [ = ]       0    [Unmapped]
  +0.1%      +4  +0.1%      +4    .rodata
  -0.0%      -2  [ = ]       0    .strtab
  -0.0%    -128  [ = ]       0    .debug_info
  -0.0%    -360  [ = ]       0    .debug_str
  +0.0%    +336  +0.1%     +32    TOTAL
use_rust/stm32f1 — 62.6 KiB → 62.6 KiB (+0.05% ⬆️)

cargo size (PR):

   text	   data	    bss	    dec	    hex	filename
  56628	     28	   7496	  64152	   fa98	rmk-stm32f1

cargo size (main):

   text	   data	    bss	    dec	    hex	filename
  56608	     28	   7480	  64116	   fa74	rmk-stm32f1

Bloaty diff (PR vs main):

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.2% +1.36Ki  [ = ]       0    .debug_str
  +0.2% +1.28Ki  [ = ]       0    .debug_info
  +0.2%    +237  [ = ]       0    .debug_loc
  +0.2%     +80  [ = ]       0    .debug_ranges
  +0.1%     +74  [ = ]       0    .debug_line
  +0.0%     +20  +0.0%     +20    .text
  [ = ]       0  +0.2%     +16    .bss
   +14%      +8  [ = ]       0    [Unmapped]
  +0.2% +3.05Ki  +0.1%     +36    TOTAL
use_rust/stm32h7 — 121.9 KiB → 119.6 KiB (-1.88% ⬇️)

cargo size (PR):

   text	   data	    bss	    dec	    hex	filename
 106968	    324	  15216	 122508	  1de8c	rmk-stm32h7

cargo size (main):

   text	   data	    bss	    dec	    hex	filename
 108868	    324	  15676	 124868	  1e7c4	rmk-stm32h7

Bloaty diff (PR vs main):

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.7%    +541  [ = ]       0    .strtab
   +31%     +12  [ = ]       0    [Unmapped]
  +2.6%      +8  [ = ]       0    .defmt
  -0.0%     -16  [ = ]       0    .debug_aranges
  -1.2%     -81  [ = ]       0    .debug_abbrev
  -0.6%    -124  [ = ]       0    .debug_frame
  -0.5%    -192  [ = ]       0    .symtab
  [ = ]       0  -3.1%    -460    .bss
  -1.8% -1.86Ki  -1.8% -1.86Ki    .text
  -1.4% -2.06Ki  [ = ]       0    .debug_line
  -3.0% -2.48Ki  [ = ]       0    .debug_ranges
  -3.5% -8.33Ki  [ = ]       0    .debug_loc
  -1.8% -21.4Ki  [ = ]       0    .debug_info
  -2.2% -44.6Ki  [ = ]       0    .debug_str
  -2.0% -80.6Ki  -1.9% -2.30Ki    TOTAL

Comment thread rmk-types/src/protocol/rynk/message.rs Outdated
Comment thread rmk/src/host/rynk/handlers/combo.rs Outdated
Comment thread rmk/src/host/rynk/handlers/system.rs Outdated
Comment thread rmk/src/host/rynk/handlers/system.rs Outdated
Comment thread rmk/src/host/rynk/mod.rs Outdated
@pcasotti pcasotti marked this pull request as ready for review May 26, 2026 12:43
@pcasotti pcasotti marked this pull request as draft May 26, 2026 12:43
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jun 4, 2026

Copy link
Copy Markdown

Deploying rmk-rs with  Cloudflare Pages  Cloudflare Pages

Latest commit: 93044c3
Status: ✅  Deploy successful!
Preview URL: https://4a74aac2.rmk-4a2.pages.dev
Branch Preview URL: https://feat-rynk-protocol.rmk-4a2.pages.dev

View logs

@Schievel1

Schievel1 commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Iirc this is also used as the protocol between central and peripheral.
If we want to flash the peripheral via the central we can't loose any message during transfer.

I can count a sequence number and simply not start the update if a message went missing. Or we need flow control e.g. with a sliding window for rynk. For the latter I would say it's better to have that reusable in the protocols instead of my firmware update cooking up its own flow control.

@HaoboGu

HaoboGu commented Jun 12, 2026

Copy link
Copy Markdown
Owner Author

Iirc this is also used as the protocol between central and peripheral. If we want to flash the peripheral via the central we can't loose any message during transfer.

I can count a sequence number and simply not start the update if a message went missing. Or we need flow control e.g. with a sliding window for rynk. For the latter I would say it's better to have that reusable in the protocols instead of my firmware update cooking up its own flow control.

In the current design Rynk is not used between central and peripheral, but I hope it can be used in the future. Now it has only a SEQ number. Could you explain further about the "flow control" mechanism?

@Schievel1

Copy link
Copy Markdown
Contributor

Iirc this is also used as the protocol between central and peripheral. If we want to flash the peripheral via the central we can't loose any message during transfer.

I can count a sequence number and simply not start the update if a message went missing. Or we need flow control e.g. with a sliding window for rynk. For the latter I would say it's better to have that reusable in the protocols instead of my firmware update cooking up its own flow control.

In the current design Rynk is not used between central and peripheral, but I hope it can be used in the future. Now it has only a SEQ number. Could you explain further about the "flow control" mechanism?

What I mean with flow control is basically what I already did for the split protocol in #886. So mostly checking if the data is correct and resending a packet if it isn't.
But after considering this a bit longer I tend towards a solution where this is on the application layer. (What I already did in #886)
If we later on find out we use similar implementations for this across different connections (I mean firmware via ble, firmware via uart from central to split, some different thing that sends data over rynk and must have consistency etc.) we can still merge all those into a unified solution and put it into rynk.

1 similar comment
@Schievel1

Copy link
Copy Markdown
Contributor

Iirc this is also used as the protocol between central and peripheral. If we want to flash the peripheral via the central we can't loose any message during transfer.

I can count a sequence number and simply not start the update if a message went missing. Or we need flow control e.g. with a sliding window for rynk. For the latter I would say it's better to have that reusable in the protocols instead of my firmware update cooking up its own flow control.

In the current design Rynk is not used between central and peripheral, but I hope it can be used in the future. Now it has only a SEQ number. Could you explain further about the "flow control" mechanism?

What I mean with flow control is basically what I already did for the split protocol in #886. So mostly checking if the data is correct and resending a packet if it isn't.
But after considering this a bit longer I tend towards a solution where this is on the application layer. (What I already did in #886)
If we later on find out we use similar implementations for this across different connections (I mean firmware via ble, firmware via uart from central to split, some different thing that sends data over rynk and must have consistency etc.) we can still merge all those into a unified solution and put it into rynk.

@HaoboGu HaoboGu force-pushed the feat/rynk_protocol branch from 89bfd45 to 2b538e9 Compare June 22, 2026 15:43
HaoboGu added 19 commits June 24, 2026 15:24
Adds new rynk/ protocol module (buffer, cmd, header, fingerprint, mod)
with the new wire format. Migrates per-domain modules (combo, encoder,
fork, keymap, macro_data, morse, status, system) from the previous
rmk/ namespace, and removes the old endpoint/topic snapshot-based
layout. Also drops unused derives/imports across rmk-types/src/*.rs.

Signed-off-by: Haobo Gu <haobogu@outlook.com>
Signed-off-by: Haobo Gu <haobogu@outlook.com>
Adds GetWpm (0x0805), GetSleepState (0x0806), GetLedIndicator (0x0807)
in the Status group. These let the host probe the latest value of the
three pure event-stream topics whose state isn't otherwise queryable
(layer/connection/battery/ble already have getters).

The snapshot source-of-truth lives in pr2; handlers land in pr3.
Drops the `Header` struct + `Header::decode`/`encode_into` in favour of
`Frame` (a type alias for `[u8]`) and the `FrameOps` trait that adds
in-place wire-header accessors (`cmd`, `seq`, `payload_len`, `payload`,
plus their setters).

Callers stop parsing a `Header` value out of the bytes and re-encoding
it back — they hand the buffer through and access fields via the trait.
The trait re-uses `RynkError::InvalidParameter` for "short buffer" /
"unknown CMD" instead of a separate `DecodeError`.

Wire layout unchanged: `[CMD u16 LE | SEQ u8 | LEN u16 LE | payload]`.

Used by pr2's dispatch refactor (single buffer in/out) and the handler
signature update in pr3.
Aliases `Result<T, RynkError>` (with `T = ()` default) so handler
modules can write `RynkResult` for empty-status responses without
re-declaring the alias in every file. Used by pr3's handlers.
Introduces rmk/src/host/rynk/{mod, codec, topics} as the dispatcher
scaffold for the on-device rynk service. Wires it into host/context
and host/mod, exposes channel hooks in src/channel.rs, and updates
src/keymap.rs and src/lib.rs to expose the new entry points.
Handlers and transports land in subsequent PRs.

Signed-off-by: Haobo Gu <haobogu@outlook.com>
These statics are only consumed by the BLE transport added in pr4.
Move them out of the service-core PR so pr2 stays free of transport
concerns; they'll be re-introduced alongside the BLE transport.
Adds rmk/src/host/rynk/snapshot.rs: three static atomics latched by
a small `run_topic_snapshot` task that subscribes to WpmUpdateEvent,
SleepStateEvent, and LedIndicatorEvent. The matching GetWpm /
GetSleepState / GetLedIndicator handlers (pr3) read these atomics so
the host can probe the latest value without waiting for the next push.

Wires the dispatch arms for the new variants and re-exports the snapshot
task at the crate root (`rmk::host::run_topic_snapshot`). Bumps default
`subs` for wpm_update, sleep_state, and led_indicator by 1 to reserve
the snapshot subscriber's slot.

Handlers land in pr3; user wiring (run_all!) lands in pr5.
Replaces `Header::decode`/`encode_into` plumbing with the new `Frame` +
`FrameOps` surface from rmk-types:

- `dispatch` now takes `&mut Frame` (one buffer), returns
  `Result<(), RynkError>`. The request bytes and the response bytes
  share the same buffer; cmd/seq stay in place, only LEN is patched.
- The previous private `handle` function is folded into `dispatch`'s
  match — there's no second function to hop through.
- `encode_topic` renamed to `write_topic`, writes header + payload
  into the caller's frame in place (no length returned; caller reads
  `frame.payload_len()`).

Wire layout unchanged; only the firmware-side API moves.
Signed-off-by: Haobo Gu <haobogu@outlook.com>
Every header accessor on the `RynkMessage` trait now returns
`Result<T, RynkError>`, checking `self.len() >= RYNK_HEADER_SIZE` like
`cmd()` already did. There's no longer an implicit "caller must verify
length first" precondition — passing a short buffer to `seq()`,
`payload_len()`, `payload()`, etc. surfaces `Err(InvalidRequest)`
instead of indexing past the end.

Dispatcher and `write_topic` propagate the new Result with `?`;
`TopicEvent::encode` does the same. Transports already always pass
buffers sized to `RYNK_BUFFER_SIZE >= RYNK_MIN_BUFFER_SIZE >=
RYNK_HEADER_SIZE`, so the new error path is dead in practice — but
it's no longer a footgun for fresh callers (including loopback tests).

Adds `every_accessor_rejects_short_buffer` to the message tests so
this invariant doesn't regress silently.

Signed-off-by: Haobo Gu <haobogu@outlook.com>
`dispatch` no longer encodes handler errors into the payload itself.
Each match arm uses `await?` so any `RynkError` (from `msg.cmd()`,
`payload_mut()`, the handler body, or the topic-CMD arms) propagates
out as the function's `Err`. The dispatcher stays a pure
"request bytes → response bytes or error" function with no buffer
mutation on the failure path.

Adds `write_error_response(msg, err)` next to `dispatch` and
`write_topic`. Transports call it on the dispatch `Err` arm to encode
`Err::<(), RynkError>(err)` into the same buffer's payload region and
patch LEN, then send the reply. The split keeps the wire contract
("every response is a `Result<T, RynkError>` envelope") while pulling
the error-encoding policy out of the protocol core.

`cmd` and `seq` in the header are not touched by `write_error_response`
— the host correlates the reply with its outgoing request by `seq`,
regardless of the protocol-level error.

Signed-off-by: Haobo Gu <haobogu@outlook.com>
Signed-off-by: Haobo Gu <haobogu@outlook.com>
Signed-off-by: Haobo Gu <haobogu@outlook.com>
Adds rmk/src/host/rynk/transport/{mod, usb, ble} carrying rynk frames
over USB HID and a dedicated BLE service. Updates rmk/src/ble/* and
rmk/src/usb/mod.rs to register the new endpoints, and adds
rmk/src/split/peripheral_state.rs so split peripherals expose their
state for host-side reads.
Signed-off-by: Haobo Gu <haobogu@outlook.com>
…d, clean code

Signed-off-by: Haobo Gu <haobogu@outlook.com>
Signed-off-by: Haobo Gu <haobogu@outlook.com>
HaoboGu added 3 commits June 24, 2026 15:26
Signed-off-by: Haobo Gu <haobogu@outlook.com>
Signed-off-by: Haobo Gu <haobogu@outlook.com>
Add a runtime-free host client crate for the Rynk protocol, plus native serial and BLE transport crates.

Extend firmware-side Rynk protocol handling for host clients and cover the wire format, loopback path, hardware validation example, and host CI checks.

Signed-off-by: Haobo Gu <haobogu@outlook.com>
@HaoboGu HaoboGu force-pushed the feat/rynk_protocol branch from b9e0599 to 93044c3 Compare June 24, 2026 07:32
Signed-off-by: Haobo Gu <haobogu@outlook.com>
@HaoboGu HaoboGu force-pushed the feat/rynk_protocol branch from 9047ce5 to 8ea6723 Compare June 25, 2026 03:29
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.

3 participants