Skip to content

feat: add embassy-boot bootloader - #1007

Open
Schievel1 wants to merge 2 commits into
HaoboGu:mainfrom
Schievel1:bootymcbootface
Open

feat: add embassy-boot bootloader#1007
Schievel1 wants to merge 2 commits into
HaoboGu:mainfrom
Schievel1:bootymcbootface

Conversation

@Schievel1

@Schievel1 Schievel1 commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

I think rmk should provide pre built binaries for the bootloader, so people don't need to build that. I included a github action to create those automatically when making a tag of the whole repo that is named "bootymcbootface-v*". It would then make a release from that and attach the binaries.
Let me know if you want to do it otherwise or not want pre built binaries at all and I will remove it.

Signed-off-by: Pascal Jäger <pascal.jaeger@leimstift.de>
@Schievel1
Schievel1 marked this pull request as draft July 30, 2026 06:05
@github-actions

github-actions Bot commented Jul 30, 2026

Copy link
Copy Markdown

Size Report

Example main PR Diff .text .data .bss
use_config/nrf52832_ble 398.7 KiB 398.7 KiB +0.00% ⬇️ -4 0 0
use_config/nrf52840_ble 448.3 KiB 448.3 KiB +0.00% ⬇️ -4 0 0
use_config/nrf52840_ble_split (central) 501.4 KiB 501.4 KiB +0.00% ⬇️ -4 0 0
use_config/nrf52840_ble_split (peripheral) 320.5 KiB 320.5 KiB +0.00% ⬇️ -4 0 0
use_config/pi_pico_w_ble 672.4 KiB 672.4 KiB +0.00% ⬇️ -4 0 0
use_config/rp2040 150.4 KiB 150.4 KiB +0.00% 0 0 0
use_config/rp2040_split (central) 164.3 KiB 164.3 KiB +0.00% ⬇️ -4 0 0
use_config/rp2040_split (peripheral) 27.8 KiB 27.8 KiB +0.00% 0 0 0
use_config/stm32f1 63.6 KiB 63.6 KiB +0.00% ⬆️ +4 0 0
use_config/stm32h7 101.9 KiB 101.9 KiB +0.00% ⬇️ -4 0 0
use_rust/nrf52832_ble 387.0 KiB 387.0 KiB +0.00% ⬆️ +4 0 0
use_rust/nrf52840_ble 441.9 KiB 441.9 KiB +0.00% ⬇️ -4 0 0
use_rust/nrf52840_ble_split (central) 508.0 KiB 508.0 KiB +0.00% ⬆️ +4 0 0
use_rust/nrf52840_ble_split (peripheral) 318.4 KiB 318.4 KiB +0.00% ⬇️ -4 0 0
use_rust/pi_pico_w_ble 672.8 KiB 672.7 KiB +0.00% ⬇️ -8 0 0
use_rust/rp2040 150.2 KiB 150.2 KiB +0.00% ⬇️ -4 0 0
use_rust/rp2040_split (central) 162.7 KiB 162.7 KiB +0.00% ⬇️ -4 0 0
use_rust/rp2040_split (peripheral) 28.2 KiB 28.2 KiB +0.00% 0 0 0
use_rust/stm32f1 63.5 KiB 63.5 KiB +0.00% 0 0 0
use_rust/stm32h7 121.8 KiB 121.8 KiB +0.00% ⬇️ -4 0 0
use_config/nrf52832_ble — 398.7 KiB → 398.7 KiB (+0.00% ⬇️)

cargo size (PR):

   text	   data	    bss	    dec	    hex	filename
 364568	   8620	  35056	 408244	  63ab4	rmk-nrf52832

cargo size (main):

   text	   data	    bss	    dec	    hex	filename
 364572	   8620	  35056	 408248	  63ab8	rmk-nrf52832

Bloaty diff (PR vs main):

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.0%     +10  [ = ]       0    .debug_loc
  -0.0%      -4  -0.0%      -4    .text
 -42.5%     -31  [ = ]       0    [Unmapped]
  -0.0%     -97  [ = ]       0    .debug_line
  -0.0%    -135  [ = ]       0    .debug_str
  -0.0%    -819  [ = ]       0    .debug_info
  -0.0% -1.05Ki  -0.0%      -4    TOTAL
use_config/nrf52840_ble — 448.3 KiB → 448.3 KiB (+0.00% ⬇️)

cargo size (PR):

   text	   data	    bss	    dec	    hex	filename
 397300	   8628	  53168	 459096	  70158	rmk-nrf52840

