rtic/examples/t-binds.rs

46 lines
868 B
Rust
Raw Normal View History

//! [compile-pass] Check that `binds` works as advertised
2019-04-21 20:13:15 +02:00
#![deny(unsafe_code)]
#![deny(warnings)]
2023-01-19 13:56:59 +01:00
#![deny(missing_docs)]
2019-02-23 21:50:52 +01:00
#![no_main]
#![no_std]
2021-03-03 08:53:03 +01:00
use panic_semihosting as _;
2019-02-23 21:50:52 +01:00
2020-06-11 19:18:29 +02:00
#[rtic::app(device = lm3s6965)]
2020-05-19 20:00:13 +02:00
mod app {
2021-09-22 13:22:45 +02:00
use cortex_m_semihosting::debug;
2021-07-07 22:50:59 +02:00
#[shared]
struct Shared {}
#[local]
struct Local {}
2019-02-23 21:50:52 +01:00
#[init]
2023-01-07 17:59:39 +01:00
fn init(_: init::Context) -> (Shared, Local) {
2021-09-22 13:22:45 +02:00
debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator
2023-01-07 17:59:39 +01:00
(Shared {}, Local {})
2020-10-01 19:38:49 +02:00
}
2019-02-23 21:50:52 +01:00
2019-06-20 06:19:59 +02:00
// Cortex-M exception
#[task(binds = SVCall)]
2019-04-21 20:13:15 +02:00
fn foo(c: foo::Context) {
2020-10-15 18:50:17 +02:00
crate::foo_trampoline(c)
2019-04-21 20:13:15 +02:00
}
2019-02-23 21:50:52 +01:00
2019-06-20 06:19:59 +02:00
// LM3S6965 interrupt
#[task(binds = UART0)]
2019-04-21 20:13:15 +02:00
fn bar(c: bar::Context) {
2020-10-15 18:50:17 +02:00
crate::bar_trampoline(c)
2019-04-21 20:13:15 +02:00
}
2020-04-22 12:58:14 +02:00
}
2019-02-23 21:50:52 +01:00
2019-02-23 21:56:05 +01:00
#[allow(dead_code)]
2020-10-15 18:50:17 +02:00
fn foo_trampoline(_: app::foo::Context) {}
2019-02-23 21:50:52 +01:00
2019-02-23 21:56:05 +01:00
#[allow(dead_code)]
2020-10-15 18:50:17 +02:00
fn bar_trampoline(_: app::bar::Context) {}