aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-11-15 18:13:38 +0000
committerGitHub <noreply@github.com>2020-11-15 18:13:38 +0000
commit53b2454799830cd424bf8b293e2106249bf0b4d5 (patch)
tree3c05a059d2b174b8adb6b1b6e76493178b607e45 /examples
parent9527c921923f6b8e19767b1bf52be758817d7035 (diff)
parentad7b5a90c49da6078025d5ac46d1f48656836bfd (diff)
Merge #416
416: Move entry-point main into a separate module r=korken89 a=AfoHT Prevents conflict with user provided tasks named main Curious what the full test suite will make of this Co-authored-by: Henrik Tjäder <henrik@tjaders.com>
Diffstat (limited to 'examples')
-rw-r--r--examples/task_named_main.rs26
1 files changed, 26 insertions, 0 deletions
diff --git a/examples/task_named_main.rs b/examples/task_named_main.rs
new file mode 100644
index 0000000..c3d21b5
--- /dev/null
+++ b/examples/task_named_main.rs
@@ -0,0 +1,26 @@
+//! examples/task_named_main.rs
+
+#![deny(unsafe_code)]
+#![deny(warnings)]
+#![no_main]
+#![no_std]
+
+use panic_semihosting as _;
+
+#[rtic::app(device = lm3s6965, dispatchers = [SSI0])]
+mod app {
+ use cortex_m_semihosting::{debug, hprintln};
+
+ #[init]
+ fn init(_: init::Context) -> init::LateResources {
+ main::spawn().unwrap();
+
+ init::LateResources {}
+ }
+
+ #[task]
+ fn main(_: main::Context) {
+ hprintln!("This task is named main, useful for rust-analyzer").unwrap();
+ debug::exit(debug::EXIT_SUCCESS);
+ }
+}