aboutsummaryrefslogtreecommitdiff
path: root/board
diff options
context:
space:
mode:
authorIan McIntyre <me@mciantyre.dev>2026-10-26 17:10:19 -0400
committerIan McIntyre <me@mciantyre.dev>2026-10-27 11:35:22 -0400
commitefe328a7bd17df1962a1db2a517c79f1e76a7b05 (patch)
treec9ca989bd272225b7bb2f01440c2b465d839651d /board
parent428ea28a9102d966eda5b9c39644ff66c5f59c59 (diff)
Change how board supports RAM-only programs
Just a refactor inside board. Activate the "ram" feature to target a RAM-only for your given bord. I'm adding the 1170EVK RAM support.
Diffstat (limited to 'board')
-rw-r--r--board/Cargo.toml11
-rw-r--r--board/build.rs41
-rw-r--r--board/src/imxrt1010evk.rs2
-rw-r--r--board/src/imxrt1170evk_cm7.rs2
-rw-r--r--board/src/lib.rs2
5 files changed, 34 insertions, 24 deletions
diff --git a/board/Cargo.toml b/board/Cargo.toml
index 2bbc956..5ac029c 100644
--- a/board/Cargo.toml
+++ b/board/Cargo.toml
@@ -32,6 +32,7 @@ panic-rtt-target = { version = "0.1", optional = true, features = ["cortex-m"] }
nonboot = []
secondary = []
rtic = []
+ram = []
# Begin board features.
teensy4 = [
"imxrt-ral/imxrt1062",
@@ -45,10 +46,8 @@ imxrt1010evk = [
"dep:panic-rtt-target",
]
imxrt1010evk-ram = [
- "imxrt-ral/imxrt1011",
- # No FCB required.
- "dep:rtt-target",
- "dep:panic-rtt-target",
+ "ram",
+ "imxrt1010evk",
]
imxrt1170evk-cm7 = [
"imxrt-ral/imxrt1176_cm7",
@@ -56,6 +55,10 @@ imxrt1170evk-cm7 = [
"dep:rtt-target",
"dep:panic-rtt-target",
]
+imxrt1170evk-cm7-ram = [
+ "ram",
+ "imxrt1170evk-cm7",
+]
# Dummy boards for testing DCD linking.
# Don't try running these on hardware; they might not work.
diff --git a/board/build.rs b/board/build.rs
index 0e79920..1f4e207 100644
--- a/board/build.rs
+++ b/board/build.rs
@@ -9,11 +9,17 @@ fn extract_features() -> HashSet<String> {
/// 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") | cfg!(feature = "secondary") {
+fn create_runtime(
+ family: imxrt_rt::Family,
+ flash_size: usize,
+ features: &HashSet<String>,
+) -> imxrt_rt::RuntimeBuilder {
+ if features.contains("nonboot") | features.contains("secondary") {
let mut bldr = imxrt_rt::RuntimeBuilder::in_flash(family, flash_size, 256 * 1024);
- bldr.boot_header(cfg!(feature = "secondary"));
+ bldr.boot_header(features.contains("secondary"));
bldr
+ } else if features.contains("ram") {
+ imxrt_rt::RuntimeBuilder::from_ram(family)
} else {
imxrt_rt::RuntimeBuilder::from_flexspi(family, flash_size)
}
@@ -25,7 +31,7 @@ fn create_runtime(family: imxrt_rt::Family, flash_size: usize) -> imxrt_rt::Runt
/// values and observe how they might affect the tests.
fn main() {
let features = extract_features();
- for feature in features {
+ for feature in features.iter() {
match feature.as_str() {
"teensy4" => {
imxrt_rt::RuntimeBuilder::from_flexspi(imxrt_rt::Family::Imxrt1060, 1984 * 1024)
@@ -47,6 +53,12 @@ fn main() {
.build()
.unwrap()
}
+ "imxrt1010evk" if features.contains("ram") => {
+ imxrt_rt::RuntimeBuilder::from_ram(imxrt_rt::Family::Imxrt1010)
+ .heap_size(1024)
+ .build()
+ .unwrap();
+ }
"imxrt1010evk" => imxrt_rt::RuntimeBuilder::from_flexspi(
imxrt_rt::Family::Imxrt1010,
16 * 1024 * 1024,
@@ -57,20 +69,15 @@ fn main() {
.heap_size_env_override("BOARD_HEAP")
.build()
.unwrap(),
- "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")
- .flexram_ecc(imxrt_rt::FlexRamEcc::Enable)
- .mecc64(imxrt_rt::Mecc64::Enable)
- .build()
- .unwrap(),
- "imxrt1010evk_ram" => {
- imxrt_rt::RuntimeBuilder::from_ram(imxrt_rt::Family::Imxrt1010)
- .heap_size(1024)
+ "imxrt1170evk_cm7" => {
+ create_runtime(imxrt_rt::Family::Imxrt1170, 256 * 1024, &features)
+ .rodata(imxrt_rt::Memory::Dtcm)
+ .stack_size_env_override("BOARD_STACK")
+ .heap_size_env_override("BOARD_HEAP")
+ .flexram_ecc(imxrt_rt::FlexRamEcc::Enable)
+ .mecc64(imxrt_rt::Mecc64::Enable)
.build()
- .unwrap();
- println!("cargo:rustc-cfg=from_ram");
+ .unwrap()
}
_ => continue,
}
diff --git a/board/src/imxrt1010evk.rs b/board/src/imxrt1010evk.rs
index 9bcf120..e8000af 100644
--- a/board/src/imxrt1010evk.rs
+++ b/board/src/imxrt1010evk.rs
@@ -2,7 +2,7 @@
use crate::ral;
-#[cfg(all(target_arch = "arm", not(feature = "imxrt1010evk-ram")))]
+#[cfg(all(target_arch = "arm", not(feature = "ram")))]
use imxrt1010evk_fcb as _;
#[cfg(target_arch = "arm")]
use panic_rtt_target as _;
diff --git a/board/src/imxrt1170evk_cm7.rs b/board/src/imxrt1170evk_cm7.rs
index 7d966eb..f1a72d7 100644
--- a/board/src/imxrt1170evk_cm7.rs
+++ b/board/src/imxrt1170evk_cm7.rs
@@ -2,7 +2,7 @@
use crate::ral;
-#[cfg(target_arch = "arm")]
+#[cfg(all(target_arch = "arm", not(feature = "ram")))]
use imxrt1170evk_fcb as _;
#[cfg(target_arch = "arm")]
use panic_rtt_target as _;
diff --git a/board/src/lib.rs b/board/src/lib.rs
index f4912be..ebc76ad 100644
--- a/board/src/lib.rs
+++ b/board/src/lib.rs
@@ -10,7 +10,7 @@ cfg_if::cfg_if! {
mod teensy4;
pub use teensy4::*;
- } else if #[cfg(any(feature = "imxrt1010evk", feature = "imxrt1010evk-ram"))] {
+ } else if #[cfg(feature = "imxrt1010evk")] {
mod shared { pub mod imxrt10xx; }
use shared::imxrt10xx::prepare_pit;