aboutsummaryrefslogtreecommitdiff
path: root/examples/t-stask-main.rs
diff options
context:
space:
mode:
authorGravatar Jorge Aparicio <jorge.aparicio@ferrous-systems.com> 2020-05-29 14:50:28 +0200
committerGravatar Jorge Aparicio <jorge.aparicio@ferrous-systems.com> 2020-05-29 14:50:28 +0200
commit0ad311074e3d49a66174f59c47c4d6183ce7e3a0 (patch)
tree0dc14a960059209d864629c3134c318c978f1686 /examples/t-stask-main.rs
parent1e827e24d024e910b44f6cc6db278e4c66a77683 (diff)
downloadrtic-0ad311074e3d49a66174f59c47c4d6183ce7e3a0.tar.gz
rtic-0ad311074e3d49a66174f59c47c4d6183ce7e3a0.tar.zst
rtic-0ad311074e3d49a66174f59c47c4d6183ce7e3a0.zip
allow handlers to be named 'main'
`#[init]`, `#[idle]` and `#[task]` handlers can now be named `main` fixes #311
Diffstat (limited to 'examples/t-stask-main.rs')
-rw-r--r--examples/t-stask-main.rs24
1 files changed, 24 insertions, 0 deletions
diff --git a/examples/t-stask-main.rs b/examples/t-stask-main.rs
new file mode 100644
index 00000000..b55161ea
--- /dev/null
+++ b/examples/t-stask-main.rs
@@ -0,0 +1,24 @@
+#![deny(unsafe_code)]
+#![deny(warnings)]
+#![no_main]
+#![no_std]
+
+use cortex_m_semihosting::debug;
+use panic_semihosting as _;
+
+#[rtfm::app(device = lm3s6965)]
+const APP: () = {
+ #[init(spawn = [main])]
+ fn init(cx: init::Context) {
+ cx.spawn.main().ok();
+ }
+
+ #[task]
+ fn main(_: main::Context) {
+ debug::exit(debug::EXIT_SUCCESS);
+ }
+
+ extern "C" {
+ fn UART0();
+ }
+};