aboutsummaryrefslogtreecommitdiff
path: root/heterogeneous/examples/x-init.rs
diff options
context:
space:
mode:
authorGravatar Jorge Aparicio <jorge@japaric.io> 2019-06-18 10:31:31 +0200
committerGravatar Jorge Aparicio <jorge@japaric.io> 2019-06-18 10:31:31 +0200
commit9897728709528a02545523bea72576abce89dc4c (patch)
tree49619bfb8e3e09cccbc9c2bd1854abfe1618c8fd /heterogeneous/examples/x-init.rs
parent81275bfa4f41e2066770087f3a33cad4227eab41 (diff)
downloadrtic-9897728709528a02545523bea72576abce89dc4c.tar.gz
rtic-9897728709528a02545523bea72576abce89dc4c.tar.zst
rtic-9897728709528a02545523bea72576abce89dc4c.zip
add homogeneous multi-core support
Diffstat (limited to 'heterogeneous/examples/x-init.rs')
-rw-r--r--heterogeneous/examples/x-init.rs26
1 files changed, 26 insertions, 0 deletions
diff --git a/heterogeneous/examples/x-init.rs b/heterogeneous/examples/x-init.rs
new file mode 100644
index 00000000..53e73805
--- /dev/null
+++ b/heterogeneous/examples/x-init.rs
@@ -0,0 +1,26 @@
+//! [compile-pass] Split initialization of late resources
+
+#![deny(unsafe_code)]
+#![deny(warnings)]
+#![no_main]
+#![no_std]
+
+use panic_halt as _;
+
+#[rtfm::app(cores = 2, device = heterogeneous)]
+const APP: () = {
+ extern "C" {
+ static mut X: u32;
+ static mut Y: u32;
+ }
+
+ #[init(core = 0, late = [X])]
+ fn a(_: a::Context) -> a::LateResources {
+ a::LateResources { X: 0 }
+ }
+
+ #[init(core = 1)]
+ fn b(_: b::Context) -> b::LateResources {
+ b::LateResources { Y: 0 }
+ }
+};