Skip to content

New Protocol - V2 - #848

Closed
HaoboGu wants to merge 111 commits into
mainfrom
feat/rynk_protocol
Closed

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

Conversation

@HaoboGu

@HaoboGu HaoboGu commented May 13, 2026

Copy link
Copy Markdown
Collaborator

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

All sub-PRs are merged into this branch:

@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 391.8 KiB 391.7 KiB -0.02% ⬇️ +180 0 -280
use_config/nrf52840_ble 436.6 KiB 436.8 KiB +0.04% ⬆️ +264 -8 -56
use_config/nrf52840_ble_split (central) 490.6 KiB 491.5 KiB +0.17% ⬆️ +788 0 +96
use_config/nrf52840_ble_split (peripheral) 315.9 KiB 315.7 KiB -0.04% ⬇️ -140 0 +8
use_config/pi_pico_w_ble 664.6 KiB 665.2 KiB +0.08% ⬆️ +476 0 +96
use_config/rp2040 145.7 KiB 143.1 KiB -1.82% ⬇️ -2388 0 -328
use_config/rp2040_split (central) 159.2 KiB 156.5 KiB -1.71% ⬇️ -2548 0 -240
use_config/rp2040_split (peripheral) 27.8 KiB 27.8 KiB +0.15% ⬆️ +36 0 +8
use_config/stm32f1 61.9 KiB 62.1 KiB +0.34% ⬆️ +76 0 +144
use_config/stm32h7 99.0 KiB 99.4 KiB +0.41% ⬆️ +680 0 -264
use_rust/nrf52832_ble 380.0 KiB 378.6 KiB -0.36% ⬇️ -1000 0 -424
use_rust/nrf52840_ble 433.7 KiB 433.0 KiB -0.17% ⬇️ -720 0 -64
use_rust/nrf52840_ble_split (central) 499.3 KiB 499.2 KiB -0.01% ⬇️ -36 0 -56
use_rust/nrf52840_ble_split (peripheral) 312.3 KiB 312.2 KiB +0.00% ⬇️ -36 0 +8
use_rust/pi_pico_w_ble 664.9 KiB 664.8 KiB -0.02% ⬇️ -124 0 -48
use_rust/rp2040 145.3 KiB 142.5 KiB -1.94% ⬇️ -2424 0 -472
use_rust/rp2040_split (central) 158.1 KiB 155.2 KiB -1.87% ⬇️ -2636 0 -392
use_rust/rp2040_split (peripheral) 28.2 KiB 28.2 KiB +0.15% ⬆️ +36 0 +8
use_rust/stm32f1 61.2 KiB 61.3 KiB +0.02% ⬆️ +16 0 0
use_rust/stm32h7 119.7 KiB 116.8 KiB -2.39% ⬇️ -2468 0 -472
use_config/nrf52832_ble — 391.8 KiB → 391.7 KiB (-0.02% ⬇️)

cargo size (PR):

   text	   data	    bss	    dec	    hex	filename
 362760	   4588	  33736	 401084	  61ebc	rmk-nrf52832

cargo size (main):

   text	   data	    bss	    dec	    hex	filename
 362580	   4588	  34016	 401184	  61f20	rmk-nrf52832

Bloaty diff (PR vs main):

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.3%   +1016  [ = ]       0    .strtab
  +0.0%    +152  +0.0%    +152    .text
  +0.1%     +28  +0.1%     +28    .rodata
   +33%     +15  [ = ]       0    [Unmapped]
  -0.0%     -16  [ = ]       0    .debug_aranges
  -0.2%     -72  [ = ]       0    .debug_frame
  -0.1%    -192  [ = ]       0    .debug_ranges
  -0.2%    -208  [ = ]       0    .symtab
  [ = ]       0  -0.8%    -280    .bss
  -0.2%    -602  [ = ]       0    .debug_line
  -0.2% -1.37Ki  [ = ]       0    .debug_loc
  -0.5% -8.94Ki  [ = ]       0    .debug_info
  -0.7% -24.3Ki  [ = ]       0    .debug_str
  -0.5% -34.5Ki  -0.0%    -100    TOTAL
use_config/nrf52840_ble — 436.6 KiB → 436.8 KiB (+0.04% ⬆️)

cargo size (PR):

   text	   data	    bss	    dec	    hex	filename
 395208	   4588	  47520	 447316	  6d354	rmk-nrf52840

cargo size (main):

   text	   data	    bss	    dec	    hex	filename
 394944	   4596	  47576	 447116	  6d28c	rmk-nrf52840

