rp: use rp2040-boot2 to provide the boot2 blob

we're currently shipping an old boot2 that runs the flash at half speed.
use the more recent version instead, and allow user to choose between
the different supported boot2 versions for different flash chips if they
need that.
This commit is contained in:
pennae 2023-05-09 18:36:17 +02:00
parent 79c60f4a7d
commit 0e3cd87a32
3 changed files with 36 additions and 3 deletions

View File

@ -30,6 +30,15 @@ rom-func-cache = []
intrinsics = [] intrinsics = []
rom-v2-intrinsics = [] rom-v2-intrinsics = []
# boot2 flash chip support. if none of these is enabled we'll default to w25q080 (used on the pico)
boot2-at25sf128a = []
boot2-gd25q64cs = []
boot2-generic-03h = []
boot2-is25lp080 = []
boot2-ram-memcpy = []
boot2-w25q080 = []
boot2-w25x10cl = []
# Enable nightly-only features # Enable nightly-only features
nightly = ["embassy-executor/nightly", "embedded-hal-1", "embedded-hal-async", "embassy-embedded-hal/nightly", "dep:embassy-usb-driver", "dep:embedded-io"] nightly = ["embassy-executor/nightly", "embedded-hal-1", "embedded-hal-async", "embassy-embedded-hal/nightly", "dep:embassy-usb-driver", "dep:embedded-io"]
@ -71,3 +80,4 @@ embedded-hal-nb = { version = "=1.0.0-alpha.2", optional = true}
paste = "1.0" paste = "1.0"
pio-proc = {version= "0.2" } pio-proc = {version= "0.2" }
pio = {version= "0.2.1" } pio = {version= "0.2.1" }
rp2040-boot2 = "0.3"

Binary file not shown.

View File

@ -131,9 +131,32 @@ embassy_hal_common::peripherals! {
WATCHDOG, WATCHDOG,
} }
macro_rules! select_bootloader {
( $( $feature:literal => $loader:ident, )+ default => $default:ident ) => {
$(
#[cfg(feature = $feature)]
#[link_section = ".boot2"] #[link_section = ".boot2"]
#[used] #[used]
static BOOT2: [u8; 256] = *include_bytes!("boot2.bin"); static BOOT2: [u8; 256] = rp2040_boot2::$loader;
)*
#[cfg(not(any( $( feature = $feature),* )))]
#[link_section = ".boot2"]
#[used]
static BOOT2: [u8; 256] = rp2040_boot2::$default;
}
}
select_bootloader! {
"boot2-at25sf128a" => BOOT_LOADER_AT25SF128A,
"boot2-gd25q64cs" => BOOT_LOADER_GD25Q64CS,
"boot2-generic-03h" => BOOT_LOADER_GENERIC_03H,
"boot2-is25lp080" => BOOT_LOADER_IS25LP080,
"boot2-ram-memcpy" => BOOT_LOADER_RAM_MEMCPY,
"boot2-w25q080" => BOOT_LOADER_W25Q080,
"boot2-w25x10cl" => BOOT_LOADER_W25X10CL,
default => BOOT_LOADER_W25Q080
}
pub mod config { pub mod config {
#[non_exhaustive] #[non_exhaustive]