aboutsummaryrefslogtreecommitdiff
path: root/board/build.rs
diff options
context:
space:
mode:
authorSherif A Abdou <sherif_abdou@outlook.com>2025-02-03 10:22:32 -0500
committerIan McIntyre <me@mciantyre.dev>2025-03-21 20:04:24 -0400
commitb319d62052d6b553b135837ff8c35ee0c8d475bf (patch)
tree5f8d7a6ce24bd868d58dd2396caed1f3532c3316 /board/build.rs
parent4ecbed698241e637a13048a199d29c142445c360 (diff)
Added in_flash RuntimeBuilder constructor
Applications linked through this builder can be placed in a flash reservation. You'll need some other software to launch these programs, since they lack the boot header required by the NXP boot ROM.
Diffstat (limited to 'board/build.rs')
-rw-r--r--board/build.rs25
1 files changed, 16 insertions, 9 deletions
diff --git a/board/build.rs b/board/build.rs
index 8474e85..4531667 100644
--- a/board/build.rs
+++ b/board/build.rs
@@ -7,6 +7,16 @@ fn extract_features() -> HashSet<String> {
.collect()
}
+/// 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)
+ } else {
+ imxrt_rt::RuntimeBuilder::from_flexspi(family, flash_size)
+ }
+}
+
/// Configures the runtime for a variety of boards.
///
/// Note that some automated tests may check these runtimes. Feel free to change
@@ -44,15 +54,12 @@ fn main() {
.heap_size_env_override("BOARD_HEAP")
.build()
.unwrap(),
- "imxrt1170evk_cm7" => imxrt_rt::RuntimeBuilder::from_flexspi(
- imxrt_rt::Family::Imxrt1170,
- 16 * 1024 * 1024,
- )
- .rodata(imxrt_rt::Memory::Dtcm)
- .stack_size_env_override("BOARD_STACK")
- .heap_size_env_override("BOARD_HEAP")
- .build()
- .unwrap(),
+ "imxrt1170evk_cm7" => create_runtime(imxrt_rt::Family::Imxrt1170, 8 * 1024 * 1024)
+ .rodata(imxrt_rt::Memory::Dtcm)
+ .stack_size_env_override("BOARD_STACK")
+ .heap_size_env_override("BOARD_HEAP")
+ .build()
+ .unwrap(),
_ => continue,
}
break;