aboutsummaryrefslogtreecommitdiff
path: root/board
diff options
context:
space:
mode:
authorIan McIntyre <me@mciantyre.dev>2026-11-21 13:39:55 -0500
committerIan McIntyre <me@mciantyre.dev>2026-11-22 10:47:30 -0500
commitea60b60f3ff579cd175abecde49d2d9397420dc0 (patch)
treebce393fb98a32c1ee563ebcfdadeddef8e76cd52 /board
parent1087e9bb7cd31e6fd88532ead08a927168e36de7 (diff)
Prototype secondary core supportHEADmain
Haven't tested the included examples on hardware. It's just here so I can define an inspect_elf test. Out of tree, there's a basic example on an 1170EVK.
Diffstat (limited to 'board')
-rw-r--r--board/Cargo.toml5
-rw-r--r--board/build.rs17
-rw-r--r--board/src/imxrt1170evk_cm4.rs36
-rw-r--r--board/src/lib.rs6
4 files changed, 64 insertions, 0 deletions
diff --git a/board/Cargo.toml b/board/Cargo.toml
index 5ac029c..03ec25f 100644
--- a/board/Cargo.toml
+++ b/board/Cargo.toml
@@ -55,6 +55,11 @@ imxrt1170evk-cm7 = [
"dep:rtt-target",
"dep:panic-rtt-target",
]
+imxrt1170evk-cm4 = [
+ "imxrt-ral/imxrt1176_cm4",
+ "dep:rtt-target",
+ "dep:panic-rtt-target",
+]
imxrt1170evk-cm7-ram = [
"ram",
"imxrt1170evk-cm7",
diff --git a/board/build.rs b/board/build.rs
index 1f4e207..8709852 100644
--- a/board/build.rs
+++ b/board/build.rs
@@ -79,6 +79,23 @@ fn main() {
.build()
.unwrap()
}
+ "imxrt1170evk_cm4" => imxrt_rt::RuntimeBuilder::in_flash(
+ imxrt_rt::Family::Imxrt1170,
+ 256 * 1024,
+ 87 * 1024,
+ )
+ .core(imxrt_rt::Core::Secondary)
+ .text(imxrt_rt::Memory::Itcm)
+ .rodata(imxrt_rt::Memory::Dtcm)
+ .data(imxrt_rt::Memory::Dtcm)
+ .vectors(imxrt_rt::Memory::Dtcm)
+ .bss(imxrt_rt::Memory::Dtcm)
+ .uninit(imxrt_rt::Memory::Dtcm)
+ .stack(imxrt_rt::Memory::Dtcm)
+ .heap(imxrt_rt::Memory::Ocram)
+ .heap_size(2 * 1024)
+ .build()
+ .unwrap(),
_ => continue,
}
break;
diff --git a/board/src/imxrt1170evk_cm4.rs b/board/src/imxrt1170evk_cm4.rs
new file mode 100644
index 0000000..0f6057c
--- /dev/null
+++ b/board/src/imxrt1170evk_cm4.rs
@@ -0,0 +1,36 @@
+//! Support for booting the Cortex M4 on the i.MX RT 1170 EVK.
+
+use crate::ral;
+
+#[cfg(target_arch = "arm")]
+use panic_rtt_target as _;
+
+const LED_OFFSET: u32 = 3;
+
+pub mod rtic_support {
+ pub use crate::ral::NVIC_PRIO_BITS;
+ #[allow(non_snake_case)] // For RTIC trickery...
+ pub mod Interrupt {
+ pub const PIT: crate::ral::Interrupt = crate::ral::Interrupt::PIT1;
+ }
+ pub use Interrupt as interrupt;
+}
+
+pub fn prepare(timer_delay_microseconds: u32) -> Option<crate::Resources> {
+ #[cfg(target_arch = "arm")]
+ rtt_target::rtt_init_print!();
+
+ let iomuxc = unsafe { ral::iomuxc::IOMUXC::instance() };
+ ral::modify_reg!(ral::iomuxc, iomuxc, SW_MUX_CTL_PAD_GPIO_AD_04, MUX_MODE: 5);
+
+ let ccm = unsafe { ral::ccm::CCM::instance() };
+ // Enable LPCG for GPIOs.
+ ral::write_reg!(ral::ccm, ccm, LPCG51_DIRECT, 1);
+
+ let gpio = unsafe { ral::gpio::GPIO3::instance() };
+ let pit = crate::prepare_pit(timer_delay_microseconds)?;
+ Some(crate::Resources {
+ pit,
+ led: crate::Led::new(LED_OFFSET, &gpio),
+ })
+}
diff --git a/board/src/lib.rs b/board/src/lib.rs
index fa2afcd..0f60c66 100644
--- a/board/src/lib.rs
+++ b/board/src/lib.rs
@@ -22,6 +22,12 @@ cfg_if::cfg_if! {
mod imxrt1170evk_cm7;
pub use imxrt1170evk_cm7::*;
+ } else if #[cfg(feature = "imxrt1170evk-cm4")] {
+ mod shared { pub mod imxrt11xx; }
+ use shared::imxrt11xx::prepare_pit;
+
+ mod imxrt1170evk_cm4;
+ pub use imxrt1170evk_cm4::*;
} else {
compile_error!("No board feature selected!");
}