cargo size (main):

   text	   data	    bss	    dec	    hex	filename
 397304	   8628	  53168	 459100	  7015c	rmk-nrf52840

Bloaty diff (PR vs main):

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +6.1%      +4  [ = ]       0    [Unmapped]
  -0.0%      -4  -0.0%      -4    .text
  [ = ]       0  -0.0%      -4    TOTAL
use_config/nrf52840_ble_split (central) — 501.4 KiB → 501.4 KiB (+0.00% ⬇️)

cargo size (PR):

   text	   data	    bss	    dec	    hex	filename
 454768	   8684	  49976	 513428	  7d594	central

cargo size (main):

   text	   data	    bss	    dec	    hex	filename
 454772	   8684	  49976	 513432	  7d598	central

Bloaty diff (PR vs main):

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.0%    +230  [ = ]       0    .debug_str
  +0.0%     +50  [ = ]       0    .debug_line
  +0.0%     +23  [ = ]       0    .strtab
   +10%      +5  [ = ]       0    [Unmapped]
  -0.0%      -4  -0.0%      -4    .rodata
  -0.0%     -21  [ = ]       0    .debug_info
  -0.5%     -39  [ = ]       0    .debug_abbrev
  +0.0%    +244  -0.0%      -4    TOTAL
use_config/nrf52840_ble_split (peripheral) — 320.5 KiB → 320.5 KiB (+0.00% ⬇️)

cargo size (PR):

   text	   data	    bss	    dec	    hex	filename
 292264	   8500	  27464	 328228	  50224	peripheral

cargo size (main):

   text	   data	    bss	    dec	    hex	filename
 292268	   8500	  27464	 328232	  50228	peripheral

Bloaty diff (PR vs main):

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.0%    +232  [ = ]       0    .debug_info
  +0.0%    +156  [ = ]       0    .debug_str
  +0.0%     +98  [ = ]       0    .debug_line
   +12%      +6  [ = ]       0    [Unmapped]
  +0.0%      +4  [ = ]       0    .strtab
  -0.0%      -4  -0.0%      -4    .text
  +0.0%    +492  -0.0%      -4    TOTAL
use_config/pi_pico_w_ble — 672.4 KiB → 672.4 KiB (+0.00% ⬇️)

cargo size (PR):

   text	   data	    bss	    dec	    hex	filename
 634268	      0	  54304	 688572	  a81bc	rmk-pi-pico-w

cargo size (main):

   text	   data	    bss	    dec	    hex	filename
 634272	      0	  54304	 688576	  a81c0	rmk-pi-pico-w

Bloaty diff (PR vs main):

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.0%    +330  [ = ]       0    .debug_info
  +0.0%    +128  [ = ]       0    .debug_line
  +0.4%     +39  [ = ]       0    .debug_abbrev
  +0.0%     +25  [ = ]       0    .strtab
  +6.2%      +3  [ = ]       0    [Unmapped]
  -0.0%      -4  -0.0%      -4    .text
  -0.0%     -65  [ = ]       0    .debug_str
  +0.0%    +456  -0.0%      -4    TOTAL
use_config/rp2040 — 150.4 KiB → 150.4 KiB (+0.00%)

cargo size (PR):

   text	   data	    bss	    dec	    hex	filename
 138376	      0	  15644	 154020	  259a4	rmk-rp2040

cargo size (main):

   text	   data	    bss	    dec	    hex	filename
 138376	      0	  15644	 154020	  259a4	rmk-rp2040

Bloaty diff (PR vs main):

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.1%    +124  [ = ]       0    .debug_line
  +0.0%    +101  [ = ]       0    .debug_str
  +0.0%     +37  [ = ]       0    .debug_info
  +0.0%     +12  [ = ]       0    .debug_loc
  +0.0%      +1  [ = ]       0    .strtab
  +2.4%      +1  [ = ]       0    [Unmapped]
  +0.0%    +276  [ = ]       0    TOTAL
use_config/rp2040_split (central) — 164.3 KiB → 164.3 KiB (+0.00% ⬇️)

cargo size (PR):

   text	   data	    bss	    dec	    hex	filename
 151688	      0	  16508	 168196	  29104	central

cargo size (main):

   text	   data	    bss	    dec	    hex	filename
 151692	      0	  16508	 168200	  29108	central

