diff options
| -rw-r--r-- | embassy-rp/Cargo.toml | 10 | ||||
| -rw-r--r-- | embassy-rp/src/boot2.bin | bin | 256 -> 0 bytes | |||
| -rw-r--r-- | embassy-rp/src/lib.rs | 29 |
3 files changed, 36 insertions, 3 deletions
diff --git a/embassy-rp/Cargo.toml b/embassy-rp/Cargo.toml index b2b7fb083..836dca28e 100644 --- a/embassy-rp/Cargo.toml +++ b/embassy-rp/Cargo.toml | |||
| @@ -30,6 +30,15 @@ rom-func-cache = [] | |||
| 30 | intrinsics = [] | 30 | intrinsics = [] |
| 31 | rom-v2-intrinsics = [] | 31 | rom-v2-intrinsics = [] |
| 32 | 32 | ||
| 33 | # boot2 flash chip support. if none of these is enabled we'll default to w25q080 (used on the pico) | ||
| 34 | boot2-at25sf128a = [] | ||
| 35 | boot2-gd25q64cs = [] | ||
| 36 | boot2-generic-03h = [] | ||
| 37 | boot2-is25lp080 = [] | ||
| 38 | boot2-ram-memcpy = [] | ||
| 39 | boot2-w25q080 = [] | ||
| 40 | boot2-w25x10cl = [] | ||
| 41 | |||
| 33 | # Enable nightly-only features | 42 | # Enable nightly-only features |
| 34 | nightly = ["embassy-executor/nightly", "embedded-hal-1", "embedded-hal-async", "embassy-embedded-hal/nightly", "dep:embassy-usb-driver", "dep:embedded-io"] | 43 | nightly = ["embassy-executor/nightly", "embedded-hal-1", "embedded-hal-async", "embassy-embedded-hal/nightly", "dep:embassy-usb-driver", "dep:embedded-io"] |
| 35 | 44 | ||
| @@ -71,3 +80,4 @@ embedded-hal-nb = { version = "=1.0.0-alpha.2", optional = true} | |||
| 71 | paste = "1.0" | 80 | paste = "1.0" |
| 72 | pio-proc = {version= "0.2" } | 81 | pio-proc = {version= "0.2" } |
| 73 | pio = {version= "0.2.1" } | 82 | pio = {version= "0.2.1" } |
| 83 | rp2040-boot2 = "0.3" | ||
diff --git a/embassy-rp/src/boot2.bin b/embassy-rp/src/boot2.bin deleted file mode 100644 index fdc1fc756..000000000 --- a/embassy-rp/src/boot2.bin +++ /dev/null | |||
| Binary files differ | |||
diff --git a/embassy-rp/src/lib.rs b/embassy-rp/src/lib.rs index cba7559df..99f62738d 100644 --- a/embassy-rp/src/lib.rs +++ b/embassy-rp/src/lib.rs | |||
| @@ -131,9 +131,32 @@ embassy_hal_common::peripherals! { | |||
| 131 | WATCHDOG, | 131 | WATCHDOG, |
| 132 | } | 132 | } |
| 133 | 133 | ||
| 134 | #[link_section = ".boot2"] | 134 | macro_rules! select_bootloader { |
| 135 | #[used] | 135 | ( $( $feature:literal => $loader:ident, )+ default => $default:ident ) => { |
| 136 | static BOOT2: [u8; 256] = *include_bytes!("boot2.bin"); | 136 | $( |
| 137 | #[cfg(feature = $feature)] | ||
| 138 | #[link_section = ".boot2"] | ||
| 139 | #[used] | ||
| 140 | static BOOT2: [u8; 256] = rp2040_boot2::$loader; | ||
| 141 | )* | ||
| 142 | |||
| 143 | #[cfg(not(any( $( feature = $feature),* )))] | ||
| 144 | #[link_section = ".boot2"] | ||
| 145 | #[used] | ||
| 146 | static BOOT2: [u8; 256] = rp2040_boot2::$default; | ||
| 147 | } | ||
| 148 | } | ||
| 149 | |||
| 150 | select_bootloader! { | ||
| 151 | "boot2-at25sf128a" => BOOT_LOADER_AT25SF128A, | ||
| 152 | "boot2-gd25q64cs" => BOOT_LOADER_GD25Q64CS, | ||
| 153 | "boot2-generic-03h" => BOOT_LOADER_GENERIC_03H, | ||
| 154 | "boot2-is25lp080" => BOOT_LOADER_IS25LP080, | ||
| 155 | "boot2-ram-memcpy" => BOOT_LOADER_RAM_MEMCPY, | ||
| 156 | "boot2-w25q080" => BOOT_LOADER_W25Q080, | ||
| 157 | "boot2-w25x10cl" => BOOT_LOADER_W25X10CL, | ||
| 158 | default => BOOT_LOADER_W25Q080 | ||
| 159 | } | ||
| 137 | 160 | ||
| 138 | pub mod config { | 161 | pub mod config { |
| 139 | #[non_exhaustive] | 162 | #[non_exhaustive] |