Bloaty diff (PR vs main):

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.4%    +592  [ = ]       0    .symtab
  +0.1%    +188  +0.1%    +188    .text
  +0.4%    +176  [ = ]       0    .debug_aranges
  +0.3%    +168  [ = ]       0    .debug_frame
  +0.2%     +76  +0.2%     +76    .rodata
  -0.2%      -8  -0.2%      -8    .data
  [ = ]       0  -0.1%     -56    .bss
  -0.7%     -57  [ = ]       0    .debug_abbrev
  -0.0%    -165  [ = ]       0    .strtab
  -0.3% -1.02Ki  [ = ]       0    .debug_line
  -0.1% -1.09Ki  [ = ]       0    .debug_loc
  -0.5% -1.22Ki  [ = ]       0    .debug_ranges
  -0.5% -9.91Ki  [ = ]       0    .debug_info
  -0.8% -31.6Ki  [ = ]       0    .debug_str
  -0.5% -43.9Ki  +0.0%    +200    TOTAL
use_config/nrf52840_ble_split (central) — 490.6 KiB → 491.5 KiB (+0.17% ⬆️)

cargo size (PR):

   text	   data	    bss	    dec	    hex	filename
 452448	   4652	  46168	 503268	  7ade4	central

cargo size (main):

   text	   data	    bss	    dec	    hex	filename
 451660	   4652	  46072	 502384	  7aa70	central

Bloaty diff (PR vs main):

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +1.6% +13.1Ki  [ = ]       0    .debug_loc
  +3.4% +1.61Ki  [ = ]       0    .debug_aranges
  +0.5%    +752  [ = ]       0    .symtab
  +0.2%    +692  +0.2%    +692    .text
  +0.2%    +512  [ = ]       0    .debug_ranges
  +0.1%    +438  [ = ]       0    .strtab
  +0.1%    +318  [ = ]       0    .debug_line
  +0.5%    +272  [ = ]       0    .debug_frame
  [ = ]       0  +0.2%     +96    .bss
  +0.2%     +96  +0.2%     +96    .rodata
  +0.5%     +39  [ = ]       0    .debug_abbrev
   +20%     +11  [ = ]       0    [Unmapped]
  +0.9%      +8  [ = ]       0    .defmt
  -0.0% -1.73Ki  [ = ]       0    .debug_str
  -0.2% -5.12Ki  [ = ]       0    .debug_info
  +0.1% +11.0Ki  +0.2%    +884    TOTAL
use_config/nrf52840_ble_split (peripheral) — 315.9 KiB → 315.7 KiB (-0.04% ⬇️)

cargo size (PR):

   text	   data	    bss	    dec	    hex	filename
 291672	   4468	  27160	 323300	  4eee4	peripheral

cargo size (main):

   text	   data	    bss	    dec	    hex	filename
 291812	   4468	  27152	 323432	  4ef68	peripheral

Bloaty diff (PR vs main):

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.9% +27.6Ki  [ = ]       0    .debug_str
  +0.2% +3.43Ki  [ = ]       0    .debug_info
  +3.7% +1.50Ki  [ = ]       0    .debug_aranges
  +0.1%    +218  [ = ]       0    .strtab
  +0.2%    +192  [ = ]       0    .symtab
  +0.3%    +108  [ = ]       0    .debug_frame
  +0.1%     +16  +0.1%     +16    .rodata
   +27%     +15  [ = ]       0    [Unmapped]
  [ = ]       0  +0.0%      +8    .bss
  -0.0%     -61  [ = ]       0    .debug_line
  -0.1%    -156  -0.1%    -156    .text
  -0.3%    -552  [ = ]       0    .debug_ranges
  -0.4% -2.03Ki  [ = ]       0    .debug_loc
  +0.5% +30.3Ki  -0.0%    -132    TOTAL
use_config/pi_pico_w_ble — 664.6 KiB → 665.2 KiB (+0.08% ⬆️)

cargo size (PR):

   text	   data	    bss	    dec	    hex	filename
 627188	      0	  53956	 681144	  a64b8	rmk-pi-pico-w

cargo size (main):

   text	   data	    bss	    dec	    hex	filename
 626712	      0	  53860	 680572	  a627c	rmk-pi-pico-w

