From 66f3fb862c88ada3fd35e00186376b90fe37154a Mon Sep 17 00:00:00 2001 From: Ian McIntyre Date: Sun, 15 Feb 2026 07:38:37 -0500 Subject: Add builder config for boot_header inclusion To form a secondary image, use in_flash to position it in flash, then override the default setting that disables the boot header. With proper configuration, NXP's boot ROM can load a backup image. This commit reconfigures the 1170EVK board for the experiment. --- board/Cargo.toml | 1 + board/build.rs | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) (limited to 'board') diff --git a/board/Cargo.toml b/board/Cargo.toml index bfebd0d..f9ef9aa 100644 --- a/board/Cargo.toml +++ b/board/Cargo.toml @@ -30,6 +30,7 @@ panic-rtt-target = { version = "0.1", optional = true, features = ["cortex-m"] } [features] nonboot = [] +secondary = [] rtic = [] # Begin board features. teensy4 = [ diff --git a/board/build.rs b/board/build.rs index e44a11d..d86d287 100644 --- a/board/build.rs +++ b/board/build.rs @@ -10,8 +10,10 @@ fn extract_features() -> HashSet { /// Creates a runtime for a particular family, adjusting whether the image is expected to be boot /// based on provided features. fn create_runtime(family: imxrt_rt::Family, flash_size: usize) -> imxrt_rt::RuntimeBuilder { - if cfg!(feature = "nonboot") { - imxrt_rt::RuntimeBuilder::in_flash(family, flash_size, 16 * 1024) + if cfg!(feature = "nonboot") | cfg!(feature = "secondary") { + let mut bldr = imxrt_rt::RuntimeBuilder::in_flash(family, flash_size, 256 * 1024); + bldr.boot_header(cfg!(feature = "secondary")); + bldr } else { imxrt_rt::RuntimeBuilder::from_flexspi(family, flash_size) } @@ -54,7 +56,7 @@ fn main() { .heap_size_env_override("BOARD_HEAP") .build() .unwrap(), - "imxrt1170evk_cm7" => create_runtime(imxrt_rt::Family::Imxrt1170, 8 * 1024 * 1024) + "imxrt1170evk_cm7" => create_runtime(imxrt_rt::Family::Imxrt1170, 256 * 1024) .rodata(imxrt_rt::Memory::Dtcm) .stack_size_env_override("BOARD_STACK") .heap_size_env_override("BOARD_HEAP") -- cgit v1.2.3