aboutsummaryrefslogtreecommitdiff
path: root/embassy-rp/src/lib.rs
diff options
context:
space:
mode:
author9names <[email protected]>2025-02-16 12:34:48 +1100
committer9names <[email protected]>2025-02-16 15:43:01 +1100
commit4cc5ab9474773148dd8976e22f3fb6f5e270cd3a (patch)
tree96058b9a554ea8dee7895875d9a20a4ebad358bc /embassy-rp/src/lib.rs
parent0ce6da9706b9d929691c9292c923117fcbc2f9c6 (diff)
Add rp235x imagedef features (based on rp2040 boot2 features)
rp235x firmwares need an Image Definition if they want to be called from the rp235x bootrom. Currently this Image Definition is manually added to each project/example, but for most users it will always be the default (Secure Exe). This commit adds crate features to allow users to configure this, with the default of including a Secure Exe Image Definition in. Just like the boot2-* features, this includes an opt-out (imagedef-none) to allow the user to not make use of this included Image Definition.
Diffstat (limited to 'embassy-rp/src/lib.rs')
-rw-r--r--embassy-rp/src/lib.rs24
1 files changed, 24 insertions, 0 deletions
diff --git a/embassy-rp/src/lib.rs b/embassy-rp/src/lib.rs
index 80ee47802..de60af890 100644
--- a/embassy-rp/src/lib.rs
+++ b/embassy-rp/src/lib.rs
@@ -456,6 +456,30 @@ select_bootloader! {
456 default => BOOT_LOADER_W25Q080 456 default => BOOT_LOADER_W25Q080
457} 457}
458 458
459#[cfg(all(not(feature = "imagedef-none"), feature = "_rp235x"))]
460macro_rules! select_imagedef {
461 ( $( $feature:literal => $imagedef:ident, )+ default => $default:ident ) => {
462 $(
463 #[cfg(feature = $feature)]
464 #[link_section = ".start_block"]
465 #[used]
466 static IMAGE_DEF: crate::block::ImageDef = crate::block::ImageDef::$imagedef();
467 )*
468
469 #[cfg(not(any( $( feature = $feature),* )))]
470 #[link_section = ".start_block"]
471 #[used]
472 static IMAGE_DEF: crate::block::ImageDef = crate::block::ImageDef::$default();
473 }
474}
475
476#[cfg(all(not(feature = "imagedef-none"), feature = "_rp235x"))]
477select_imagedef! {
478 "imagedef-secure-exe" => secure_exe,
479 "imagedef-nonsecure-exe" => non_secure_exe,
480 default => secure_exe
481}
482
459/// Installs a stack guard for the CORE0 stack in MPU region 0. 483/// Installs a stack guard for the CORE0 stack in MPU region 0.
460/// Will fail if the MPU is already configured. This function requires 484/// Will fail if the MPU is already configured. This function requires
461/// a `_stack_end` symbol to be defined by the linker script, and expects 485/// a `_stack_end` symbol to be defined by the linker script, and expects