From 332fe645a8ef2f9171bcab822fcd8a8cc71339fd Mon Sep 17 00:00:00 2001 From: 9names <60134748+9names@users.noreply.github.com> Date: Thu, 20 Jan 2022 20:03:33 +1100 Subject: [PATCH 1/2] Add boot2 feature to kb2040 BSP --- boards/adafruit-kb2040/Cargo.toml | 5 +++-- boards/adafruit-kb2040/src/lib.rs | 8 ++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/boards/adafruit-kb2040/Cargo.toml b/boards/adafruit-kb2040/Cargo.toml index c37e07c..d2a9176 100644 --- a/boards/adafruit-kb2040/Cargo.toml +++ b/boards/adafruit-kb2040/Cargo.toml @@ -17,8 +17,9 @@ cortex-m-rt = { version = "0.7.0", optional = true } embedded-hal = { version = "0.2.4", features = ["unproven"] } [features] -default = ["rt"] -rt = ["cortex-m-rt", "rp2040-hal/rt"] +default = ["rt", "boot2"] +boot2 = ["rp2040-boot2"] +rt = ["cortex-m-rt","rp2040-hal/rt"] [dev-dependencies] panic-halt = "0.2.0" diff --git a/boards/adafruit-kb2040/src/lib.rs b/boards/adafruit-kb2040/src/lib.rs index e62289b..54cda6d 100644 --- a/boards/adafruit-kb2040/src/lib.rs +++ b/boards/adafruit-kb2040/src/lib.rs @@ -6,6 +6,14 @@ extern crate cortex_m_rt; #[cfg(feature = "rt")] pub use cortex_m_rt::entry; +/// The linker will place this boot block at the start of our program image. We +/// need this to help the ROM bootloader get our code up and running. +#[cfg(feature = "boot2")] +#[link_section = ".boot2"] +#[no_mangle] +#[used] +pub static BOOT2_FIRMWARE: [u8; 256] = rp2040_boot2::BOOT_LOADER_W25Q080; + pub use hal::pac; hal::bsp_pins!( From 8b7b0b168bbfbf2d23985dff4c86c6efe62a234f Mon Sep 17 00:00:00 2001 From: 9names <60134748+9names@users.noreply.github.com> Date: Thu, 20 Jan 2022 20:14:09 +1100 Subject: [PATCH 2/2] Make boot2 optional --- boards/adafruit-kb2040/Cargo.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/boards/adafruit-kb2040/Cargo.toml b/boards/adafruit-kb2040/Cargo.toml index d2a9176..2cd53a3 100644 --- a/boards/adafruit-kb2040/Cargo.toml +++ b/boards/adafruit-kb2040/Cargo.toml @@ -15,6 +15,7 @@ cortex-m = "0.7.2" rp2040-hal = { path = "../../rp2040-hal", version = "0.4.0" } cortex-m-rt = { version = "0.7.0", optional = true } embedded-hal = { version = "0.2.4", features = ["unproven"] } +rp2040-boot2 = { version = "0.2.0", optional = true } [features] default = ["rt", "boot2"]