Bloaty diff (PR vs main):

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.1% +3.26Ki  [ = ]       0    .debug_str
  +3.8% +1.59Ki  [ = ]       0    .debug_aranges
  +0.5% +1.23Ki  [ = ]       0    .debug_ranges
  +0.2%    +596  [ = ]       0    .strtab
  +0.1%    +448  +0.1%    +448    .text
  +0.0%    +393  [ = ]       0    .debug_loc
  [ = ]       0  +0.2%     +96    .bss
  +0.0%     +28  +0.0%     +28    .rodata
  +0.9%      +8  [ = ]       0    .defmt
  +7.0%      +4  [ = ]       0    [Unmapped]
  -0.1%      -8  [ = ]       0    .debug_abbrev
  -0.1%     -40  [ = ]       0    .debug_frame
  -0.1%     -96  [ = ]       0    .symtab
  -0.1%    -338  [ = ]       0    .debug_line
  -0.1% -2.63Ki  [ = ]       0    .debug_info
  +0.0% +4.42Ki  +0.1%    +572    TOTAL
use_config/rp2040 — 145.7 KiB → 143.1 KiB (-1.82% ⬇️)

cargo size (PR):

   text	   data	    bss	    dec	    hex	filename
 132040	      0	  14460	 146500	  23c44	rmk-rp2040

cargo size (main):

   text	   data	    bss	    dec	    hex	filename
 134428	      0	  14788	 149216	  246e0	rmk-rp2040

Bloaty diff (PR vs main):

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +3.4%    +560  [ = ]       0    .debug_aranges
 -18.9%     -10  [ = ]       0    [Unmapped]
  -0.3%     -20  [ = ]       0    .debug_abbrev
  -1.1%    -184  -1.1%    -184    .rodata
  -1.6%    -272  [ = ]       0    .debug_frame
  [ = ]       0  -2.4%    -328    .bss
  -1.1%    -352  [ = ]       0    .symtab
  -1.0% -1.19Ki  [ = ]       0    .strtab
  -2.0% -1.67Ki  [ = ]       0    .debug_ranges
  -1.9% -2.15Ki  -1.9% -2.15Ki    .text
  -1.7% -2.71Ki  [ = ]       0    .debug_line
  -1.1% -3.37Ki  [ = ]       0    .debug_loc
  -2.3% -22.8Ki  [ = ]       0    .debug_info
  -3.2% -53.2Ki  [ = ]       0    .debug_str
  -2.5% -87.4Ki  -1.8% -2.65Ki    TOTAL
use_config/rp2040_split (central) — 159.2 KiB → 156.5 KiB (-1.71% ⬇️)

cargo size (PR):

   text	   data	    bss	    dec	    hex	filename
 144836	      0	  15412	 160248	  271f8	central

cargo size (main):

   text	   data	    bss	    dec	    hex	filename
 147384	      0	  15652	 163036	  27cdc	central

Bloaty diff (PR vs main):

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +3.5%    +592  [ = ]       0    .debug_aranges
  +2.3%      +4  +2.9%      +4    .data
 -20.0%     -11  [ = ]       0    [Unmapped]
  -0.3%     -20  [ = ]       0    .debug_abbrev
  -1.0%    -180  -1.0%    -180    .rodata
  -1.2%    -236  [ = ]       0    .debug_frame
  [ = ]       0  -1.6%    -240    .bss
  -1.1%    -400  [ = ]       0    .symtab
  -0.3%    -428  [ = ]       0    .strtab
  -2.0% -1.86Ki  [ = ]       0    .debug_ranges
  -1.8% -2.32Ki  -1.8% -2.32Ki    .text
  -1.4% -2.53Ki  [ = ]       0    .debug_line
  -2.6% -9.21Ki  [ = ]       0    .debug_loc
  -1.5% -16.3Ki  [ = ]       0    .debug_info
  -1.7% -32.7Ki  [ = ]       0    .debug_str
  -1.6% -65.6Ki  -1.7% -2.72Ki    TOTAL
use_config/rp2040_split (peripheral) — 27.8 KiB → 27.8 KiB (+0.15% ⬆️)

cargo size (PR):

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

cargo size (main):

   text	   data	    bss	    dec	    hex	filename
  25612	     60	   2796	  28468	   6f34	peripheral

Bloaty diff (PR vs main):

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +1.6% +13.1Ki  [ = ]       0    .debug_str
  +0.8% +3.18Ki  [ = ]       0    .debug_info
  +1.1%    +791  [ = ]       0    .debug_loc
  +5.0%    +664  [ = ]       0    .debug_aranges
  +0.3%    +186  [ = ]       0    .debug_line
  +0.8%    +144  [ = ]       0    .debug_ranges
  +0.2%     +36  +0.2%     +36    .text
  [ = ]       0  +0.5%      +8    .bss
 -16.3%      -7  [ = ]       0    [Unmapped]
  -0.2%     -40  [ = ]       0    .strtab
  +1.3% +18.0Ki  +0.2%     +44    TOTAL
