aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-06-11 16:22:33 +0000
committerGitHub <noreply@github.com>2020-06-11 16:22:33 +0000
commit4795c1dba39b908bcab4ac148e691e2e99594289 (patch)
tree169da65f2ba2ede45eaf40bcfb6c76a87c4b443a /examples
parent4397fbf76285658a108b0f17665f4024d97cfcb3 (diff)
parent0ad311074e3d49a66174f59c47c4d6183ce7e3a0 (diff)
Merge #315
315: allow handlers to be named 'main' r=korken89 a=japaric `#[init]`, `#[idle]` and `#[task]` handlers can now be named `main` fixes #311 Co-authored-by: Jorge Aparicio <jorge.aparicio@ferrous-systems.com>
Diffstat (limited to 'examples')
-rw-r--r--examples/t-htask-main.rs20
-rw-r--r--examples/t-idle-main.rs20
-rw-r--r--examples/t-init-main.rs15
-rw-r--r--examples/t-stask-main.rs24
4 files changed, 79 insertions, 0 deletions
diff --git a/examples/t-htask-main.rs b/examples/t-htask-main.rs
new file mode 100644
index 0000000..d229d81
--- /dev/null
+++ b/examples/t-htask-main.rs
@@ -0,0 +1,20 @@
+#![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]
+ fn init(_: init::Context) {
+ rtfm::pend(lm3s6965::Interrupt::UART0)
+ }
+
+ #[task(binds = UART0)]
+ fn main(_: main::Context) {
+ debug::exit(debug::EXIT_SUCCESS);
+ }
+};
diff --git a/examples/t-idle-main.rs b/examples/t-idle-main.rs
new file mode 100644
index 0000000..d1bb148
--- /dev/null
+++ b/examples/t-idle-main.rs
@@ -0,0 +1,20 @@
+#![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]
+ fn init(_: init::Context) {
+ }
+
+ #[idle]
+ fn main(_: main::Context) -> ! {
+ debug::exit(debug::EXIT_SUCCESS);
+ loop {}
+ }
+};
diff --git a/examples/t-init-main.rs b/examples/t-init-main.rs
new file mode 100644
index 0000000..e0d94d5
--- /dev/null
+++ b/examples/t-init-main.rs
@@ -0,0 +1,15 @@
+#![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]
+ fn main(_: main::Context) {
+ debug::exit(debug::EXIT_SUCCESS);
+ }
+};
diff --git a/examples/t-stask-main.rs b/examples/t-stask-main.rs
new file mode 100644
index 0000000..b55161e
--- /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();
+ }
+};