aboutsummaryrefslogtreecommitdiff
path: root/homogeneous/examples/x-init.rs
diff options
context:
space:
mode:
Diffstat (limited to 'homogeneous/examples/x-init.rs')
-rw-r--r--homogeneous/examples/x-init.rs26
1 files changed, 26 insertions, 0 deletions
diff --git a/homogeneous/examples/x-init.rs b/homogeneous/examples/x-init.rs
new file mode 100644
index 00000000..5089e385
--- /dev/null
+++ b/homogeneous/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 = homogeneous)]
+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 }
+ }
+};