use_config/stm32f1 — 61.9 KiB → 62.1 KiB (+0.34% ⬆️)

cargo size (PR):

   text	   data	    bss	    dec	    hex	filename
  56580	     28	   6948	  63556	   f844	rmk-stm32f1

cargo size (main):

   text	   data	    bss	    dec	    hex	filename
  56504	     28	   6804	  63336	   f768	rmk-stm32f1

Bloaty diff (PR vs main):

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.2% +1.56Ki  [ = ]       0    .debug_str
  +0.2%    +913  [ = ]       0    .debug_info
  +0.2%    +198  [ = ]       0    .debug_loc
  [ = ]       0  +2.1%    +144    .bss
  +0.1%     +76  +0.1%     +76    .text
  +0.0%     +43  [ = ]       0    .debug_line
  +0.1%      +8  [ = ]       0    .debug_aranges
  -8.8%      -5  [ = ]       0    [Unmapped]
  -0.1%     -47  [ = ]       0    .strtab
  -0.3%    -112  [ = ]       0    .debug_ranges
  +0.1% +2.61Ki  +0.3%    +220    TOTAL
use_config/stm32h7 — 99.0 KiB → 99.4 KiB (+0.41% ⬆️)

cargo size (PR):

   text	   data	    bss	    dec	    hex	filename
  92832	    264	   8728	 101824	  18dc0	rmk-stm32h7

cargo size (main):

   text	   data	    bss	    dec	    hex	filename
  92152	    264	   8992	 101408	  18c20	rmk-stm32h7

Bloaty diff (PR vs main):

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +3.5% +5.97Ki  [ = ]       0    .debug_loc
  +5.2% +3.41Ki  [ = ]       0    .debug_ranges
  +3.6% +1.16Ki  [ = ]       0    .debug_aranges
  +3.9%    +496  +3.9%    +496    .rodata
  +0.2%    +184  +0.2%    +184    .text
  -5.8%      -9  [ = ]       0    .defmt
 -22.0%     -11  [ = ]       0    [Unmapped]
  -1.7%    -113  [ = ]       0    .debug_abbrev
  -1.0%    -156  [ = ]       0    .debug_frame
  [ = ]       0  -2.9%    -264    .bss
  -0.3%    -377  [ = ]       0    .debug_line
  -1.8%    -496  [ = ]       0    .symtab
  -4.4% -2.88Ki  [ = ]       0    .strtab
  -0.4% -4.03Ki  [ = ]       0    .debug_info
  -0.7% -14.1Ki  [ = ]       0    .debug_str
  -0.3% -11.0Ki  +0.4%    +416    TOTAL
use_rust/nrf52832_ble — 380.0 KiB → 378.6 KiB (-0.36% ⬇️)

cargo size (PR):

   text	   data	    bss	    dec	    hex	filename
 350544	   4588	  32576	 387708	  5ea7c	rmk-nrf52832

cargo size (main):

   text	   data	    bss	    dec	    hex	filename
 351544	   4588	  33000	 389132	  5f00c	rmk-nrf52832

Bloaty diff (PR vs main):

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.7% +1.91Ki  [ = ]       0    .strtab
  +0.0%     +72  [ = ]       0    .debug_ranges
  +1.7%      +8  [ = ]       0    .defmt
   +18%      +8  [ = ]       0    [Unmapped]
  -0.0%      -4  -0.0%      -4    .rodata
  -0.2%     -16  [ = ]       0    .debug_abbrev
  -0.0%     -16  [ = ]       0    .debug_aranges
  -0.2%     -76  [ = ]       0    .debug_frame
  -0.1%    -160  [ = ]       0    .symtab
  [ = ]       0  -1.3%    -424    .bss
  -0.3%    -872  [ = ]       0    .debug_line
  -0.3%    -996  -0.3%    -996    .text
  -0.5% -3.20Ki  [ = ]       0    .debug_loc
  -0.5% -8.75Ki  [ = ]       0    .debug_info
  -0.7% -23.9Ki  [ = ]       0    .debug_str
  -0.5% -36.0Ki  -0.4% -1.39Ki    TOTAL
use_rust/nrf52840_ble — 433.7 KiB → 433.0 KiB (-0.17% ⬇️)

cargo size (PR):

   text	   data	    bss	    dec	    hex	filename
 394960	   4588	  43800	 443348	  6c3d4	rmk-nrf52840