Bloaty diff (PR vs main):

    FILE SIZE        VM SIZE    
 --------------  -------------- 
   +14%      +5  [ = ]       0    [Unmapped]
  -0.0%      -2  [ = ]       0    .strtab
  -0.0%      -4  -0.0%      -4    .text
  -0.0%     -49  [ = ]       0    .debug_info
  -0.0%     -70  [ = ]       0    .debug_str
  -0.1%    -152  [ = ]       0    .debug_line
  -0.0%    -272  -0.0%      -4    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  [ = ]       0    TOTAL
use_config/stm32f1 — 63.6 KiB → 63.6 KiB (+0.00% ⬆️)

cargo size (PR):

   text	   data	    bss	    dec	    hex	filename
  57588	     28	   7488	  65104	   fe50	rmk-stm32f1

cargo size (main):

   text	   data	    bss	    dec	    hex	filename
  57584	     28	   7488	  65100	   fe4c	rmk-stm32f1

Bloaty diff (PR vs main):

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.0%      +4  +0.0%      +4    .text
  -3.0%      -2  [ = ]       0    [Unmapped]
  -0.0%      -6  [ = ]       0    .debug_line
  -0.0%      -9  [ = ]       0    .strtab
  -0.0%     -63  [ = ]       0    .debug_str
  -0.0%     -76  +0.0%      +4    TOTAL
use_config/stm32h7 — 101.9 KiB → 101.9 KiB (+0.00% ⬇️)

cargo size (PR):

   text	   data	    bss	    dec	    hex	filename
  94304	    264	   9736	 104304	  19770	rmk-stm32h7

cargo size (main):

   text	   data	    bss	    dec	    hex	filename
  94308	    264	   9736	 104308	  19774	rmk-stm32h7

Bloaty diff (PR vs main):

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.1%    +142  [ = ]       0    .debug_line
   +20%      +7  [ = ]       0    [Unmapped]
  -0.0%      -4  -0.0%      -4    .text
  -0.0%     -10  [ = ]       0    .strtab
  -0.0%     -71  [ = ]       0    .debug_str
  +0.0%     +64  -0.0%      -4    TOTAL
use_rust/nrf52832_ble — 387.0 KiB → 387.0 KiB (+0.00% ⬆️)

cargo size (PR):

   text	   data	    bss	    dec	    hex	filename
 352588	   8620	  35112	 396320	  60c20	rmk-nrf52832

cargo size (main):

   text	   data	    bss	    dec	    hex	filename
 352584	   8620	  35112	 396316	  60c1c	rmk-nrf52832

Bloaty diff (PR vs main):

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.0%      +4  +0.0%      +4    .text
  -8.3%      -5  [ = ]       0    [Unmapped]
  -0.0%     -10  [ = ]       0    .debug_loc
  -0.0%     -97  [ = ]       0    .debug_line
  -0.0%    -135  [ = ]       0    .debug_str
  -0.0%    -309  [ = ]       0    .debug_info
  -0.0%    -552  +0.0%      +4    TOTAL
use_rust/nrf52840_ble — 441.9 KiB → 441.9 KiB (+0.00% ⬇️)

cargo size (PR):

   text	   data	    bss	    dec	    hex	filename
 396696	   8628	  47224	 452548	  6e7c4	rmk-nrf52840

cargo size (main):

   text	   data	    bss	    dec	    hex	filename
 396700	   8628	  47224	 452552	  6e7c8	rmk-nrf52840

Bloaty diff (PR vs main):

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.0%     +10  [ = ]       0    .debug_loc
  +6.0%      +4  [ = ]       0    [Unmapped]
  -0.0%      -4  -0.0%      -4    .text
  -0.1%    -190  [ = ]       0    .debug_line
  -0.0%    -180  -0.0%      -4    TOTAL
use_rust/nrf52840_ble_split (central) — 508.0 KiB → 508.0 KiB (+0.00% ⬆️)

cargo size (PR):

   text	   data	    bss	    dec	    hex	filename
 457568	   8684	  53976	 520228	  7f024	central

cargo size (main):

   text	   data	    bss	    dec	    hex	filename
 457564	   8684	  53976	 520224	  7f020	central

Bloaty diff (PR vs main):

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.0%     +85  [ = ]       0    .debug_str
   +60%     +26  [ = ]       0    [Unmapped]
  +0.0%     +23  [ = ]       0    .strtab
  +0.0%      +4  +0.0%      +4    .text
  -0.0%     -10  [ = ]       0    .debug_loc
  -0.5%     -39  [ = ]       0    .debug_abbrev
  -0.0%    -104  [ = ]       0    .debug_line
  -0.0%    -153  [ = ]       0    .debug_info
  -0.0%    -168  +0.0%      +4    TOTAL
