aboutsummaryrefslogtreecommitdiff
path: root/board/build.rs
diff options
context:
space:
mode:
authorIan McIntyre <ianpmcintyre@gmail.com>2022-08-02 06:21:12 -0400
committerIan McIntyre <ianpmcintyre@gmail.com>2022-12-01 20:21:05 -0500
commitc7a9b9f3d4b9e71303c7b988d2bd916c2e4df9bc (patch)
tree6d41ea7e433cac328fa165d45d1bc0cd71a1bf8f /board/build.rs
First commit
Diffstat (limited to 'board/build.rs')
-rw-r--r--board/build.rs53
1 files changed, 53 insertions, 0 deletions
diff --git a/board/build.rs b/board/build.rs
new file mode 100644
index 0000000..9ee64e8
--- /dev/null
+++ b/board/build.rs
@@ -0,0 +1,53 @@
+use std::{collections::HashSet, env};
+
+fn extract_features() -> HashSet<String> {
+ env::vars()
+ .map(|(k, _)| k)
+ .flat_map(|feat| feat.strip_prefix("CARGO_FEATURE_").map(str::to_lowercase))
+ .collect()
+}
+
+/// Configures the runtime for a variety of boards.
+///
+/// Note that some automated tests may check these runtimes. Feel free to change
+/// values and observe how they might affect the tests.
+fn main() {
+ let features = extract_features();
+ for feature in features {
+ match feature.as_str() {
+ "teensy4" => {
+ imxrt_rt::RuntimeBuilder::from_flexspi(imxrt_rt::Family::Imxrt1060, 1984 * 1024)
+ .flexram_banks(imxrt_rt::FlexRamBanks {
+ ocram: 0,
+ dtcm: 12,
+ itcm: 4,
+ })
+ .heap_size(1024)
+ .text(imxrt_rt::Memory::Flash)
+ .rodata(imxrt_rt::Memory::Dtcm)
+ .data(imxrt_rt::Memory::Dtcm)
+ .bss(imxrt_rt::Memory::Dtcm)
+ .uninit(imxrt_rt::Memory::Dtcm)
+ .build()
+ .unwrap()
+ }
+ "imxrt1010evk" => imxrt_rt::RuntimeBuilder::from_flexspi(
+ imxrt_rt::Family::Imxrt1010,
+ 16 * 1024 * 1024,
+ )
+ .heap_size(1024)
+ .rodata(imxrt_rt::Memory::Flash)
+ .build()
+ .unwrap(),
+ "imxrt1170evk_cm7" => imxrt_rt::RuntimeBuilder::from_flexspi(
+ imxrt_rt::Family::Imxrt1170,
+ 16 * 1024 * 1024,
+ )
+ .rodata(imxrt_rt::Memory::Dtcm)
+ .build()
+ .unwrap(),
+ _ => continue,
+ }
+ break;
+ }
+}