cargo size (main):

   text	   data	    bss	    dec	    hex	filename
 395680	   4588	  43864	 444132	  6c6e4	rmk-nrf52840

Bloaty diff (PR vs main):

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.3% +1.05Ki  [ = ]       0    .strtab
  +0.1%     +60  +0.1%     +60    .rodata
 -23.2%     -16  [ = ]       0    [Unmapped]
  -0.1%     -40  [ = ]       0    .debug_aranges
  [ = ]       0  -0.1%     -64    .bss
  -0.0%     -64  [ = ]       0    .symtab
  -0.0%    -112  [ = ]       0    .debug_line
  -0.3%    -132  [ = ]       0    .debug_frame
  -0.2%    -780  -0.2%    -780    .text
  -0.6% -1.38Ki  [ = ]       0    .debug_ranges
  -0.7% -5.31Ki  [ = ]       0    .debug_loc
  -0.5% -9.81Ki  [ = ]       0    .debug_info
  -0.7% -27.0Ki  [ = ]       0    .debug_str
  -0.5% -43.5Ki  -0.2%    -784    TOTAL
use_rust/nrf52840_ble_split (central) — 499.3 KiB → 499.2 KiB (-0.01% ⬇️)

cargo size (PR):

   text	   data	    bss	    dec	    hex	filename
 455604	   4652	  50896	 511152	  7ccb0	central

cargo size (main):

   text	   data	    bss	    dec	    hex	filename
 455640	   4652	  50952	 511244	  7cd0c	central

Bloaty diff (PR vs main):

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.1%    +499  [ = ]       0    .strtab
  +0.2%    +336  [ = ]       0    .symtab
  +0.1%    +244  [ = ]       0    .debug_line
  +0.0%    +118  [ = ]       0    .debug_loc
  +0.2%     +80  +0.2%     +80    .rodata
  +0.1%     +48  [ = ]       0    .debug_aranges
  +0.1%     +40  [ = ]       0    .debug_frame
   +16%      +7  [ = ]       0    [Unmapped]
  [ = ]       0  -0.1%     -56    .bss
  -0.0%    -116  -0.0%    -116    .text
  -0.3%    -824  [ = ]       0    .debug_ranges
  -0.4% -8.27Ki  [ = ]       0    .debug_info
  -0.6% -27.2Ki  [ = ]       0    .debug_str
  -0.4% -35.1Ki  -0.0%     -92    TOTAL
use_rust/nrf52840_ble_split (peripheral) — 312.3 KiB → 312.2 KiB (+0.00% ⬇️)

cargo size (PR):

   text	   data	    bss	    dec	    hex	filename
 289856	   4468	  25408	 319732	  4e0f4	peripheral

cargo size (main):

   text	   data	    bss	    dec	    hex	filename
 289892	   4468	  25400	 319760	  4e110	peripheral

Bloaty diff (PR vs main):

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.1%    +184  [ = ]       0    .debug_ranges
  [ = ]       0  +0.0%      +8    .bss
  +0.0%      +8  [ = ]       0    .debug_aranges
  +1.7%      +1  [ = ]       0    [Unmapped]
  -0.0%      -3  [ = ]       0    .debug_line
  -0.1%     -32  [ = ]       0    .debug_frame
  -0.0%     -36  -0.0%     -36    .text
  -0.1%     -64  [ = ]       0    .symtab
  -0.1%    -155  [ = ]       0    .strtab
  -0.3% -1.69Ki  [ = ]       0    .debug_loc
  -0.1% -2.30Ki  [ = ]       0    .debug_info
  -0.2% -6.35Ki  [ = ]       0    .debug_str
  -0.2% -10.4Ki  -0.0%     -28    TOTAL
use_rust/pi_pico_w_ble — 664.9 KiB → 664.8 KiB (-0.02% ⬇️)

cargo size (PR):

   text	   data	    bss	    dec	    hex	filename
 626760	      0	  53956	 680716	  a630c	rmk-pi-pico-w

cargo size (main):

   text	   data	    bss	    dec	    hex	filename
 626884	      0	  54004	 680888	  a63b8	rmk-pi-pico-w