use_rust/nrf52840_ble_split (peripheral) — 318.4 KiB → 318.4 KiB (+0.00% ⬇️)

cargo size (PR):

   text	   data	    bss	    dec	    hex	filename
 290264	   8500	  27232	 325996	  4f96c	peripheral

cargo size (main):

   text	   data	    bss	    dec	    hex	filename
 290268	   8500	  27232	 326000	  4f970	peripheral

Bloaty diff (PR vs main):

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.0%    +234  [ = ]       0    .debug_info
  +0.0%    +123  [ = ]       0    .debug_str
  +0.0%     +97  [ = ]       0    .debug_line
  +6.0%      +4  [ = ]       0    [Unmapped]
  -0.0%      -4  -0.0%      -4    .text
  -0.0%     -10  [ = ]       0    .debug_loc
  -0.0%     -12  [ = ]       0    .strtab
  +0.0%    +432  -0.0%      -4    TOTAL
use_rust/pi_pico_w_ble — 672.8 KiB → 672.7 KiB (+0.00% ⬇️)

cargo size (PR):

   text	   data	    bss	    dec	    hex	filename
 634392	      0	  54496	 688888	  a82f8	rmk-pi-pico-w

cargo size (main):

   text	   data	    bss	    dec	    hex	filename
 634400	      0	  54496	 688896	  a8300	rmk-pi-pico-w

Bloaty diff (PR vs main):

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.0%    +335  [ = ]       0    .debug_info
  +0.0%    +121  [ = ]       0    .debug_line
  +0.4%     +39  [ = ]       0    .debug_abbrev
   +22%     +10  [ = ]       0    [Unmapped]
  +0.0%      +3  [ = ]       0    .strtab
  -0.0%      -8  -0.0%      -8    .text
  -0.0%    -108  [ = ]       0    .debug_str
  +0.0%    +392  -0.0%      -8    TOTAL
use_rust/rp2040 — 150.2 KiB → 150.2 KiB (+0.00% ⬇️)

cargo size (PR):

   text	   data	    bss	    dec	    hex	filename
 138196	      0	  15564	 153760	  258a0	rmk-rp2040

cargo size (main):

   text	   data	    bss	    dec	    hex	filename
 138200	      0	  15564	 153764	  258a4	rmk-rp2040

Bloaty diff (PR vs main):

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.1% +1.67Ki  [ = ]       0    .debug_str
  +0.2%    +239  [ = ]       0    .strtab
  +0.1%    +124  [ = ]       0    .debug_line
  +0.0%     +37  [ = ]       0    .debug_info
   +11%      +6  [ = ]       0    [Unmapped]
  -0.0%      -4  -0.0%      -4    .text
  +0.1% +2.06Ki  -0.0%      -4    TOTAL
use_rust/rp2040_split (central) — 162.7 KiB → 162.7 KiB (+0.00% ⬇️)

cargo size (PR):

   text	   data	    bss	    dec	    hex	filename
 150300	      0	  16340	 166640	  28af0	central

cargo size (main):

   text	   data	    bss	    dec	    hex	filename
 150304	      0	  16340	 166644	  28af4	central

Bloaty diff (PR vs main):

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.0%     +35  [ = ]       0    .debug_str
  +0.0%     +10  [ = ]       0    .debug_loc
   +16%      +8  [ = ]       0    [Unmapped]
  +0.0%      +3  [ = ]       0    .strtab
  -0.0%      -4  -0.0%      -4    .text
  -0.0%     -12  [ = ]       0    .debug_info
  -0.0%     -28  [ = ]       0    .debug_line
  +0.0%     +12  -0.0%      -4    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    TOTAL
use_rust/stm32f1 — 63.5 KiB → 63.5 KiB (+0.00%)

cargo size (PR):

   text	   data	    bss	    dec	    hex	filename
  57536	     28	   7504	  65068	   fe2c	rmk-stm32f1

cargo size (main):

   text	   data	    bss	    dec	    hex	filename
  57536	     28	   7504	  65068	   fe2c	rmk-stm32f1

Bloaty diff (PR vs main):

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.1% +1.09Ki  [ = ]       0    .debug_str
  +0.4%    +170  [ = ]       0    .strtab
   +10%      +5  [ = ]       0    [Unmapped]
  +0.1% +1.27Ki  [ = ]       0    TOTAL
