From 115edee3d4dcf860fc0c934a61d7348f0f9fb5a9 Mon Sep 17 00:00:00 2001 From: zackees Date: Tue, 14 Jul 2026 20:14:51 -0700 Subject: [PATCH] fix: use canonical UF2 start magic --- crates/fbuild-deploy/src/rp2040.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/crates/fbuild-deploy/src/rp2040.rs b/crates/fbuild-deploy/src/rp2040.rs index 30f4145e9..c99a36463 100644 --- a/crates/fbuild-deploy/src/rp2040.rs +++ b/crates/fbuild-deploy/src/rp2040.rs @@ -23,7 +23,7 @@ use target::{ resolve_requested_runtime_target, select_cdc_candidate, serial_selector, }; -const UF2_MAGIC_START0: u32 = 0x0A32_4555; +const UF2_MAGIC_START0: u32 = 0x0A32_4655; const UF2_MAGIC_START1: u32 = 0x9E5D_5157; const UF2_MAGIC_END: u32 = 0x0AB1_6F30; const UF2_FLAG_FAMILY_ID_PRESENT: u32 = 0x0000_2000; @@ -758,6 +758,13 @@ mod tests { ); } + #[test] + fn uf2_magic_matches_the_published_byte_sequence() { + assert_eq!(UF2_MAGIC_START0.to_le_bytes(), [0x55, 0x46, 0x32, 0x0A]); + assert_eq!(UF2_MAGIC_START1.to_le_bytes(), [0x57, 0x51, 0x5D, 0x9E]); + assert_eq!(UF2_MAGIC_END.to_le_bytes(), [0x30, 0x6F, 0xB1, 0x0A]); + } + #[test] fn full_image_boot2_uses_xip_address() { // Prefix emitted by the RP2040 second-stage bootloader in FastLED's