Bloaty diff (PR vs main):

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.2%    +761  [ = ]       0    .strtab
  +0.0%     +32  +0.0%     +32    .rodata
   +62%     +28  [ = ]       0    [Unmapped]
  +0.1%      +8  [ = ]       0    .debug_abbrev
  +0.9%      +8  [ = ]       0    .defmt
  -0.0%     -16  [ = ]       0    .debug_aranges
  [ = ]       0  -0.1%     -48    .bss
  -0.2%     -92  [ = ]       0    .debug_frame
  -0.0%    -156  -0.0%    -156    .text
  -0.4%    -368  [ = ]       0    .symtab
  -0.1%    -585  [ = ]       0    .debug_line
  -0.3%    -776  [ = ]       0    .debug_ranges
  -0.5% -5.03Ki  [ = ]       0    .debug_loc
  -0.4% -10.0Ki  [ = ]       0    .debug_info
  -0.6% -26.7Ki  [ = ]       0    .debug_str
  -0.5% -42.9Ki  -0.0%    -172    TOTAL
use_rust/rp2040 — 145.3 KiB → 142.5 KiB (-1.94% ⬇️)

cargo size (PR):

   text	   data	    bss	    dec	    hex	filename
 131696	      0	  14188	 145884	  239dc	rmk-rp2040

cargo size (main):

   text	   data	    bss	    dec	    hex	filename
 134120	      0	  14660	 148780	  2452c	rmk-rp2040

Bloaty diff (PR vs main):

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.1%    +235  [ = ]       0    .debug_loc
  +0.0%     +40  [ = ]       0    .debug_ranges
   +62%     +24  [ = ]       0    [Unmapped]
  -0.3%     -20  [ = ]       0    .debug_abbrev
  -0.4%     -72  [ = ]       0    .debug_aranges
  -1.1%    -184  -1.1%    -184    .rodata
  -1.6%    -272  [ = ]       0    .debug_frame
  -1.3%    -416  [ = ]       0    .symtab
  [ = ]       0  -3.5%    -472    .bss
  -1.0% -1.19Ki  [ = ]       0    .strtab
  -1.9% -2.19Ki  -1.9% -2.19Ki    .text
  -1.7% -2.83Ki  [ = ]       0    .debug_line
  -2.7% -26.6Ki  [ = ]       0    .debug_info
  -3.8% -62.5Ki  [ = ]       0    .debug_str
  -2.7% -95.9Ki  -1.9% -2.83Ki    TOTAL
use_rust/rp2040_split (central) — 158.1 KiB → 155.2 KiB (-1.87% ⬇️)

cargo size (PR):

   text	   data	    bss	    dec	    hex	filename
 143852	      0	  15044	 158896	  26cb0	central

cargo size (main):

   text	   data	    bss	    dec	    hex	filename
 146488	      0	  15436	 161924	  27884	central

Bloaty diff (PR vs main):

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +3.5%    +592  [ = ]       0    .debug_aranges
  +1.8%      +8  [ = ]       0    .defmt
  +2.3%      +4  +2.9%      +4    .data
  -0.3%     -20  [ = ]       0    .debug_abbrev
 -37.0%     -20  [ = ]       0    [Unmapped]
  -1.0%    -184  -1.0%    -184    .rodata
  -1.2%    -236  [ = ]       0    .debug_frame
  -0.9%    -336  [ = ]       0    .symtab
  -0.3%    -365  [ = ]       0    .strtab
  [ = ]       0  -2.7%    -392    .bss
  -2.2% -2.01Ki  [ = ]       0    .debug_ranges
  -1.9% -2.40Ki  -1.9% -2.40Ki    .text
  -1.5% -2.71Ki  [ = ]       0    .debug_line
  -3.1% -10.6Ki  [ = ]       0    .debug_loc
  -1.5% -16.6Ki  [ = ]       0    .debug_info
  -1.5% -29.5Ki  [ = ]       0    .debug_str
  -1.6% -64.3Ki  -1.9% -2.96Ki    TOTAL
use_rust/rp2040_split (peripheral) — 28.2 KiB → 28.2 KiB (+0.15% ⬆️)

cargo size (PR):

   text	   data	    bss	    dec	    hex	filename
  25748	     60	   3068	  28876	   70cc	peripheral

cargo size (main):

   text	   data	    bss	    dec	    hex	filename
  25712	     60	   3060	  28832	   70a0	peripheral

Bloaty diff (PR vs main):

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +1.6% +13.1Ki  [ = ]       0    .debug_str
  +0.8% +3.18Ki  [ = ]       0    .debug_info
  +1.4%    +940  [ = ]       0    .debug_loc
  +5.0%    +664  [ = ]       0    .debug_aranges
  +0.3%    +197  [ = ]       0    .debug_line
  +0.9%    +152  [ = ]       0    .debug_ranges
  +0.2%     +36  +0.2%     +36    .text
   +94%     +33  [ = ]       0    [Unmapped]
  [ = ]       0  +0.4%      +8    .bss
  -0.2%     -40  [ = ]       0    .strtab
  +1.3% +18.2Ki  +0.2%     +44    TOTAL