use_rust/stm32h7 — 121.8 KiB → 121.8 KiB (+0.00% ⬇️)

cargo size (PR):

   text	   data	    bss	    dec	    hex	filename
 108516	    320	  15852	 124688	  1e710	rmk-stm32h7

cargo size (main):

   text	   data	    bss	    dec	    hex	filename
 108520	    320	  15852	 124692	  1e714	rmk-stm32h7

Bloaty diff (PR vs main):

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.2%    +283  [ = ]       0    .debug_line
  +0.0%     +46  [ = ]       0    .debug_info
   +21%      +8  [ = ]       0    [Unmapped]
  -0.0%      -4  -0.0%      -4    .text
  -0.0%     -10  [ = ]       0    .debug_loc
  -0.2%    -191  [ = ]       0    .strtab
  -0.1% -2.07Ki  [ = ]       0    .debug_str
  -0.0% -1.94Ki  -0.0%      -4    TOTAL

@Schievel1
Schievel1 marked this pull request as ready for review July 30, 2026 06:43
@tompre

tompre commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Hi, thanks for all your work on the bootloader/dfu features!

Do we really need to maintain the code for RMK? Are there any RMK specific changes?
Otherwise I would suggest to pull the codeberg repo directly if a new build is required?

@HaoboGu

HaoboGu commented Jul 30, 2026

Copy link
Copy Markdown
Owner

My 2c:

  1. The bootloader is not rmk-specific
  2. RMK will be built with the bootloader(as the second stage bootloader) by default in the future, so the OTA/DFU feature is generally available
  3. RMK should provide library to make it easy to create rmk-specific CLI/GUI flashing tool: it sends the jump to bootloader command, connects to the bootloader via USB/BLE and flashes the firmware using DFU protocol and reboot the keyboard

For the question of where to host the bootloader: if the bootloader is a generic bootloader and requires no core code change in RMK, maintaining it in codeberg/anywhere else is fine. But if the bootloader requires core code changes in RMK, it's better to maintain it in RMK(or rmk organization?). Otherwise, updating either side might break the other.

@Schievel1

Copy link
Copy Markdown
Contributor Author

RMK(or rmk organization?)

I would prefer organization honestly.

But if the bootloader requires core code changes in RMK

It does, you need the flash manager and the flash partition offsets/ sizes for the bootloader and RMK must match.
If you don't specifically set them, their default in RMK fits what bootymcbootface does.
Updating one side would break the other.

@HaoboGu

HaoboGu commented Jul 30, 2026

Copy link
Copy Markdown
Owner

It does, you need the flash manager and the flash partition offsets/ sizes for the bootloader and RMK must match.

The dependency relationship can be somehow reverted, for example, bootloader defines the spaces(fixed addresses, or special partition names in linker script), then RMK follows in user application. In this case, no RMK core code is touched.

@HaoboGu

HaoboGu commented Jul 30, 2026

Copy link
Copy Markdown
Owner

Anyway, I've created https://github.com/rmk-rs, I will transfer the repo soon

@Schievel1

Copy link
Copy Markdown
Contributor Author

bootloader defines the spaces(fixed addresses

I am not following. Isn't this how it is now? The bootloader defines an 'algorithm' that tells us the addresses/ sizes. RMK follows along and creates it's ACTIVE, DFU and STATE partition accordingly. The 'contract' that could break is the algorithm how to calculate the sizes.
You mean you want to couple this more tightly, like the bootloader tells RMK the addresses and RMK reacts automatically? Doesn't this just shift the contract from the algorithm to the way the bootloader tells RMK?

@HaoboGu

HaoboGu commented Jul 30, 2026

Copy link
Copy Markdown
Owner

I am not following. Isn't this how it is now? The bootloader defines an 'algorithm' that tells us the addresses/ sizes. RMK follows along and creates it's ACTIVE, DFU and STATE partition accordingly. The 'contract' that could break is the algorithm how to calculate the sizes.

What I mean is that the bootloader does the full update process, and defines addresses in the linker script -- then the bootloader is firmware agnostic and RMK knows nothing except the flash partition defined in bootloader's linker script.

@HaoboGu

HaoboGu commented Jul 31, 2026

Copy link
Copy Markdown
Owner

To confirm: both bootymcbootface and RMK application support USB-DFU, so that if RMK firmware breaks itself(for example, panic after connecting to BLE/USB), bootymcbootface can always do the reflash, am I right? Is there a common way to stop in bootymcbootface even the RMK application has been marked booted?

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