From 81275bfa4f41e2066770087f3a33cad4227eab41 Mon Sep 17 00:00:00 2001 From: Jorge Aparicio Date: Thu, 13 Jun 2019 23:56:59 +0200 Subject: rtfm-syntax refactor + heterogeneous multi-core support --- examples/types.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'examples/types.rs') diff --git a/examples/types.rs b/examples/types.rs index c3dd89c..2e72f0a 100644 --- a/examples/types.rs +++ b/examples/types.rs @@ -5,12 +5,11 @@ #![no_main] #![no_std] -extern crate panic_semihosting; - use cortex_m_semihosting::debug; -use rtfm::{Exclusive, Instant}; +use panic_semihosting as _; +use rtfm::cyccnt::Instant; -#[rtfm::app(device = lm3s6965)] +#[rtfm::app(device = lm3s6965, peripherals = true, monotonic = rtfm::cyccnt::CYCCNT)] const APP: () = { static mut SHARED: u32 = 0; @@ -43,7 +42,7 @@ const APP: () = { #[task(priority = 2, resources = [SHARED], schedule = [foo], spawn = [foo])] fn foo(c: foo::Context) { let _: Instant = c.scheduled; - let _: Exclusive = c.resources.SHARED; + let _: &mut u32 = c.resources.SHARED; let _: foo::Resources = c.resources; let _: foo::Schedule = c.schedule; let _: foo::Spawn = c.spawn; -- cgit v1.2.3 From 4e51bb68b976c6bb6a9a989dc560d2a8123a84ca Mon Sep 17 00:00:00 2001 From: Jorge Aparicio Date: Thu, 20 Jun 2019 06:19:59 +0200 Subject: RFC #207 --- examples/types.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'examples/types.rs') diff --git a/examples/types.rs b/examples/types.rs index 2e72f0a..3e9c7ea 100644 --- a/examples/types.rs +++ b/examples/types.rs @@ -24,19 +24,19 @@ const APP: () = { debug::exit(debug::EXIT_SUCCESS); } - #[exception(schedule = [foo], spawn = [foo])] - fn SVCall(c: SVCall::Context) { + #[task(binds = SVCall, schedule = [foo], spawn = [foo])] + fn svcall(c: svcall::Context) { let _: Instant = c.start; - let _: SVCall::Schedule = c.schedule; - let _: SVCall::Spawn = c.spawn; + let _: svcall::Schedule = c.schedule; + let _: svcall::Spawn = c.spawn; } - #[interrupt(resources = [SHARED], schedule = [foo], spawn = [foo])] - fn UART0(c: UART0::Context) { + #[task(binds = UART0, resources = [SHARED], schedule = [foo], spawn = [foo])] + fn uart0(c: uart0::Context) { let _: Instant = c.start; let _: resources::SHARED = c.resources.SHARED; - let _: UART0::Schedule = c.schedule; - let _: UART0::Spawn = c.spawn; + let _: uart0::Schedule = c.schedule; + let _: uart0::Spawn = c.spawn; } #[task(priority = 2, resources = [SHARED], schedule = [foo], spawn = [foo])] -- cgit v1.2.3 From 9195038c87703fc94b6e99f6de593886d51c2b19 Mon Sep 17 00:00:00 2001 From: Jorge Aparicio Date: Wed, 10 Jul 2019 22:42:44 +0200 Subject: implement RFC #212 --- examples/types.rs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'examples/types.rs') diff --git a/examples/types.rs b/examples/types.rs index 3e9c7ea..0c8097f 100644 --- a/examples/types.rs +++ b/examples/types.rs @@ -11,7 +11,10 @@ use rtfm::cyccnt::Instant; #[rtfm::app(device = lm3s6965, peripherals = true, monotonic = rtfm::cyccnt::CYCCNT)] const APP: () = { - static mut SHARED: u32 = 0; + struct Resources { + #[init(0)] + shared: u32, + } #[init(schedule = [foo], spawn = [foo])] fn init(c: init::Context) { @@ -31,18 +34,18 @@ const APP: () = { let _: svcall::Spawn = c.spawn; } - #[task(binds = UART0, resources = [SHARED], schedule = [foo], spawn = [foo])] + #[task(binds = UART0, resources = [shared], schedule = [foo], spawn = [foo])] fn uart0(c: uart0::Context) { let _: Instant = c.start; - let _: resources::SHARED = c.resources.SHARED; + let _: resources::shared = c.resources.shared; let _: uart0::Schedule = c.schedule; let _: uart0::Spawn = c.spawn; } - #[task(priority = 2, resources = [SHARED], schedule = [foo], spawn = [foo])] + #[task(priority = 2, resources = [shared], schedule = [foo], spawn = [foo])] fn foo(c: foo::Context) { let _: Instant = c.scheduled; - let _: &mut u32 = c.resources.SHARED; + let _: &mut u32 = c.resources.shared; let _: foo::Resources = c.resources; let _: foo::Schedule = c.schedule; let _: foo::Spawn = c.spawn; -- cgit v1.2.3 From 07b2b4d83078d0fd260d5f0812e8d5a34d02b793 Mon Sep 17 00:00:00 2001 From: Jorge Aparicio Date: Wed, 21 Aug 2019 10:17:27 +0200 Subject: doc up --- examples/types.rs | 47 ++++++++++++++++++++++++----------------------- 1 file changed, 24 insertions(+), 23 deletions(-) (limited to 'examples/types.rs') diff --git a/examples/types.rs b/examples/types.rs index 0c8097f..fc391d0 100644 --- a/examples/types.rs +++ b/examples/types.rs @@ -7,7 +7,7 @@ use cortex_m_semihosting::debug; use panic_semihosting as _; -use rtfm::cyccnt::Instant; +use rtfm::cyccnt; #[rtfm::app(device = lm3s6965, peripherals = true, monotonic = rtfm::cyccnt::CYCCNT)] const APP: () = { @@ -17,38 +17,39 @@ const APP: () = { } #[init(schedule = [foo], spawn = [foo])] - fn init(c: init::Context) { - let _: Instant = c.start; - let _: rtfm::Peripherals = c.core; - let _: lm3s6965::Peripherals = c.device; - let _: init::Schedule = c.schedule; - let _: init::Spawn = c.spawn; + fn init(cx: init::Context) { + let _: cyccnt::Instant = cx.start; + let _: rtfm::Peripherals = cx.core; + let _: lm3s6965::Peripherals = cx.device; + let _: init::Schedule = cx.schedule; + let _: init::Spawn = cx.spawn; debug::exit(debug::EXIT_SUCCESS); } - #[task(binds = SVCall, schedule = [foo], spawn = [foo])] - fn svcall(c: svcall::Context) { - let _: Instant = c.start; - let _: svcall::Schedule = c.schedule; - let _: svcall::Spawn = c.spawn; + #[idle(schedule = [foo], spawn = [foo])] + fn idle(cx: idle::Context) -> ! { + let _: idle::Schedule = cx.schedule; + let _: idle::Spawn = cx.spawn; + + loop {} } #[task(binds = UART0, resources = [shared], schedule = [foo], spawn = [foo])] - fn uart0(c: uart0::Context) { - let _: Instant = c.start; - let _: resources::shared = c.resources.shared; - let _: uart0::Schedule = c.schedule; - let _: uart0::Spawn = c.spawn; + fn uart0(cx: uart0::Context) { + let _: cyccnt::Instant = cx.start; + let _: resources::shared = cx.resources.shared; + let _: uart0::Schedule = cx.schedule; + let _: uart0::Spawn = cx.spawn; } #[task(priority = 2, resources = [shared], schedule = [foo], spawn = [foo])] - fn foo(c: foo::Context) { - let _: Instant = c.scheduled; - let _: &mut u32 = c.resources.shared; - let _: foo::Resources = c.resources; - let _: foo::Schedule = c.schedule; - let _: foo::Spawn = c.spawn; + fn foo(cx: foo::Context) { + let _: cyccnt::Instant = cx.scheduled; + let _: &mut u32 = cx.resources.shared; + let _: foo::Resources = cx.resources; + let _: foo::Schedule = cx.schedule; + let _: foo::Spawn = cx.spawn; } extern "C" { -- cgit v1.2.3