use_rust/stm32f1 — 61.2 KiB → 61.3 KiB (+0.02% ⬆️)

cargo size (PR):

   text	   data	    bss	    dec	    hex	filename
  55932	     28	   6772	  62732	   f50c	rmk-stm32f1

cargo size (main):

   text	   data	    bss	    dec	    hex	filename
  55916	     28	   6772	  62716	   f4fc	rmk-stm32f1

Bloaty diff (PR vs main):

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.2% +1.45Ki  [ = ]       0    .debug_str
  +0.2%    +897  [ = ]       0    .debug_info
  +0.1%    +142  [ = ]       0    .debug_loc
  +0.1%     +75  [ = ]       0    .debug_line
  +0.1%     +24  [ = ]       0    .debug_ranges
   +46%     +18  [ = ]       0    [Unmapped]
  +0.0%     +16  +0.0%     +16    .text
  -0.1%     -47  [ = ]       0    .strtab
  +0.1% +2.55Ki  +0.0%     +16    TOTAL
use_rust/stm32h7 — 119.7 KiB → 116.8 KiB (-2.39% ⬇️)

cargo size (PR):

   text	   data	    bss	    dec	    hex	filename
 104816	    320	  14468	 119604	  1d334	rmk-stm32h7

cargo size (main):

   text	   data	    bss	    dec	    hex	filename
 107284	    320	  14940	 122544	  1deb0	rmk-stm32h7

Bloaty diff (PR vs main):

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.5% +11.5Ki  [ = ]       0    .debug_str
  +9.0% +3.36Ki  [ = ]       0    .debug_aranges
  +3.3%      +2  [ = ]       0    [Unmapped]
  -1.3%     -89  [ = ]       0    .debug_abbrev
  -0.7%    -132  [ = ]       0    .debug_frame
  -0.8%    -304  [ = ]       0    .symtab
  [ = ]       0  -3.4%    -472    .bss
  -1.4% -1.42Ki  [ = ]       0    .strtab
  -1.4% -2.10Ki  [ = ]       0    .debug_line
  -2.4% -2.41Ki  -2.4% -2.41Ki    .text
  -3.9% -3.20Ki  [ = ]       0    .debug_ranges
  -0.5% -5.46Ki  [ = ]       0    .debug_info
  -4.1% -9.99Ki  [ = ]       0    .debug_loc
  -0.2% -10.2Ki  -2.4% -2.87Ki    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: 8695c55
Status: ✅  Deploy successful!
Preview URL: https://1bfc3c16.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
Collaborator 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 3 times, most recently from 9047ce5 to 8ea6723 Compare June 25, 2026 03:29
@HaoboGu
HaoboGu force-pushed the feat/rynk_protocol branch from c387d14 to b78964e Compare July 2, 2026 11:11
@HaoboGu
HaoboGu force-pushed the feat/rynk_protocol branch 3 times, most recently from 28b17bd to 9768858 Compare July 9, 2026 14:55
@HaoboGu
HaoboGu marked this pull request as ready for review July 9, 2026 15:21

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ff7c9c7309

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread rmk-config/src/lib.rs
Comment thread rynk/src/api.rs
@HaoboGu
HaoboGu force-pushed the feat/rynk_protocol branch 3 times, most recently from 38f5948 to 4111105 Compare July 10, 2026 13:08
HaoboGu added 8 commits July 10, 2026 22:48
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.
HaoboGu added 10 commits July 14, 2026 09:57
fix: reject zero-layer keymap configurations
fix: fail closed after cancelled Rynk reads
Follow-up to #943. A cancelled read or write poisons the client, but
is_alive() still returned true and next_event()'s doc still claimed
"Cancel-safe" — both misreport a link that dies on the very next call.

- is_alive() now also checks send_in_flight/receive_in_flight, so it
  reads false the instant an operation is cancelled.
- Correct the next_event() doc; drop the stale "for cancel safety"
  read-loop comment left over from the removed resync path.
- Update the cancellation tests that codified the old is_alive() state.
…ency

fix: reflect cancellation poison in is_alive and next_event docs
wasm-smoke.ts asserted only get_led_indicator's return type, so a broken descriptor for any other wasm object type would pass. Point tsc at the whole generated rynk_wasm.d.ts instead.

Build --dev too: a release build constant-folds a malformed type descriptor into a valid-looking name, so the check only bites on the un-optimized dev output it was meant to guard.
fix: emit valid WASM object type descriptors
Signed-off-by: Haobo Gu <haobogu@outlook.com>
Render every endpoint and topic — id, name, payload types, feature
gate, and row docs — into docs/development/rynk_protocol.md from the
endpoints!/topics! tables via new ENDPOINT_META/TOPIC_META. An
UPDATE_SNAPSHOTS-style rmk-types test regenerates and gates drift, so
the reference stays in lockstep with the wire contract.

Additive to rmk-types only; no protocol or wire changes.
HaoboGu added 12 commits July 15, 2026 23:51
fix(wasm): release Web Serial locks on close
docs(rynk): generate the protocol reference from the command tables
Bulk Set/Get handlers decoded/encoded a whole `heapless::Vec<_, BULK_SIZE>`
on the stack, held across `.await` in the session future — a second copy of
the payload that, for keymap, exceeded `RYNK_BUFFER_SIZE` itself. That RAM
cost was the only reason bulk was a separate, opt-in feature.

Stream instead: `Get*Bulk` writes the page straight into the response buffer
(`RynkMessage::encode_bulk_ok`), and `Set*Bulk` walks the payload one element
at a time. The two-pass write (validate-all-decode, then apply) keeps the
all-or-nothing guarantee a malformed tail would otherwise break. Peak extra
RAM drops from `BULK_SIZE * size_of::<Item>()` to a single element.

The six bulk endpoints keep the `Handle<E>` abstraction and uniform dispatch
by overriding the provided `handle_message`; `handle` becomes a default so
fixed endpoints are unchanged. postcard's sequential encoding makes the
streamed bytes identical to the owned-`Vec` form, so hosts interoperate
unchanged — the loopback suite (round-trips, row/layer wrap, clamps, rejects)
passes as-is.

With the RAM cost gone, bulk is always available under `rynk`: the `bulk`
feature is removed and `@bulk` now only exempts a row from the buffer-floor
fold. Adds an all-or-nothing test for a malformed mid-stream element.
Pull the repeated "decode one element, advance the cursor, map to
Malformed" step out of the three Set handlers and validate_bulk_elements
into a single take_element helper. Trims the two-pass write loops to one
line each and tightens the comments.
Signed-off-by: Haobo Gu <haobogu@outlook.com>
Model fixed and bulk endpoints as two disjoint traits instead of one
template-method trait with an Unimplemented default hook:

- `Handle<E>`: required `handle(req) -> resp`; forgetting a typed
  handler is now a compile error, not a runtime Unimplemented.
- `HandleBulk<E>`: `handle_bulk(msg)` streams through the session
  buffer, no Vec materialized.
- `Serve<E, Mode>`: the uniform dispatch surface, blanket-derived from
  either trait. `Fixed`/`Bulk` markers keep the two blanket impls from
  overlapping (trait bounds alone can't); the mode infers as `_`.

Dispatcher arms are uniform `Serve::<command::X, _>::serve(self, msg)`.
The 38 fixed handlers are untouched; the 6 bulk handlers move to
HandleBulk with identical bodies.
…op host inbound ceiling

Endpoint/Topic now describe only the wire schema. MaxSize is folded privately by the firmware, which self-asserts its fixed RYNK_BUFFER_SIZE holds every frame (bulk included). postcard is slice-driven, so the host never needs per-type MaxSize: host bulk types stay unbounded alloc::Vec, and the placeholder POSTCARD_MAX_SIZE = RYNK_BUFFER_SIZE plus the @bulk/@floor/@gate macro machinery that existed only to work around it are gone. Command-table rows are now uniform.

The host driver drops the inbound size ceiling entirely: frames are read by their u16 LEN and routed (reply -> SEQ+decode, topic -> decode-or-Unknown). Only transport failures and caller cancellation latch the link dead, closing a pre-existing gap where a large/unknown pre-handshake topic could kill it. tx_buf is sized to the device's advertised buffer, so an oversized outbound request fails to encode (non-fatal Encode) instead of the now-dead TooLarge check.

No wire-format change; command IDs, payloads, capabilities, bulk page sizing, and snapshots unchanged.

Signed-off-by: Haobo Gu <haobogu@outlook.com>
refactor(rynk): stream bulk transfer, drop the `bulk` feature
@HaoboGu HaoboGu mentioned this pull request Jul 16, 2026
@HaoboGu HaoboGu closed this Jul 16, 2026
@HaoboGu

HaoboGu commented Jul 16, 2026

Copy link
Copy Markdown
Collaborator Author

In favor of #962

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.

4 participants